mitmproxy / mitmproxy/pdoc

Way to explicitly shorten identifier in a docstring

Open
#782 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
2.5k
Forks
228
PR merge metrics
No merged PRs in 30d

Description

Problem Description

In a docstring for earhinov_utils.kedro.datasets.gsheets.GoogleSheetsDataset, I would like to mention earshinov_utils.kedro.datasets.pandas.PandasWrapperDataset, and:

  • I would like the latter to be turned into a hyperlink
  • I would like the text of the hyperlink to be PandasWrapperDataset instead of earshinov_utils.kedro.datasets.pandas.PandasWrapperDataset, as
    • I assume that by this moment the user is already familiar with PandasWrapperDataset
    • even if they are not, they can follow the hyperlink

There seems to be no way to achieve this currently with pdoc. A couple of things that I tried:

  • PandasWrapperDataset (in backticks, which I cannot use here) is naturally not hyperlinked
  • [PandasWrapperDataset](earshinov_utils.kedro.datasets.pandas.PandasWrapperDataset) results in a broken markup (even without backticks)
  • [PandasWrapperDataset][earshinov_py_utils.kedro.datasets.pandas.PandasWrapperDataset] is not recognized
Proposal

I assume, mkdocs, or rather mkdocstrings, or maybe the underlying Griffe, do recognize this syntax:

[PandasWrapperDataset][earshinov_py_utils.kedro.datasets.pandas.PandasWrapperDataset]

(See, for example, the description of mkdocstrings-python-xref)

With pdoc being the best API doc generator for Python, it would be nice if it had this feature as well :)

I would also appreciate if the first bracket supported arbitrary syntax, particularly backticks.

Alternatives

Keep using the full identifier (earshinov_py_utils.kedro.datasets.pandas.PandasWrapperDataset), which makes the rendered documentation harder to read and less visually appealing due to messy line breaks.

Additional context

Thank you for a wonderful tool. Discovered it just this week, and enjoyed the fact that it works out of the box

Contributor guide

Open the contributing guide

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

Start by tracing how pdoc parses docstring markup and resolves cross-references, using the proposed shortened-link syntax as the behavioral example. Confirm the rendered documentation uses the short label while linking to the fully qualified Python identifier, including support for backticks.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.