Skip to main content

LLM-based library to auto-generate docstrings for Python scripts and modules.

Project description

pydocify - LLM-Based Documentation Generator Library for Python Code

Author : Rahul Bhoyar

pydocify is a library that uses a language model (LLM) to generate and add documentation strings (docstrings) for Python scripts, functions, and classes. This is especially useful for maintaining code readability and consistency in projects with minimal documentation.

Features

  • Automatically generates docstrings based on code content.
  • Archives original Python files before documentation is added.
  • Recursively processes all Python files in a specified directory.
  • Supports deleting archive files created during the documentation process.

Installation

Install pydocify with pip:

pip install pydocify

Usage

1. Documenting All Python Files in a Directory

Use the DirectoryStringGenerator class to recursively document all Python files in a specified directory:

from pydocify.core import DirectoryStringGenerator

doc_generator = DirectoryStringGenerator()
doc_generator.generate("/path/to/your/directory")

2. Deleting Archive Files during documentation process

Use delete_archives to remove any archive files created during the documentation process:

doc_generator.delete_archives("/path/to/your/directory")

3. Adding Documentation to Python Files

To automatically generate documentation for a specific Python file:

from pydocify.core import add_doc_to_python_file
from pathlib import Path

add_doc_to_python_file(Path("your_script.py"))

Requirements

Ensure that you have your OPENAI_API_KEY set up as an environment variable in a .env file.

License

pydocify is licensed under the MIT License.

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

pydocify-0.1.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

pydocify-0.1.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file pydocify-0.1.2.tar.gz.

File metadata

  • Download URL: pydocify-0.1.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for pydocify-0.1.2.tar.gz
Algorithm Hash digest
SHA256 82c852e8f3b46b63cc19e101e5dcfb7b9e775e5a5f519e475901dc9c73b0de3d
MD5 2269eca43064b65f82428f95c526f24e
BLAKE2b-256 036f70d3e69caabb2764a3166a7064c429621f663b5f50ac0a7eb91a3cae2d17

See more details on using hashes here.

File details

Details for the file pydocify-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pydocify-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for pydocify-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5141894a98db2d5884bc3c61fe76fa00e35e63ee4072431bd07956a509847c03
MD5 6136c2b29300379e2db2647c123f3169
BLAKE2b-256 d86ca17a10c53521b85554a3c4c273ba70a63f5698f1cea8a45a86ec9ad50e62

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