TorchFix is a Python code static analysis tool - a linter with autofix capabilities - for users of PyTorch. It can be used to find and fix issues like

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-04-19 18:30:08

TorchFix is a Python code static analysis tool - a linter with autofix capabilities - for users of PyTorch. It can be used to find and fix issues like usage of deprecated PyTorch functions and non-public symbols, and to adopt PyTorch best practices in general.

TorchFix is built upon https://github.com/Instagram/LibCST - a library to manipulate Python concrete syntax trees. LibCST enables "codemods" (autofixes) in addition to reporting issues.

TorchFix can be used as a Flake8 plugin (linting only) or as a standalone program (with autofix available for a subset of the lint violations).

To install the latest code from GitHub, clone/download https://github.com/pytorch-labs/torchfix and run pip install . inside the directory.

After the installation, TorchFix will be available as a Flake8 plugin, so running Flake8 normally will run the TorchFix linter.

TorchFix can also be run as a standalone program: torchfix . Add --fix parameter to try to autofix some of the issues (the files will be overwritten!) To see some additional debug info, add --show-stderr parameter.

Leave a Comment