Skip to main content

Anthropic Auto Docstrings Generator

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-haiku-4-5-20251001 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.


Maintenance Note

This repository is still actively maintained, however, the author no longer personally uses this tool due to the advent of modern AI-powered coding augmentation tools (like Cursor, GitHub Copilot, Claude Code, etc.) that provide real-time docstring generation and other enhanced coding features. The tool remains functional and will continue to receive updates for compatibility and bug fixes.


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.8.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

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

anthropicautodocstrings-0.0.8-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: anthropicautodocstrings-0.0.8.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.0 Linux/6.11.0-1018-azure

File hashes

Hashes for anthropicautodocstrings-0.0.8.tar.gz
Algorithm Hash digest
SHA256 e7343d8c69c33c1d6bf018f23929fb51bc78a9e449d05b22dc66e663c21cbcaf
MD5 15fd624202930d71a3fcf4e2bcda13d0
BLAKE2b-256 e4f4c307f24dc352e5c796e8d7297fdd9db6ee4911951953b6ccb6f2e002fb7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for anthropicautodocstrings-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 434bd6b78289c20d0761bd7742be6c8144dcfaefab51e96de09c0db045c01016
MD5 a85f45298ba7faa1408a096930d3df69
BLAKE2b-256 4927b901034fef101cd97637432c55320a1987e4af3f6996d3c2af6f112dcaa6

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