Closed Malachov closed 3 years ago
hey @Malachov! Glad you like it :smiley: To my knowledge there is no decorator-like syntax for modules. But, as with classes, you can set the __doc__
attribute of the module. I. e. something
module_1.py
"""
module_1
----------
This fancy module has such a features
"""
from docrep import DocstringProcessor
docstrings = DocstringProcessor()
docstrings.get_sections(__doc__, "module_1")
init.py
from module_1 import docstrings
__doc__ = docstrings.dedent("""
This library modules:
%(module_1....)s
""")
Hello, thank you very much for help, but it seems to be limitation of python runtime maybe. Docstrings must be string literal and on the very first line, otherwise IDE will not parse it (same like f-strings). doc is changed and for sphinx is OK i guess, but i tried to use it in IDE for helps. Nothing seems to work But that's not issue of this library, but python...
from module1 import docstrings
__doc__ = docstrings.dedent("""
This library modules:
""")
hey @Malachov! Yes, that's generally a problem with the concept of docrep
, see #18 for instance. IDEs like vs code do not really import the package. So they cannot interprete the commands that docrep
is doing to modify the docstring.
Feel free to close this issue.
Hello, top library... only one i found that solve something a need.
I have one use case i don't know how to solve:
I have python library - I want to document library with referencing modules.
I found how to use docrep in classes and functions, is there a way how to use it in module docstrings (I dont know how to use decorator on module...)
Example
module_1.py
init.py
Solution can be opposite - document all modules in init and then reference from modules
Why?
In my case there is most copy pasters. Good to be able type once.