add-trailing-comma
Automatically add trailing commas to calls and literals
Decision gist · record as of 2026-08-14
Yes. Low install friction, active maintenance, no security issues, and permissive MIT license. Useful for teams that want to enforce a specific trailing-comma style automatically. Install if your project or team values consistent multi-line formatting and wants to reduce manual code review overhead; skip if your codebase already uses a different formatter (e.g., Black) that handles trailing commas differently.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Low friction: pure Python wheel with a single runtime dependency (tokenize-rt).
- Active maintenance with recent release (2025-10-10) and no known vulnerabilities.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects.
last release 2025-10-10 (308 days) · last repo commit 2026-07-15 · 373 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 88,391 downloads/mo, #13,732 on PyPI
Alternatives
Verify before relying
pip install add-trailing-comma
Then add to .pre-commit-config.yaml:
- repo: https://github.com/asottile/add-trailing-comma
rev: v4.0.0
hooks:
- id: add-trailing-comma- Whether the tool modifies files in-place or outputs to stdout by default.
- How the tool handles existing trailing commas in single-line constructs.
- Performance characteristics on large codebases or deeply nested structures.
What it is and what it does
add-trailing-comma is a code formatter that enforces a specific multi-line formatting style by automatically adding trailing commas to the last parameter or element in function calls, literals, definitions, imports, class declarations, and other multi-line constructs. It works as a standalone tool or integrates as a pre-commit hook to run on every commit.
The tool targets a style where trailing commas improve readability and minimize git diffs when parameters are added or removed—each change affects only the lines being modified, preserving blame history. It handles function calls, tuple/list/dict/set literals, function and async function definitions, from-imports, class definitions, with statements, match statements, and PEP-695 type aliases. It also reformats hanging parentheses and braces to match indentation conventions.
Use it for
- Enforce consistent multi-line formatting across a Python project via pre-commit hooks.
- Automatically reformat function calls and literals to add trailing commas for cleaner diffs.
- Standardize function and class definitions to include trailing commas on the last parameter.
- Unhug misaligned parentheses and braces to match project indentation style.
- Maintain code style compliance in CI/CD pipelines without manual review.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Low install friction, active maintenance, no security issues, and permissive MIT license. Useful for teams that want to enforce a specific trailing-comma style automatically. Install if your project or team values consistent multi-line formatting and wants to reduce manual code review overhead; skip if your codebase already uses a different formatter (e.g., Black) that handles trailing commas differently.
Install
add-trailing-comma on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency (tokenize-rt). Active maintenance with recent release (2025-10-10) and no known vulnerabilities.
Requires Python 3.10 or later.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects.
Quickstart
pip install add-trailing-comma
Then add to .pre-commit-config.yaml:
- repo: https://github.com/asottile/add-trailing-comma
rev: v4.0.0
hooks:
- id: add-trailing-comma
Verify before relying
- Whether the tool modifies files in-place or outputs to stdout by default.
- How the tool handles existing trailing commas in single-line constructs.
- Performance characteristics on large codebases or deeply nested structures.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetokenize-rt |
| Maintenance | Actively maintained 308 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 88,391 / month, #13,732 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Programming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy |
Evidence: add_trailing_comma-4.0.0-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “trailing comma formatter”
- add-trailing-commaAutomatically adds trailing commas to multi-line Python function…
- flake8-commasA flake8 plugin that enforces trailing comma placement in Python code…
- jstylesonParses JSON strings that contain JavaScript-style comments…
Give your agent the search over MCP, or paste the wish link into any chat.
More Quality Assurance packages
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
Ruff is a Python linter and code formatter written in Rust that combines linting, formatting, and code fixing into a single tool, replacing Flake8, Black, isort, and related utilities.
Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.
Black reformats Python source code to a consistent style by parsing entire files and rewriting them according to an opinionated, deterministic set of rules, eliminating manual formatting decisions.
pytest-xdist distributes pytest tests across multiple CPU cores or machines to speed up test execution, with the simplest usage being `pytest -n auto` to spawn workers equal to available CPUs.
Install it if your test suite takes long enough that parallelization would save meaningful time.
Validates AWS CloudFormation templates in YAML or JSON format against resource provider schemas and best practices, checking property values and configuration correctness.
Install it if you work with CloudFormation templates.
See also flake8-commas · jsoncomment · jstyleson · pyupgrade · absolufy-imports · shfmt-py · flake8-implicit-str-concat · json-with-comments · config-formatter · pre-commit-hooks