diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bc0b0fc9bb0..863a685886a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,6 +14,10 @@ aspects of contributing to PyTorch. - [Tips and Debugging](#tips-and-debugging) - [Nightly Checkout & Pull](#nightly-checkout--pull) - [Codebase structure](#codebase-structure) +- [Spin](#spin) + - [Linting](#linting) + - [default lint](#default-lint) + - [Regenerating](#regenerating) - [Unit testing](#unit-testing) - [Python Unit Testing](#python-unit-testing) - [Better local unit tests with `pytest`](#better-local-unit-tests-with-pytest) @@ -274,6 +278,46 @@ dependencies as well as the nightly binaries into the repo directory. * ... * [.circleci](.circleci) - CircleCI configuration management. [README](.circleci/README.md) +## Spin + +[Spin](https://github.com/scientific-python/spin) is a developer cli tool that +helps running common tasks. +To list the available tasks, run `spin --help`. +Currently, we support the following tasks with Spin: + +### Linting + +Spin helps with linting by making sure that lintrunner is installed correctly +and by isolating the lintrunner environment from the general development +environment using uv. + +|command|| +|-|-| +|`setup-lint`|update lintrunner and perform a fresh setup| +|`lazy-setup-lint`|only perform setup if the lint configuration has changed| +|`lint`|perform default lint (see below)| +|`quicklint`|perform lint on all files changed in the latest commit and the working directory| +|`quickfix`|autofix issues on all files changed in the latest commit and the working directory| + +#### default lint + +Since some linters take a long time to run, we categorize all linters as either +fast or slow. In the default lint, only the fast linters are run on all files; +the slow linters are run on the changed files only. + +### Regenerating + +Pytorch makes use of a number of code generations, which range from the version +information in `torch/version.py` over type stubs and other linter support to +github workflows. +With Spin, we offer a unified interface to these tasks. + +|command|| +|-|-| +|`regenerate-version`|regenerate `torch/version.py`| +|`regenerate-type-stubs`|regenerates type stubs for use by static type checkers| +|`regenerate-clangtidy-files`|regenerates clang related files needed for linting| + ## Unit testing ### Python Unit Testing