Stubgen user documentation of modules
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
I have a boost compiled module pyClass if i import the class and check the documentation of the class using the help function:
>>> import pyClass
>>> help(pyClass)
Help on module pyClass:
NAME
pyClass
CLASSES
Boost.Python.instance(builtins.object)
MyClass
class MyClass(Boost.Python.instance)
| Method resolution order:
| MyClass
| Boost.Python.instance
| builtins.object
|
| Static methods defined here:
|
| __init__(...)
| __init__( (object)arg1, (str)arg2) -> None :
|
| C++ signature :
| void __init__(struct _object * __ptr64,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)
|
| __reduce__ = <unnamed Boost.Python function>(...)
|
| __repr__(...)
| __repr__( (MyClass)arg1) -> str :
|
| C++ signature :
| class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __repr__(class MyClass)
|
| foo(...)
| foo( (MyClass)arg1, (int)a [, (str)b [, (int)c [, (float)d]]]) -> int :
| f's docstring
|
| C++ signature :
| int foo(class MyClass {lvalue},int [,char [,unsigned int [,double]]])
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| name
|
| number
|
| valueReadOnly
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __instance_size__ = 80
|
| ----------------------------------------------------------------------
| Static methods inherited from Boost.Python.instance:
|
| __new__(*args, **kwargs) from Boost.Python.class
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Boost.Python.instance:
|
| __dict__
|
| __weakref__
FILE
d:\documents\development\cpp\pythonclib\install\lib\python\cpppythonlib\pyclass.pyd
All the type information is in the module like function parameters and doc strings.
If i run stubgen -p pyClass the resulting file pyClass.pyi doesn't contain any of this information
from typing import Any, ClassVar
import Boost.Python
class MyClass(Boost.Python.instance):
__instance_size__: ClassVar[int] = ...
name: Any
number: Any
@classmethod
def __init__(cls, *args, **kwargs) -> None: ...
@classmethod
def foo(cls, *args, **kwargs) -> Any: ...
@classmethod
def __reduce__(cls) -> Any: ...
@property
def valueReadOnly(self) -> Any: ...
Is this information not parsed by stubgen?
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, das Boost.Python-Modulbeispiel zu reproduzieren und stubgen -p pyClass auszuführen. Vergleiche anschließend die generierte pyClass.pyi mit der Ausgabe von help(pyClass). Verfolge, wie stubgen mit kompilierten Modulen umgeht, und ermittle, ob Signaturen, Docstrings und Typinformationen erhalten werden können; als abgeschlossen gilt die Aufgabe, wenn der generierte Stub die verfügbare Moduldokumentation widerspiegelt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 38/100