Skip to main content

Anthropic Auto Docstrings Generator, using updated asynchronous methods.

Project description

Test Test PyPI version Python Version 3.10 Python Version 3.11

Downloads Downloads Downloads

Source Code: https://github.com/JordanM575/anthropicautodocstrings

Anthropicautodocstrings is a command-line tool with the following key features:
  • Updates the docstrings in Python files using the Anthropic API.
  • Can process a single file or a directory of files, including all subdirectories.

Anthropicautodocstrings uses the Anthropic API to generate docstrings, so these are not guaranteed to be perfect. The claude-instant-1.2 model is used to generate the docstrings. This is the fastest. The version this was forked from is slow in comparison. To increase raw speed! This runs asyncronously.

Anthropicautodocstrings will work best for code that already has good type hints. Without type hints, the Anthropic API will have to guess input and return types, which may not be accurate.


Requirements

  • Python 3.10+
  • A valid Anthropic API KEY. Set in the environment variables.

Installation

To install the dependencies for this tool, run the following command:

$ pip install anthropicautodocstrings

Usage

To use this tool, run the following commands:

$ export ANTHROPIC_API_KEY=1234567890
$ aads INPUT `       
    [--replace-existing-docstrings] `
    [--skip-constructor-docstrings] `
    [--exclude-directories EXCLUDE_DIRECTORIES] `
    [--exclude-files EXCLUDE_FILES]

Where INPUT is a Python file or directory containing Python files to update the docstrings in, API_KEY is your Anthropic API key, and the optional flags --replace-existing-docstrings and --skip-constructor-docstrings can be used to skip updating docstrings for constructors (init methods) and replacing existing docstirngs. EXCLUDE_DIRECTORIES and EXCLUDE_FILES are comma-separated lists of directories and files to exclude from the update.


Examples

Update the docstrings in all Python files in the my_code directory:

$ aads cool_code/

Update the docstrings in the my_file.py file:

$ aads awesome_script.py

Update the docstrings in all Python files in the my_code directory and replace existing ones:

$ aads cool_code/ --replace-existing-docstrings

Update the docstrings in all Python files in the my_code directory, but skip updating docstrings for class constructors (init methods):

$ aads cool_code/ --skip-constructor-docstrings

Update the docstrings in all Python files in the my_code directory, but exlcude the exclude_dir directory and the exclude_file_1.py and exclude_file_2.py files:

$ aads my_code/ --exclude-directories exclude_dir --exclude-files exclude_file_1.py,exclude_file_2.py

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

anthropicautodocstrings-0.0.5.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

anthropicautodocstrings-0.0.5-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file anthropicautodocstrings-0.0.5.tar.gz.

File metadata

  • Download URL: anthropicautodocstrings-0.0.5.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.0 Linux/5.15.0-1041-azure

File hashes

Hashes for anthropicautodocstrings-0.0.5.tar.gz
Algorithm Hash digest
SHA256 550fa51ad632cb5d4e4983cbfcaf8b0e539db0add86b201dbcfceb6de290a516
MD5 b50bad802b27a6920a58b03bd2875d2d
BLAKE2b-256 52d9b186366d751ac9d2e2f524a3c7277aa7065874b44d9b76fbe4acd79c5170

See more details on using hashes here.

File details

Details for the file anthropicautodocstrings-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for anthropicautodocstrings-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bd7abeb19fc98366c3a76d13b49933ccdbfe003ed1a2be52df0226751423a799
MD5 14a6eed6bebfa9fc72fa523fa96b65cd
BLAKE2b-256 579323bb64ef26b0e4fbec7ecdf23f939ce0279ac14abc3460df72147c53679c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page