pdoc3 / pdoc3/pdoc

Shorten long object names in type hint

Open
#79 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In my source, I have object that are defined very deep into the hierarchy. In Sphinx, I can use ~ to just output the name of the class, not the entire path.

Expected Behavior

def add(self, from_component: Component, to_component)

Actual Behavior

def add(self, from_component: components.stdlib.component.Component, to_component)

Steps to Reproduce
  1. Nest an object's definition deeply
  2. Use it in a typehint
Additional info
  • pdoc version: pdoc3 0.6.3

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

Reproduce the issue with an object defined deeply in a Python module hierarchy and used in a type hint, using the pdoc3 0.6.3 behavior described here. Compare the generated signature with the expected shortened class name, and consider the work complete when long qualified names are displayed in shortened form without losing the type reference.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.