42 Py Formatter is a VS Code extension for Python projects. It bundles:
- Black 26.5.1 for deterministic document formatting
- flake8 7.3.0 for style and code-quality diagnostics
- mypy 1.18.2 with
--strict enabled by default for type diagnostics
Only Python 3.10 or newer is required on the computer. Black, flake8, and mypy do not need to be installed separately. Mypy 1.18.2 is intentionally used because newer releases require a platform-specific runtime; this keeps one VSIX portable across Windows, macOS, and Linux.
Commands and keyboard shortcuts
The extension never assigns a default keyboard shortcut. Open Preferences: Open Keyboard Shortcuts, search for 42 Py Formatter, and assign any keys you prefer.
42 Py Formatter: Open Menu
42 Py Formatter: Format Current Document
42 Py Formatter: Check Current File
42 Py Formatter: Check Workspace
42 Py Formatter: Configure
42 Py Formatter: Show Output
All formatting and checking commands work independently of save events. The status-bar item opens the same actions and the most common on/off switches.
Diagnostics
flake8 and mypy findings appear in the editor and VS Code Problems panel with separate sources. Current-file checks use the open editor text, including unsaved changes. Workspace checks ignore common environment, cache, VCS, and node_modules directories.
Standard project configuration is resolved from the selected workspace: pyproject.toml, setup.cfg, .flake8, and mypy.ini. Explicit extension settings and additional arguments are passed to the bundled tools.
Settings
Events and runtime
pyFormatter.pythonPath — Python 3.10+ executable; default python
pyFormatter.formatOnSave — default false
pyFormatter.checkOnSave — default true
pyFormatter.checkOnOpen — default true
pyFormatter.checkOnChange — default false
pyFormatter.checkOnChangeDelay — default 750 ms
pyFormatter.showStatusBar — default true
pyFormatter.traceRunner — write runner details to the output channel
Black
pyFormatter.black.enabled
pyFormatter.black.lineLength
pyFormatter.black.skipStringNormalization
pyFormatter.black.skipMagicTrailingComma
pyFormatter.black.targetVersions
pyFormatter.black.extraArgs
flake8
pyFormatter.flake8.enabled
pyFormatter.flake8.maxLineLength
pyFormatter.flake8.ignore
pyFormatter.flake8.select
pyFormatter.flake8.extraArgs
mypy
pyFormatter.mypy.enabled
pyFormatter.mypy.strict
pyFormatter.mypy.followImports
pyFormatter.mypy.ignoreMissingImports
pyFormatter.mypy.extraArgs
Additional arguments are appended after the corresponding explicit settings, allowing advanced users to override them intentionally.
Development
./scripts/vendor-python.sh
npm install
npm test
npm run package
npm run smoke:package
Open this directory in VS Code and press F5 to start an Extension Development Host.
License
The extension is distributed under the MIT License. Bundled dependency licenses are listed in THIRD_PARTY_NOTICES.md and retained beside their distributions under python/vendor.