Skip to content

Expand guidance for adopting Black in existing projects - #5472

Open
Mohamedajab wants to merge 8 commits into
psf:mainfrom
Mohamedajab:docs/existing-project-rollout
Open

Mohamedajab wants to merge 8 commits into
psf:mainfrom
Mohamedajab:docs/existing-project-rollout

Conversation

@Mohamedajab

@Mohamedajab Mohamedajab commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add tips for adopting Black in an existing project: consistent configuration, formatting-only commits, automated checks, and coordinating active branches. Present alternatives rather than prescribing one rollout process.

Closes #967.

Checklist

Validation

The changed file passes pre-commit, including Prettier, and git diff --check. The Sphinx build rendered the updated page but could not complete locally because the existing blackd --help program-output command is not on PATH. I have not claimed a successful full docs build for this revision.

@cobaltt7 cobaltt7 added the S: needs discussion Needs further hashing out before ready for implementation (on desirability, feasibility, etc.) label Oct 3, 2026
@cobaltt7

cobaltt7 commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

LGTM, welcoming input from other maintainers

@cobaltt7

cobaltt7 commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator

Had another thought: could you mention --skip-string-normalization in this section as well?

If you are adopting Black in a large project with pre-existing string conventions
(like the popular
"single quotes for data, double quotes for human-readable strings"),
you can pass --skip-string-normalization on the command line. This is meant as an
adoption helper, avoid using this for new projects.

- from "The Black Code Style" docs

@Mohamedajab

Copy link
Copy Markdown
Contributor Author

Thanks — I added the --skip-string-normalization adoption guidance and merged current main, resolving the conflict. The focused pre-commit checks pass.

The refreshed changelog job is failing even though CHANGES.md contains the required (#5472) entry. Its log shows the new grep -Pz '...\)$' expression failing to match that normal non-final changelog line. Could a maintainer apply the ci: skip news label or adjust the workflow check? I have left the changelog in its valid Unreleased → Documentation section rather than moving it solely to satisfy the broken match.

Comment thread docs/guides/introducing_black_to_your_project.md Outdated
Signed-off-by: Mohamed Ajab <mohamedajab8@gmail.com>
Signed-off-by: Mohamed Ajab <mohamedajab8@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S: needs discussion Needs further hashing out before ready for implementation (on desirability, feasibility, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Any advice for existing projects transitioning to black?

3 participants