Skip to content

python

Python sources: lint, layout, strict types, import contracts, docstrings that match their signatures, and no unused code or dependencies. The Python guide explains the setup.

Check Stage Level What it does
python/ruff commit recommended Lints every Python file with the Ruff rules for the level, security rules included.
python/ruff-format commit recommended Checks the layout of every Python file against the Ruff formatter.
python/basedpyright push recommended Type checks the project. At level all, it also requires annotations.
python/import-linter commit recommended Runs project import contracts from setup.cfg, .importlinter, or pyproject.toml.
python/pydoclint commit recommended Checks that each docstring names the arguments, return value, and exceptions of its function.
python/deptry push recommended Compares the imports of the project with the dependencies it declares: missing, unused, and transitive ones.
python/pip-installs commit all Checks that pyproject.toml lists every dependency, with no hand-kept requirements file and no pip install.
python/placeholder-docstrings commit all Finds docstrings that hold a placeholder word, or the name of the function again.
Setting What it sets
tools.ruff.docstring_convention The docstring style that Ruff and pydoclint check: google, numpy, or pep257.

gspot selects it in a scope with file extensions .py, or script interpreters python, python3, or project files pyproject.toml, requirements*.txt, Pipfile. A configuration that requires it selects it too: fastapi, pytest.

Rule file Installed when
.gspot/configurations/language/python/rules/DESIGN.md Always
.gspot/configurations/language/python/rules/FLOW.md Always
.gspot/configurations/language/python/rules/PACKAGING.md Always
.gspot/configurations/language/python/rules/PYTHON.md Always
.gspot/configurations/language/python/rules/TYPING.md Always
Tool Version
uv 0.12.22
ruff 0.16.8
basedpyright 1.40.1
lint-imports 2.15
pydoclint 0.9.1
deptry 0.25.1

gspot writes .gspot/configurations/language/python/ruff.toml and .gspot/configurations/language/python/basedpyright.json.

.venv and venv.