Skip to main content

Generate Fern documentation from Python packages using static analysis.

Project description

py2fern

Generate Fern API documentation from Python packages using static analysis.

Simplified fork of sphinx-autodoc2 focused purely on Python → Fern markdown output.

Installation

pipx install py2fern

Upgrading

To upgrade to the latest version:

pipx upgrade py2fern

Or if installed with pip:

pip install --upgrade py2fern

Check your current version:

py2fern --version

Usage

Generate Fern markdown documentation:

py2fern write /path/to/your/package

Specify output directory:

py2fern write /path/to/your/package --output ./docs/api

Debug Mode

Show warnings for functions missing return type annotations:

py2fern write /path/to/your/package --output ./docs/api --debug

Warnings appear in yellow and help identify functions that should have type annotations added.

Legacy Parser Mode

Use the old regex-based parser instead of the default docstring_parser:

USE_REGEX_PARSER=1 py2fern write /path/to/your/package --output ./docs/api

Output

This creates:

  • MDX files with Fern-compatible frontmatter and slugs
  • navigation.yml for Fern docs structure
  • Consistent ParamFields for all Parameters and Returns sections

Acknowledgments

This project is a fork of the excellent sphinx-autodoc2 by Chris Sewell. All credit for the core functionality goes to the original project.

Development

All configuration is mainly in pyproject.toml.

Use tox to run the tests.

pipx install tox
tox -av

Use pre-commit to run the linters and formatters.

pipx install pre-commit
pre-commit run --all-files
# pre-commit install

flit is used to build the package.

pipx install flit
flit build

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py2fern-0.1.6.tar.gz (65.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py2fern-0.1.6-py3-none-any.whl (64.2 kB view details)

Uploaded Python 3

File details

Details for the file py2fern-0.1.6.tar.gz.

File metadata

  • Download URL: py2fern-0.1.6.tar.gz
  • Upload date:
  • Size: 65.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for py2fern-0.1.6.tar.gz
Algorithm Hash digest
SHA256 8f26a89313fd0d852c06f8a1a84ce0016afb513efc97eacef92fe30f9dbae655
MD5 4d920e6464573e931cb0264ecb43625c
BLAKE2b-256 2128761a80183ce7d51f5acf6357dbf55b3d34f7f9b454dc0c97eedc8230c946

See more details on using hashes here.

File details

Details for the file py2fern-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: py2fern-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 64.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for py2fern-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 dfa3c5c854c27cfa322b47d3e0b45b49ab1ad28e1bf551c5134763ba290ea73f
MD5 0225d773ae825a0bbeb3623744d469f5
BLAKE2b-256 4b7bf81028a600ac1b7004059f101a611a05fe506258f9fb71afe1bae576d9de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page