Support custom descriptors as attributes
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 228
- PR merge metrics
- No merged PRs in 30d
Description
Problem Description
Python descriptor don't seem to be typed properly.
Steps to reproduce the behavior:
class MyDescriptor:
def __get__(self, obj, objtype = None) -> bool:
return False
class Test:
@property
def hello(self) -> int:
"""hello world"""
return 10
foo = MyDescriptor()
"""foo bar"""
The @property is properly generated in the doc as hello: int. My understanding is that @property are basically Python descriptors.
My custom descriptor is generated as def foo(unknown):. I'm not sure how other tools handle this use case, I'd have to check. I would be expecting def foo(self) -> bool: or foo: bool.
System Information
pdoc: 14.7.0
Python: 3.10.4
Platform: Windows-10-10.0.22631-SP0
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
Start by reproducing the example from the issue with pdoc 14.7.0 and compare the generated output for the property with the custom descriptor. Trace how pdoc represents descriptor attributes, then make the generated documentation expose the descriptor's bool return type in a consistent form such as foo(self) -> bool or foo: bool.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100