Skip to content

Add FAQ entry about doctest formatting#5017

Closed
infektyd wants to merge 2 commits intopsf:mainfrom
infektyd:fix/doctest-faq
Closed

Add FAQ entry about doctest formatting#5017
infektyd wants to merge 2 commits intopsf:mainfrom
infektyd:fix/doctest-faq

Conversation

@infektyd
Copy link
Copy Markdown

@infektyd infektyd commented Mar 2, 2026

Black doesn't format doctests in docstrings. This PR adds a FAQ entry explaining this limitation and pointing users to dedicated doctest formatting tools.

Fixes #3083

Black doesn't format doctests in docstrings. This commit adds a FAQ
entry explaining this limitation and pointing users to dedicated
doctest formatting tools.

Fixes psf#3083
@cobaltt7 cobaltt7 added the ci: skip news Pull requests that don't need a changelog entry. label Mar 5, 2026

If you need to format doctests, consider using a dedicated tool such as
[doctestfmt](https://github.com/itsafely/doctestfmt) or
[pytest-doctestplus](https://pypi.org/project/pytest-doctestplus/) with
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like this one only runs doctests, not format them? I don't see any mention of the --doctest-format option in their README.

Copy link
Copy Markdown
Author

@infektyd infektyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, @JelleZijlstra. I've updated the recommendation to blacken-docs which specifically focuses on formatting code blocks within documentation/docstrings using Black. (added by Syntra 🚀)

@cobaltt7
Copy link
Copy Markdown
Collaborator

cobaltt7 commented Mar 6, 2026

See also #4916

@infektyd
Copy link
Copy Markdown
Author

infektyd commented Mar 7, 2026

Closing as duplicate of #4916 thanks for the pointer

@infektyd infektyd closed this Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: skip news Pull requests that don't need a changelog entry.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation: mention tools that can do doctests formatting

3 participants