flake8-commas
Flake8 lint for trailing commas.
What it is and what it does
flake8-commas is a linter plugin that checks trailing comma placement in Python code. It integrates directly into flake8 and runs as part of your normal linting workflow, reporting errors (C812–C819) when commas are missing or incorrectly placed in multi-line structures. The plugin is designed to enforce consistent comma style across dictionaries, lists, function arguments, and tuples, which reduces merge conflicts when multiple developers edit the same data structures.
The plugin supports multiple Python versions with version-specific rules: different comma requirements apply to Python 2, Python 3, Python 3.5+, and Python 3.6+. It handles edge cases like bare tuples, lambda parameters, subscripts with slices, and function definitions with unpacking. The package is permissive (MIT license) and has low installation friction—it's a pure Python wheel with only flake8 as a dependency.
Use it for:
- Enforce trailing commas in team codebases to reduce merge conflicts when multiple developers modify adjacent lines in lists or dicts.
- Catch accidental trailing commas that turn expressions into tuples (e.g., json_data = json.dumps({...}), becomes a tuple instead of the result).
- Lint Python 3.5+ and 3.6+ codebases with version-specific comma rules by configuring which error codes to enforce.
- Integrate comma style checking into CI/CD pipelines as part of flake8 without adding a separate tool.
- Prevent bare tuple syntax errors and lambda parameter comma mistakes during code review.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A flake8 plugin that enforces trailing comma placement in Python code to reduce merge conflicts in multi-line dictionaries, lists, and function calls.
Yes, if you use flake8 and want to enforce trailing comma consistency to reduce merge conflicts. The plugin is lightweight, permissive, and integrates seamlessly. However, note that maintenance is aging (last release 820 days ago); if you need active support or compatibility with very recent Python/flake8 versions, consider black or add-trailing-comma as alternatives.
Install
flake8-commas on PyPI
pip
pip install flake8-commasuv
uv add flake8-commaspoetry
poetry add flake8-commasInstalling flake8-commas
Before you install
Low friction: pure Python wheel with only flake8 as a runtime dependency. Maintenance status is aging—last release was 820 days ago—but the repository remains active and the project was recently revived after a naming transition in version 4.0.0 (2024-05-16).
License in practice
Permissive license (MIT) means you can use this freely in commercial and private projects without restriction or attribution requirement.
Quickstart
pip install flake8-commas
# Then run flake8 normally; the plugin activates automatically
flake8 your_file.py
# Errors like C812 (missing trailing comma) will appear in output
Requires flake8 to be installed and Python 3.8 or later.
Verify before relying
- Whether the aging maintenance status (820 days since last release) affects compatibility with very recent Python or flake8 versions.
- How this plugin's comma rules interact with or differ from black or add-trailing-comma when used together.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — flake8 |
| Maintenance | aging — 820 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 310,448/month — #7,746 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: flake8_commas-4.0.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
add-trailing-commaAutomatically adds trailing commas to…
permissive · top 15,000 on PyPI
flake8-implicit-str-concatA Flake8 plugin that detects and reports…
permissive · top 15,000 on PyPI
flake8Flake8 is a command-line tool that combines…
permissive · top 1,000 on PyPI
flake8-tupleA flake8 plugin that detects unintended…
permissive · top 15,000 on PyPI
flake8-picky-parenthesesA flake8 plugin that detects and reports…
permissive · top 15,000 on PyPI
flake8-import-orderA flake8 plugin that enforces import ordering…
copyleft · top 5,000 on PyPI
flake8-docstringsIntegrates pydocstyle docstring checking into…
permissive · top 5,000 on PyPI
flake8-gl-codeclimateA Flake8 formatter that outputs linting results…
permissive · top 15,000 on PyPI
flake8-jsonA Flake8 plugin that formats linting output as…
permissive · top 15,000 on PyPI
flake8-pyiA Flake8 plugin that lints Python type stub…
permissive · top 5,000 on PyPI