-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Labels
enhancementNew feature or requestNew feature or requestpythonPull requests that update Python codePull requests that update Python code
Description
Description
This project currently uses flake8 for linting, which is great for enforcing code quality. However, it doesn’t handle code formatting.
Introducing black will enforce a consistent code style across the codebase, reduce style-related discussions in code reviews, and speed up development by automating formatting.
We will add black alongside flake8, not as a replacement.
Proposed Solution
- Add
blacktorequirements-lint.txt - Add a
pyproject.tomlwith basicblackconfiguration (targeting Python 3.13) - Format the existing codebase using
black - Add a
black --check .step to the existing CI workflow (alongsideflake8) - Document this in
CONTRIBUTING.md
Suggested Implementation
1. Update requirements-lint.txt
Append:
black==25.1.02. Add pyproject.toml
Create at the repo root:
[tool.black]
line-length = 88
target-version = ['py313']
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.venv
| build
| dist
| __pycache__
| \.eggs
| \.mypy_cache
| \.tox
)/
'''3. Format the codebase
Run:
black .4. Update CI Workflow (lint job)
Append this step after flake8:
- name: Check code formatting with black
run: black --check .5. (Optional) Update CONTRIBUTING.md
Add a new line:
Format your code with
blackbefore committing. Runblack .from the project root
Acceptance Criteria
- black==25.1.0 is listed in
requirements-lint.txt pyproject.tomlwithblackconfig exists- All Python code is formatted with
black - CI pipeline checks code formatting with
black - Contribution guide includes instructions on using
black
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpythonPull requests that update Python codePull requests that update Python code