Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdoc3 programmatic-usage example #377

Open
abubelinha opened this issue Dec 29, 2021 · 0 comments
Open

pdoc3 programmatic-usage example #377

abubelinha opened this issue Dec 29, 2021 · 0 comments

Comments

@abubelinha
Copy link

abubelinha commented Dec 29, 2021

I am not a fluent Python programmer.
I mostly use standalone .py scripts, which sometimes call functions from other .py scripts.
But they are not structured into modules, projects or whatever.
I wonder if I still could use pdoc3 to generate .html doc files for some selected .py scripts in this context.

Do you have an example of how to use pdoc3 as a library for this purpose?
I have an script which works perfectly when using original pdoc package, but couldn't make it run with pdoc3.

Expected Behavior

Make pdoc3 produce html documentation for a bunch of .py files, the same way original pdoc package does.

Actual Behavior

My simple pdoc-based script fails. I need to adapt it.
I looked the programmatic-usage info in pdoc3 documentation but I find it over-complicated compared to the original pdoc programmatic usage example.
Can't understand all these Context(), link_inheritance(), html(), text() ... please tell me how to use them to adapt the following script to pdoc3:

Steps to Reproduce

  1. pip install pdoc3
  2. run this script:
# create_pdoc.py
import pdoc
from pathlib import Path
myscripts = ["./myscript.py", "./path2/myscript.py", "./myscript3.py"]
pdoc.pdoc(*myscripts, output_directory=Path("./_mypdoc3"))
  1. Result
c:\Python38\python create_pdoc.py
Traceback (most recent call last):
  File "create_pdoc.py", line 4, in <module>
    pdoc.pdoc(*myscripts, output_directory=Path("./_mypdoc3"))
AttributeError: module 'pdoc' has no attribute 'pdoc'
  1. Changed last line from pdoc.pdoc(...) to pdoc(...), and got this result:
Traceback (most recent call last):
  File "create_pdoc.py", line 4, in <module>
    pdoc(*myscripts, output_directory=Path("./_mypdoc3"))
TypeError: 'module' object is not callable

Additional info

  • pdoc version:
    pdoc.exe 0.10.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant