Skip to content

Commit bd883bb

Browse files
zklauspytorchmergebot
authored andcommitted
Add basic spin linting documentation (pytorch#167227)
This adds basic documentation of the linting features for Spin added in pytorch#167226 to the CONTRIBUTING.md document. Pull Request resolved: pytorch#167227 Approved by: https://github.com/atalman, https://github.com/albanD
1 parent 762273e commit bd883bb

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

CONTRIBUTING.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ aspects of contributing to PyTorch.
1414
- [Tips and Debugging](#tips-and-debugging)
1515
- [Nightly Checkout & Pull](#nightly-checkout--pull)
1616
- [Codebase structure](#codebase-structure)
17+
- [Spin](#spin)
18+
- [Linting](#linting)
19+
- [default lint](#default-lint)
20+
- [Regenerating](#regenerating)
1721
- [Unit testing](#unit-testing)
1822
- [Python Unit Testing](#python-unit-testing)
1923
- [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.
274278
* ...
275279
* [.circleci](.circleci) - CircleCI configuration management. [README](.circleci/README.md)
276280

281+
## Spin
282+
283+
[Spin](https://github.com/scientific-python/spin) is a developer cli tool that
284+
helps running common tasks.
285+
To list the available tasks, run `spin --help`.
286+
Currently, we support the following tasks with Spin:
287+
288+
### Linting
289+
290+
Spin helps with linting by making sure that lintrunner is installed correctly
291+
and by isolating the lintrunner environment from the general development
292+
environment using uv.
293+
294+
|command||
295+
|-|-|
296+
|`setup-lint`|update lintrunner and perform a fresh setup|
297+
|`lazy-setup-lint`|only perform setup if the lint configuration has changed|
298+
|`lint`|perform default lint (see below)|
299+
|`quicklint`|perform lint on all files changed in the latest commit and the working directory|
300+
|`quickfix`|autofix issues on all files changed in the latest commit and the working directory|
301+
302+
#### default lint
303+
304+
Since some linters take a long time to run, we categorize all linters as either
305+
fast or slow. In the default lint, only the fast linters are run on all files;
306+
the slow linters are run on the changed files only.
307+
308+
### Regenerating
309+
310+
Pytorch makes use of a number of code generations, which range from the version
311+
information in `torch/version.py` over type stubs and other linter support to
312+
github workflows.
313+
With Spin, we offer a unified interface to these tasks.
314+
315+
|command||
316+
|-|-|
317+
|`regenerate-version`|regenerate `torch/version.py`|
318+
|`regenerate-type-stubs`|regenerates type stubs for use by static type checkers|
319+
|`regenerate-clangtidy-files`|regenerates clang related files needed for linting|
320+
277321
## Unit testing
278322

279323
### Python Unit Testing

0 commit comments

Comments
 (0)