Skip to main content

AI-powered CLI tool for generating Python documentation strings effortlessly

Project description

Pythion

Pythion is a command-line interface (CLI) tool designed to assist Python developers by generating documentation strings using AI. With an easy-to-use interface built on the Click library, Pythion provides a seamless way to enhance your Python projects with well-structured docstrings and documentation management.

Features

  • Generate documentation strings for Python functions and classes.
  • Create and manage documentation in batches
  • Flexible options to include or exclude already documented functions.
  • Automatically generate intelligent commit messages based on staged changes.
  • Easily bump version numbers in your projects.

Table of Contents

Installation

You can install Pythion via pip. Open your terminal and enter:

pip install pythion

Usage

After installing Pythion, you can invoke the command-line tool as follows:

pythion [OPTIONS] COMMAND [ARGS]…

Commands

1. docs

Generates and manages docstrings for Python projects.

pythion docs <root_dir> [--custom-instruction <instruction>] [--profile <profile>]</profile></instruction></root_dir>
  • Arguments:
    • root_dir: The path to the root directory containing the Python files to analyze.
  • Options:
    • --custom-instruction: Custom instructions for generating docstrings.
    • --profile: Choose a predefined instruction set such as fastapi or cli.

Example:

pythion docs /path/to/project --custom-instruction "Use concise language."

2. module_docs

Generates documentation for Python modules.

pythion module_docs <root_dir> [--custom-instruction <instruction>]</instruction></root_dir>
  • Arguments:
    • root_dir: The root directory of the Python project.
  • Options:
    • --custom-instruction: Custom instructions for module documentation generation.

Example:

pythion module_docs /path/to/project --custom-instruction "Include examples in docstrings."

3. build-cache

Creates a documentation cache for functions and methods in a specified directory.

pythion build-cache <root_dir> [--use_all] [--dry]</root_dir>
  • Arguments:
    • root_dir: The directory path containing Python files.
  • Options:
    • --use_all: Generates docstrings for all functions, or only those without docstrings.
    • --dry: Performs a dry run without generating any documentation.

Example:

pythion build-cache /path/to/dir --use_all --dry

4. iter-docs

Iterates through the docstring cache and apply them to objects

pythion iter-docs <root_dir></root_dir>
  • Arguments:
    • root_dir: The path to the directory containing documents to be iterated.

Example:

pythion iter-docs /path/to/dir

5. make-commit

Generates a commit message based on staged changes.

pythion make-commit [--custom-instruction <instruction>] [--profile <profile>]</profile></instruction>
  • Options:
    • --custom-instruction: Custom instructions for generating the commit message.
    • --profile: (Optional) Select a predefined instruction set.

Example:

pythion make-commit --custom-instruction "Don't mention version updates"

6. bump-version

Bumps version numbers in a specified version file.

pythion bump-version --version-regex <pattern> --file-path <file></file></pattern>
  • Arguments:
    • --version-regex: Regex pattern to match the version string.
    • --file-path: Full path to the file containing the version string.

Example:

pythion bump-version --version-regex 'version="(.\*?)"' --file-path '/path/to/version_file.txt'

NOTES

  • You must have an OpenAI API key saved on your environment for the key OPENAI_API_KEY.

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

pythion-1.0.15.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

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

pythion-1.0.15-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

Details for the file pythion-1.0.15.tar.gz.

File metadata

  • Download URL: pythion-1.0.15.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for pythion-1.0.15.tar.gz
Algorithm Hash digest
SHA256 7d9e8f4e800f3c62d0283be4a684215c09f3719b1cd8554f1c5d1310fb729666
MD5 475fec54622ba6f67772bb018d5970ac
BLAKE2b-256 d23920ea77541bd0d4a26a7ccc62cd9b8bdbf3f1d54ab05b3840434f5073649c

See more details on using hashes here.

File details

Details for the file pythion-1.0.15-py3-none-any.whl.

File metadata

  • Download URL: pythion-1.0.15-py3-none-any.whl
  • Upload date:
  • Size: 31.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for pythion-1.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 b177f2cb4c93d94210ea0e8e63626bb50a460eed24a8269ae53a0f4d29a53117
MD5 2950f0d5d3bd7571d3a4e719184089f8
BLAKE2b-256 4af838d27773236892dd13790ec07faf76c4c1a12cf351db7070408255f91c2a

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