Skip to main content

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

Metadata

Release files for anthropicautodocstrings 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anthropicautodocstrings 0.0.8
File Size Uploaded
anthropicautodocstrings-0.0.8.tar.gz 17.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for anthropicautodocstrings 0.0.8
File Interpreter ABI Platform
anthropicautodocstrings-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 36.9 kB

Release files / anthropicautodocstrings-0.0.8.tar.gz

Download URL anthropicautodocstrings-0.0.8.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e7343d8c69c33c1d6bf018f23929fb51bc78a9e449d05b22dc66e663c21cbcaf
BLAKE2b-256 checksum
How to use checksums
e4f4c307f24dc352e5c796e8d7297fdd9db6ee4911951953b6ccb6f2e002fb7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.11.0 Linux/6.11.0-1018-azure

Release files / anthropicautodocstrings-0.0.8-py3-none-any.whl

Download URL anthropicautodocstrings-0.0.8-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
434bd6b78289c20d0761bd7742be6c8144dcfaefab51e96de09c0db045c01016
BLAKE2b-256 checksum
How to use checksums
4927b901034fef101cd97637432c55320a1987e4af3f6996d3c2af6f112dcaa6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.11.0 Linux/6.11.0-1018-azure

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page