Skip to main content

Parse 2 Docs

PyPI Code style: black Tests Linters

parse2docs is a Python library that allows you to automatically generate usage documentation in Markdown format from Python scripts using the argparse module.

Features

  • Scans the Python script for instances of argparse.ArgumentParser.
  • Generates a Markdown file with usage documentation based on the ArgumentParser object.
  • The generated documentation includes a table of contents, descriptions of each command line argument, and examples if provided.
  • Works with ArgumentParser instances declared at the module level or returned by functions.

Installation

parse2docs can be installed via pip:

pip install parse2docs

Usage

There are two ways to use parse2docs, either as a Python module in your script or directly from the command line using the provided command.

As a Python module

import parse2docs

# Path to the Python script
script_path = 'path_to_your_python_script.py'

# Generate markdown documentation
markdown = parse2docs.generate_md_from_py_script(script_path)

# Save the markdown to a .md file
with open('output.md', 'w') as f:
    f.write(markdown)

This will generate a output.md file with the usage documentation in Markdown format.

From the command line

Description

The following usage section was generated using parse2docs 😉:

## Overall Usage Example

`example.py <file_path>`

## Table of Contents

* [file_path](#file_path)

## Options

### file_path

Path to the Python script file containing the ArgumentParser.

**Type**: `Path`

**Required**: Yes

This will print the usage documentation in Markdown format to the console.

Testing

We use pytest for testing. Run the tests with the following command:

python -m pytest tests/

Contributing

Contributions to parse2docs are welcome and awesome! Please submit a pull request or open an issue to discuss potential changes or improvements.

Metadata

Release files for parse2docs 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for parse2docs 0.1.3
File Size Uploaded Provenance Actions
parse2docs-0.1.3.tar.gz 4.6 kB Without provenance Details for parse2docs-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for parse2docs 0.1.3
File Interpreter ABI Platform Actions
parse2docs-0.1.3-py3-none-any.whl Python 3 none any Details for parse2docs-0.1.3-py3-none-any.whl

Total release size: 11.0 kB

Release files / parse2docs-0.1.3.tar.gz

Download URL parse2docs-0.1.3.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
63f2890a6dac37cc3096132948f00f1401d8cc184e27dfaf1789e1c9e1ea6564
BLAKE2b-256 checksum
How to use checksums
b4f7dae54f8b453b9566d4d4616ed8e736d8532b43ccf524508421faf3fc2db9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure

Release files / parse2docs-0.1.3-py3-none-any.whl

Download URL parse2docs-0.1.3-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82c6e1958c1e7f71faeddb4b5e4d00443f9c2111f1d3eebdf681666d26bf413e
BLAKE2b-256 checksum
How to use checksums
d22ee7034f8bc3e82f29b915f915d514c2ca39737d1cef5927f6b2f67d40fd4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure

Security for parse2docs 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page