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.8.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.8-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: docstring2json-0.0.8.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.8.tar.gz
Algorithm Hash digest
SHA256 92f1a1844a2c521b771b356c46ddbbf9964ad7bf0c4c66843f54f2c94c237666
MD5 3f2b2ccda8d01f6d0532665743a8c89a
BLAKE2b-256 511d0b3db75444d0101cdfd20d74e09150916a4fc1d39979e027c1cdfd47581c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: docstring2json-0.0.8-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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 8d66e268ed94bf49ec2be1b4a3a5dcd6efab05d43e7dea1b06d6c53db41bb574
MD5 ab33caa9dc59cd24a54fda377cc71180
BLAKE2b-256 9c6fce871beea142b87a80ce206a7d6f05c44f0816ce5658d4fa31d9cfc5252f

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