Skip to main content

A tool to convert Google-style docstrings to JSON format

Project description

Google Docstring to JSON Converter

A tool that converts Python package docstrings to JSON files.

License

This software is licensed under a custom license agreement. The Albumentations Team and their official contributors have free access to use this software for their projects. All other users must obtain a paid license.

For licensing inquiries, please contact: Vladimir Iglovikov (iglovikov@gmail.com)

See the LICENSE file for full details.

Features

  • Converts Google-style docstrings to JSON format
  • Maintains the original package structure in the output
  • Supports both class and function documentation
  • Handles module-level docstrings
  • Preserves code examples and formatting
  • Supports complex type definitions with interactive display

Installation

pip install docstring2json

Usage

python -m src.docstring2json.__main__ --package-name PACKAGE_NAME --output-dir OUTPUT_DIR

or:

docstring2json --package-name PACKAGE_NAME --output-dir OUTPUT_DIR

This will:

  1. Import the specified package
  2. Extract docstrings from all classes, functions, and modules
  3. Write JSON files for each module with proper routing

Output Structure

The tool creates a directory structure that matches the input package:

output_dir/
  module1/
    file1/
      data.json
    file2/
      data.json
  module2/
    submodule/
      file2/
        data.json

Each data.json file contains:

  • Module name and description
  • Parameter descriptions with type information
  • Return values and exceptions with proper formatting
  • Code examples with syntax highlighting
  • References and links to related documentation

Development

# Install dependencies
pip install -e .

# Run tests
pytest

# Run pre-commit hooks
pre-commit run --all-files

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

docstring2json-0.0.10.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

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

docstring2json-0.0.10-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file docstring2json-0.0.10.tar.gz.

File metadata

  • Download URL: docstring2json-0.0.10.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for docstring2json-0.0.10.tar.gz
Algorithm Hash digest
SHA256 cdbbb67aa47645ca0637c77caa4b616fb02ac9b9ba49e3ed852c00dac6384fce
MD5 8d98556ffe68e02950c50d50e36316e7
BLAKE2b-256 8faec4859e8e70a57c6524f94b8b67f0da2328ceb78e99cdf820cb900d4a9c40

See more details on using hashes here.

File details

Details for the file docstring2json-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for docstring2json-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 5f399b2d32599586b3c5b4d22c2b5e39ffcbfd2e00c18c0abb2923645ced35d5
MD5 b91abc6d0999f1c8a34aba2ebae9db06
BLAKE2b-256 32f8bbdbe5654787efbd8688acbe7438aefe54e1b22bf395f4e1428bc0de89a2

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