Skip to main content

A pre-commit hook to generate Python documentation

Project description

Python Documentation Hook

A pre-commit hook that automatically generates documentation for Python files by extracting docstrings and function definitions.

Features

  • Automatically extracts Python docstrings
  • Generates markdown documentation
  • Updates README.md automatically in the same directory as Python files
  • Handles nested function documentation
  • Supports multiple Python files
  • Preserves existing README content

Installation

# Using pip
pip install python_docs_hook

# From source
git clone https://github.com/geek-kb/python_docs_hook.git
cd python_docs_hook
pip install -e .

Usage

Add this to your .pre-commit-config.yaml:

repos:
-   repo: https://github.com/geek-kb/python_docs_hook
    rev: v0.1.1
    hooks:
    -   id: python-docs

Install the pre-commit hook:

pre-commit install

Configuration

The hook will:

  • Look for Python files in your commits

  • Generate documentation from docstrings

  • Create/update README.md in the same directory as the Python files

  • Use markers to update documentation sections:

    <!-- BEGIN_PY_DOCS -->
    

setup.py


## Example Output

<!-- BEGIN_PY_DOCS -->
## setup.py

<!-- END_PY_DOCS -->

## Development

Clone the repository and install in development mode:

```bash
git clone https://github.com/geek-kb/python_docs_hook.git
cd python_docs_hook
python -m venv venv
source venv/bin/activate
pip install -e .

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (`git commit -m 'Add some

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

python_docs_hook-0.1.11.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

python_docs_hook-0.1.11-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file python_docs_hook-0.1.11.tar.gz.

File metadata

  • Download URL: python_docs_hook-0.1.11.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for python_docs_hook-0.1.11.tar.gz
Algorithm Hash digest
SHA256 4d2be6f5d8565519a798923557e36ad888711b7fce2b3ff214369ea19770af0f
MD5 20d2ac11788dc66a3c7a7b7cd3afd202
BLAKE2b-256 a383039cdcee2ea907a01f25a36d893579398f7e0a0e08c2721778090d9f5e0d

See more details on using hashes here.

File details

Details for the file python_docs_hook-0.1.11-py3-none-any.whl.

File metadata

File hashes

Hashes for python_docs_hook-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 72edc2e1e6d9d042c422bb5b9d02c3f64919d2d6c36dc4ec6953870a8c941ba6
MD5 d425d381c35f12b93ac901a3e401e3be
BLAKE2b-256 4a95c7dc957d34e7065594c6b465d59669b7fa4a8bc4e5e8bb82b87f992c8296

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