Install & Compatibility
Where this runs
tested against v0.16.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.074s · 18.1MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 1.6s · import 0.060s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Loader
✓ from pytkdocs.loader import Loader
This quickstart demonstrates how to initialize the `Loader` and use `get_object_documentation` to extract structured documentation from a Python object. The example uses `os.path` from the standard library. For documenting your own code, ensure your package is correctly installed or discoverable in the Python path.
from pytkdocs.loader import Loader
# Example: Load documentation for a Python object
# Ensure 'your_module' is importable in your environment.
# For demonstration, we'll use a placeholder or common library if available.
# In a real scenario, you'd point to your own code.
# To make this runnable without specific external dependencies,
# we'll create a dummy module temporarily if needed, or use a built-in concept.
# However, pytkdocs usually works on actual code.
# Let's assume a simple module structure to document:
# # my_package/my_module.py
# class MyClass:
# """A sample class."""
# def __init__(self, name: str):
# """Initialize the class."""
# self.name = name
# For this quickstart, we'll try to document 'os.path'
# If you were documenting your own code, ensure it's in PYTHONPATH.
loader = Loader()
try:
# Try to document a common stdlib module
data = loader.get_object_documentation(
objects=["os.path"],
# You can add options like 'members', 'docstring_style', etc.
# Example: members={"os.path": ["abspath", "join"]}
)
print("Successfully loaded documentation for os.path:")
# In real usage, 'data' would be processed. Here, we just print parts.
if data and data[0].get('members'):
print(f"Found {len(data[0]['members'])} members.")
else:
print("No detailed members found (might need 'members' option or different object).")
except Exception as e:
print(f"Could not load documentation for os.path: {e}")
# To document your own module, ensure it's importable:
# For example, if you have 'my_package.my_module.MyClass' and 'my_package' is on PYTHONPATH:
# my_own_data = loader.get_object_documentation(
# objects=["my_package.my_module.MyClass"],
# members={"my_package.my_module.MyClass": True} # To get all members
# )
# print(my_own_data)
Errors
Common errors & fixes
TypeError: ast.Str is deprecated and will be removed in Python 3.12
`pytkdocs` versions prior to 0.16.4 used deprecated `ast` module features that are removed or changed in newer Python versions.
fixUpgrade `pytkdocs` to version 0.16.4 or newer: `pip install --upgrade pytkdocs`.
RuntimeError: Cannot import object 'my_package.my_module.MyClass' from module
The Python interpreter could not locate or import the specified object path. This commonly happens if the module is not installed, not in `PYTHONPATH`, or the path is incorrect.
fixVerify the exact object path for typos. Ensure the Python package/module is correctly installed and discoverable. If developing locally, ensure your package is in editable mode (`pip install -e .`) or its parent directory is in `PYTHONPATH`.
ERROR: Package 'pytkdocs' requires Python '>=3.9' but the running Python is 3.8.x
`pytkdocs` dropped support for Python 3.8 starting from version 0.16.3, and later versions enforce this requirement during installation.
fixUpgrade your Python environment to version 3.9 or newer. You can use tools like `pyenv` or `conda` to manage multiple Python versions.
Upgrade
Version history
0.16.5latest on PyPI · released Mar 9, 2025
Audit
Dependencies
No dependency data recorded yet.