sphinx-doc / sphinx-doc/sphinx-argparse

Include specified type in the html

Open
#19 0 comments 3 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

Problem

When writing arguments using argparse, one often includes the type of the variable (e.g., str, np.int32).
However as far as I can tell, when using sphinx-argparse this type is not included in the documentation.
I also cannot seem to find how to include the type anywhere in the documentation.
While errors are obviously thrown if the type of the argument is incorrect, is there a way to include the type of the argument that is include in the add_argument function in the documentation?

Example
parser.add_argument(
     '--hello', dest='hello', type=str, default='Hello world!'
)

should give something in the documentation html like

--train   type: str
    Default: 'Hello world!'

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

No source file or test is named. Start by locating the sphinx-argparse path that turns argparse.add_argument metadata into HTML, then check how types such as str and np.int32 are represented. Done means generated documentation includes the declared type alongside the option and default, with a regression test covering the example.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.