Welcome! We'd like to make contributing to pyanalyze as painless as possible. Here is a quick guide.
It's useful to have a virtual environment to work in. I use commands like these:
$ cd pyanalyze
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt
$ pip install -e .
The code is formatted using Black. You can run the formatter with:
$ black pyanalyze
We use ruff as a linter and import sorter:
$ ruff check pyanalyze
The unit tests are run with pytest:
$ pytest -v pyanalyze
Running all of the tests takes a few minutes, so I often use the
-k
option to select only the tests I am currently working on.
For example:
$ pytest -v pyanalyze -k PEP673
We run tests on all supported Python versions on GitHub Actions, but usually I don't bother when testing locally. If necessary, you can install all supported versions with a tool like pyenv.