Recently, we added Spin to the arsenal of tools available for developers. The original proposal can be found in RFC #164469—feel free to comment there with your feedback.
It is a general developer cli tool that helps with the running of common tasks without the need of memorizing a lot of magical command line incantations. If you’re working with a recent PyTorch development environment, Spin should already be available. Otherwise, you can install it with pip install spin.
As with many advanced projects, Pytorch developers face the need to reliably execute a number of common tasks in daily development such as building the project and linting the (new) source code, among others.
To make this less prone to errors on the command line, we added a custom Spin configuration to Pytorch that already helps with some of the more tedious tasks.
For example, linting is performed in a uniform way as given by the Lintrunner configuration in a well-defined environment that is kept separate from the main development environment. These same spin-based environments will also be used in CI, helping to unify the CI and the local development process.
Currently available Spin commands include:
Build:
spin lint- Lint all filesspin fixlint- Autofix all filesspin quicklint- Lint changed filesspin quickfix- Autofix changed files
Regenerate:
spin regenerate-version- Regenerateversion.pyspin regenerate-type-stubs- Regenerate type stubsspin regenerate-clangtidy-files- Regenerate clang-tidy filesspin regenerate-github-workflows- Regenerate GitHub workflows from templates
The full and current set of available Spin commands can be inspected by executing spin help in a recent Pytorch clone and is also documented in CONTRIBUTING.md.
In the near future, we are planning to add commands for building the binary part of the project (libtorch) in a way that aligns CI building with local development. Additionally, while Pyrefly linting is already integrated via spin lint, we plan to add support for pyrefly infer to automatically add type annotations as a developer tool. This work is tracked in issue #169479—please comment there with your feedback and suggestions.
Stay tuned and let us know how you like the Spin support!
What would you like to see added? Share your thoughts in the original RFC (#164469).