Add help string formatters that don't use escaped characters.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.7k
- Forks
- 2.3k
- Avg merge
- 1d 30m
- Merged PRs (30d)
- 18
Description
I'd love to use the \f and \b in my docstrings to have a single source of help text. However, Ruff D301 enforces PEP 257 which requires docstrings to be raw (r"""…""") if they have any backslashes in them. Doing that breaks the VS Code syntax highlighting to no longer treat the string as a docstring.
So, I've had to move documentation out of the docstring for the function and into the help argument, repeating the docstring first line, all because I want to use \b and \f to fight Click's helpful auto-formatting. Please add an additional formatting mechanism to support these functions. If I'm going to put visual garbage in my source file to get the formatting to behave, it would be nice if it were self-documenting, e.g.
@click.option(…)
@click.option(…)
def myfunc(cats: int = 0, feet: int = 0) -> None:
"""Does good stuff.
Here's more detailed information
on how this works.
<<click-preserve-whitespace>>
Examples:
# basic usage
$ myfunc
# overrides
$ myfunc --cats 1 --feet 17
<<click-end-help>>
Args:
cats: Number of cats to assume prowling around.
feet: How far cats can jump during attacks.
"""
pass
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name implementation files, tests, or an entry point. Start by locating Click's existing help formatting and docstring handling, then compare its current whitespace behavior with the proposed preserve/end markers; done means a documented formatter mechanism with coverage for the example cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100