Generate Markdown documentation from Python docstrings
Project description
pymarkdoc
Generate Markdown documentation from Python code.
A simple command line tool to produce a markdown document when given a python file, a directory, a local package, a global package, whatever.
This isn't a fully customisble documentation system. If you're looking for features and customisability checkout MkDocs. If you want something minimalist that can generate nice user facing HTML docs, try pdoc.
Installation
pymarkdoc is a command line utility. Installation is straightforward.
Using uv
If you use uv:
uv tool install pymarkdoc
Using pipx
Install with:
pipx install pymarkdoc
Basic Usage
# Output markdown to stdout
pymarkdoc <package>
# Output to a file
pymarkdoc -o <filename> <package>
# Include a table of contents
pymarkdoc --toc <package>
# Include package metadata in docs, i.e. version number
pymarkdoc --metadata <package>
# For example
pymarkdoc urllib3 > docs.md
pymarkdoc --metadata --toc --output /tmp/docs.md urllib3
Other Usage Examples
# Document an arbitrary python file
pymarkdoc /path/to/some/file.py
# Document an arbitrary directory path
pymarkdoc ~/source/myproject/
Command options
--output,-o: Write documentation to a file instead of stdout.--toc/--no-toc: Toggle the table of contents.--metadata: Include package version and other metadata when available.--version,-v: Show program's version number and exit.
Writing Documentation Comments
Add doc comments as normal, or preferably in plain markdown as you would for pdoc.
You can include other markdown files in the final output using the include syntax:
"""
.. include:: ../README.md
"""
You can skip some lines of an included file with:
"""
.. include:: ../README.md
:start-line: 5
"""
Cross-Environment Support
pymarkdoc can document packages from your current Python environment:
# These work even when pymarkdoc is isolated
pymarkdoc requests # Documents requests from your current environment
pymarkdoc django # Documents django from your current environment
pymarkdoc automatically detects and loads packages from:
- Active virtual environments (via
VIRTUAL_ENV) - System Python site-packages
- User site-packages
Handling Missing Dependencies
If the package you're documenting has missing dependencies, pymarkdoc will still generate documentation for the available API. Missing dependencies are automatically mocked, allowing documentation generation to continue:
# Works even if some dependencies aren't installed
pymarkdoc mypackage
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pymarkdoc-0.1.0.tar.gz.
File metadata
- Download URL: pymarkdoc-0.1.0.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5284ab447305fcfa48718cc4edc0327fa56b42c475f4ab1949bd880514b18d9e
|
|
| MD5 |
c390c0826fb1eacba98ebcbe293cd7a2
|
|
| BLAKE2b-256 |
ee471714f4b637a4ba9fb4f34e181ddb5850768c5fee6b788e1460e176759f22
|
File details
Details for the file pymarkdoc-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pymarkdoc-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f998428fde59742e574ca044f82d58c08825469502d27d4b87fc15e17f0b2a9
|
|
| MD5 |
7ae04476caeafec05845116bb4e59911
|
|
| BLAKE2b-256 |
1fc9e4ff0b2c279e14ccd421ae4d70cf6e9fc1f7f721796de16949944bd32db2
|