sphinx-doc / sphinx-doc/sphinx-argparse

Newer versions of Python Argparse give you Colors on Usage String

Open
#94 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
38
Forks
33
PR merge metrics
No merged PRs in 30d

Description

Newer version of Python's argparse return colors. Colors are nice. but they partially break this tool:

usage: tfreport.py [-h] [--level LEVEL] [-v] path

It looks like the terminal stuff is leaking in there.

I can fix it by making color=False in my thing = argparse.ArgumentParser(... color=False) and it corrects in the documentation. Or when running my sphinx build/make I can set NO_COLOR=1:

NO_COLOR=1
make clean; make html

... yeilds a readable

usage: tfreport.py [-h] [--level LEVEL] [-v] path

And it will do the right thing. But I wonder if there's an option to disable color "on the fly" so that this tool can always be no color (or if colors could be supported, that would be cool too).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue by running the Sphinx build or make html with a newer Python argparse, and compare the colored usage output with NO_COLOR=1 or color=False. Trace how argparse usage text is collected and rendered by the extension. Done means generated documentation contains readable usage text without terminal escape sequences, while existing argparse documentation remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.