-
Notifications
You must be signed in to change notification settings - Fork 11
Development: code style
Deborah Kaplan edited this page Feb 18, 2026
·
1 revision
- on PR, use
blackfor reformatting, almost entirely bog-standard config except line length - on PR, use
isortfor import sorting - on PR, use
mypyfor type checking
Formatting and import sorting happen automatically, because we're enforcing them. Type checking will produce errors instead of auto-fixing, because they require developer input to resolve.
Just once, to get the new testing requirements:
pip install -r requirements.txtEvery time you want to check locally:
black .
isort .
mypy .If you're using Visual Studio Code:
- install the extension matangover.mypy (link)
- install the extension ms-python.black-formatter (link)
- install the extension ms-python.vscode-pylance (link)
-
pip install -r requirements.txtin your VS Code requirements - add the following to your
settings.json(merging with existing blocks as needed):"[python]": { "editor.formatOnType": true, "editor.defaultFormatter": "ms-python.black-formatter", "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.organizeImports": "explicit" } }, "isort.args": ["--profile", "black"], "mypy.runUsingActiveInterpreter": true,