prettier-plugin-python weekly downloads statistics
By virmwebsites · npm · Prettier plugins
Prettier plugin for Python using Prettier's plugin API (tree-sitter WASM parser + Doc printer).
prettier-plugin-python has 36 recorded weekly downloads on npm, a change of -18.2% over the past 7 days, ranking #2852 of 3,247 tracked listings.
About prettier-plugin-python
prettier-plugin-python
A Prettier plugin for Python that parses and formats Python code using Prettier’s public plugin API.
- Parser:
web-tree-sitterwith thetree-sitter-pythongrammar (bundled as WASM) to parse Python source. - Printer: walks the syntax tree and emits Prettier Doc IR (
group,indent,line/hardline,join, etc.) so Prettier’s engine produces formatted output. - Plugin API: exports
languages,parsers, andprintersper the Prettier plugin docs. - No external Python formatter/runtime required.
Status: Best-effort implementation covering core Python constructs (modules, imports, function/class definitions, decorators, parameters/arguments, control flow, try/except/finally,
with,match/case, expressions, calls/attributes/subscripts, collections, assignments, and more). Some constructs may fall back to source-preserving/generic printing. Printer coverage can be extended insrc/printer.js.
Requirements
- Prettier v3+
- Node.js >= 18
Install
From GitHub
npm install --save-dev github:virmwebsites/Prettier-Python prettier
Or clone/install locally:
git clone https://github.com/virmwebsites/Prettier-Python.git
cd Prettier-Python
npm install
From npm
npm install --save-dev prettier-plugin-python prettier
Note: the npm package name
prettier-plugin-pythonmay be unavailable; if so, install from GitHub or use the published package name for this repo.
Usage
CLI
# using the plugin from this repo/path
npx prettier --plugin ./src/index.js --write "**/*.py"
# check formatting
npx prettier --plugin ./src/index.js --check "**/*.py"
When installed as a dependency/configured by name:
npx prettier --plugin prettier-plugin-python --write "**/*.py"
Prettier config
prettier.config.mjs:
export default {
plugins: ["prettier-plugin-python"],
// or a local/path install:
// plugins: ["./path/to/Prettier-Python/src/index.js"],
};
Programmatic API
const prettier = require("prettier");
const plugin = require("prettier-plugin-python");
// or: const plugin = require("./src/index.js");
const formatted = await prettier.format(source, {
parser: "python",
plugins: [plugin],
});
Editor (format on save)
- Install/configure Prettier for your editor (e.g. VS Code “Prettier - Code formatter”).
- Ensure this plugin is loaded (via Prettier config
pluginsas above). - Set Prettier as the default formatter for Python and enable format on save, for example (VS Code
settings.json):
If another Python formatter is set as default for{ "[python]": { "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true } }[python], switch the default formatter to Prettier.
Project structure
src/index.js— plugin entry (languages,parsers,printers)src/parser.js— async tree-sitter (WASM) parser integration,locStart/locEndsrc/printer.js— AST/CST-to-Prettier-Doc printersrc/wasm/tree-sitter-python.wasm— bundled Python grammar
Development
npm install
node -e "require('./src')"
To try formatting locally:
npx prettier --plugin ./src/index.js path/to/file.py
Publishing notes
- Repository: https://github.com/virmwebsites/Prettier-Python
- npm publish (maintainers):
- Ensure
package.jsonnameis available on npm (or use a scoped name, e.g.@virmwebsites/prettier-plugin-python) and metadata/version are correct. npm loginnpm publish --access public
- Ensure
- Versioning: bump with
npm version patch|minor|major, then publish and push tags/commits. - GitHub install: consumers can install directly via
npm install github:virmwebsites/Prettier-Python(runtime files includingsrc/wasmare committed).
License
MIT — see LICENSE.
Description from the npm listing.
- prettier
- prettier-plugin
- python
- formatter
- tree-sitter
- web-tree-sitter
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (128)Similar npm Prettier plugins plugins
All 20 prettier-plugin-python alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/prettier-plugin-python. First seen Nov 24, 2026; last successful collection Dec 6, 2026. See the methodology.