{"id":5363,"library":"pdoc3","title":"pdoc3","description":"pdoc3 is a Python library and command-line tool that automatically generates API documentation from your Python project's docstrings and type annotations. It supports various docstring formats like Markdown, numpydoc, and Google-style, and can output documentation in HTML or PDF formats. As an actively maintained fork of the original `pdoc` project, it focuses on Python 3+ compatibility and ease of use, aiming to provide sensible documentation with minimal configuration.","status":"active","version":"0.11.6","language":"en","source_language":"en","source_url":"https://github.com/pdoc3/pdoc/","tags":["documentation","api-generation","docstrings","python3","html","pdf"],"install":[{"cmd":"pip install pdoc3","lang":"bash","label":"Install pdoc3"}],"dependencies":[{"reason":"Requires Python 3.9 or newer.","package":"Python","optional":false}],"imports":[{"note":"The PyPI package is 'pdoc3', but the primary module for programmatic use is named 'pdoc'.","wrong":"import pdoc3","symbol":"pdoc","correct":"import pdoc"}],"quickstart":{"code":"import pdoc\nimport os\n\n# Create a dummy module file for documentation\ndummy_module_content = \"\"\"\n\\\"\\\"\\\"\nA simple example module.\n\\\"\\\"\\\"\n\nclass MyClass:\n    \\\"\\\"\\\"\n    A sample class.\n\n    Attributes:\n        name (str): The name of the instance.\n    \\\"\\\"\\\"\n    def __init__(self, name: str):\n        self.name = name\n\n    def greet(self) -> str:\n        \\\"\\\"\\\"\n        Greets the user.\n        \\\"\\\"\\\"\n        return f\"Hello, {self.name}!\"\n\ndef my_function(value: int) -> int:\n    \\\"\\\"\\\"\n    A sample function.\n\n    Args:\n        value (int): An integer input.\n\n    Returns:\n        int: The input value multiplied by 2.\n    \\\"\\\"\\\"\n    return value * 2\n\"\"\"\nwith open(\"my_example_module.py\", \"w\") as f:\n    f.write(dummy_module_content)\n\n# Generate documentation for the module\n# Output to a 'docs' directory\npdoc.pdoc(\"my_example_module\", output_directory=\"docs\")\n\nprint(\"Documentation generated in 'docs/' directory.\")\nprint(\"You can view it by opening docs/my_example_module.html\")\n\n# Clean up the dummy module file\nos.remove(\"my_example_module.py\")\n# To clean up the generated documentation directory:\n# import shutil\n# shutil.rmtree(\"docs\")","lang":"python","description":"This quickstart demonstrates how to generate HTML documentation for a simple Python module using pdoc3 programmatically. It creates a temporary Python file, generates docs into a 'docs/' directory, and then cleans up the temporary file. For command-line usage, simply run `pdoc your_module_or_package`."},"warnings":[{"fix":"Ensure your project runs on Python 3.9+ and use `pdoc3`. If targeting older Python versions, consider the legacy `pdoc` releases or other documentation tools.","message":"pdoc3 is a fork of the original `pdoc` and is exclusively for Python 3.9+. Older Python 2 or earlier Python 3 projects will not be compatible. The `0.5.0` release marked a major refactoring for Python 3 compatibility.","severity":"breaking","affected_versions":"<0.5.0 (pdoc compatibility)"},{"fix":"Always refer to the official `pdoc3` documentation for current features. If migrating, check for feature parity or changes.","message":"The `pdoc` and `pdoc3` projects have diverged. Features like the `__pdoc__` module-level dictionary (used to override or exclude docstrings) are supported in `pdoc3` but were removed from the original `pdoc` in its 1.0.0 release. Consult the correct project's documentation.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure the directory containing your module/package is in your `PYTHONPATH` environment variable or run `pdoc` from the parent directory of your module/package.","message":"Users frequently encounter `ValueError: File or module not found` or `ImportError` if the Python modules or packages to be documented are not correctly discoverable in the Python path (`PYTHONPATH`) or current working directory.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Adjust documentation expectations; class-level docstrings should now include `__init__` documentation. If you relied on separate `__init__` documentation, you may need to refactor docstrings.","message":"Since version `0.6.0`, `__init__` methods are no longer documented separately. Their docstrings are merged into the class docstring, and constructor parameters are displayed on the class definition line, aligning with Sphinx/Python stdlib documentation conventions.","severity":"breaking","affected_versions":">=0.6.0"},{"fix":"Upgrade to `pdoc3` version `0.11.2` or newer to ensure `--skip-errors` works reliably. Alternatively, ensure all modules are error-free.","message":"The `--skip-errors` flag might not function as expected in `pdoc3` versions prior to `0.11.2`, leading to documentation generation failures even when errors should be skipped.","severity":"gotcha","affected_versions":"<0.11.2"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}