[stubgen] Nested classes in `NamedTuple`s are not produced
Open
@sobolevn is already working on this.
Since Jul 23, 2023.
bug
topic-named-tuple
topic-stubgen
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Consider this code:
from typing import NamedTuple
class A(NamedTuple):
class B: ...
In runtime you can freely access it:
>>> from typing import NamedTuple
>>>
>>> class A(NamedTuple):
... class B: ...
...
>>> A.B
<class '__main__.A.B'>
But, stubgen does ignore it:
» stubgen ex.py && bat out/ex.pyi
Processed 1 modules
Generated out/ex.pyi
───────┬───────────────────────────────────────────────────────────────────────────────────
│ File: out/ex.pyi
───────┼───────────────────────────────────────────────────────────────────────────────────
1 │ from typing import NamedTuple
2 │
3 │ class A(NamedTuple): ...
───────┴───────────────────────────────────────────────────────────────────────────────────
This needs to be fixed.
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.
Assessment
This issue has not been assessed yet.