pdoc3 / pdoc3/pdoc

pdoc3 programmatic-usage example

Open
#377 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.2k
Forks
146
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the pdoc3 programmatic-usage documentation and compare it with the original pdoc library example linked in the issue. Document a working pdoc3 equivalent for create_pdoc.py that handles the listed scripts and produces HTML output, then verify it against the reported pdoc 0.10.0 behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.