My configuration files for python projects.
- Python version: 3.12
- Tools-
- ruff - For formatting & linting.
- basedpyright - For strict type checking.
I use Makefiles to automate running commands. If you have make on your system, you can run the following commands-
make- For formatting, lint checking and auto fixing stuff it can.make check- For running the type checker.
-
Selected-
-
Ignored-
- ANN401 - Any Type
-
Fixable-
In basedpyright, all type checking rules are enabled by default. These are the ones disabled-
-
reportImportCycles
Ignore import cycles for type annotations.
-
reportUnnecessaryIsInstance
Ignore for enforcing type checks.
-
reportImplicitStringConcatenation
Ignore for splitting long strings into multiple strings in each line for implicit concatenation.
-
reportUnusedCallResult
Ignore to reduce verbosity in creating unused variables.
-
reportMissingTypeStubs
Ignore for third party libraries that do not have stubs.
-
reportAny
Ignore for third party libraries that do not support specific / explicit Any type. The
ANNruff linter rule will alert any untyped parameters / return value. -
reportExplicitAny
Ignore as explicit Any has been applied for a reason.
-
reportImplicitOverride
To reduce verbosity.
-
reportDeprecated
Specifically for ignoring older typing standards. This is for supporting backward compatibility in library development.
I personally prefer to use uv run for running these tools, which means I also need to add them to my environment before running, which I don't mind.
Others recommend using uvx or uv tool run for running CLI tools. If you don't want to have separate dev dependancies for formatting/linting/type checking,
you can use the other method.