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.9.tar.gz (14.2 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.9-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: docstring2json-0.0.9.tar.gz
  • Upload date:
  • Size: 14.2 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.9.tar.gz
Algorithm Hash digest
SHA256 39895c38d055940aea36a3c9b31c23b59e035ea582355b7bc7871add91206a0e
MD5 60e14c3df62849c8d7749bd2e73ddaa8
BLAKE2b-256 a432bebec972870c5cd2627e6333d174743c049e95c2f49ed93ff7611a4f157f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: docstring2json-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for docstring2json-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ab0367f17768fc97b0461cd54015f5985802ee565a1777b7592ddc8269cc05e6
MD5 6ccf0f5fd777380165be4a563e970606
BLAKE2b-256 5563092fa1aeae269cb16b3bcd82f8c7589d3517ef2a231c68528e2dd94a20c8

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