Skip to main content

No project description provided

Project description

Generate your code documentation with doc-comments.ai

Build Publish

Focus on writing your code, let AI write the documentation for you.

With just a few keystrokes in your terminal by using the OpenAI API or 100% local LLMs without any data leaks.

Powered by langchain, lama.cpp and treesitter.

ezgif-4-53d6e634af

✨ Features

  • 📝 Create documentation comment blocks for all methods in a file
    • e.g. Javadoc, JSDoc, Docstring, Rustdoc
  • ✍️ Create inline documentation comments in method bodies
  • 🌳 Treesitter integration
  • 💻 Local LLM support

[!NOTE] Documentations will only be added to files without unstaged changes, so that nothing is overwritten.

🚀 Usage

Create documentations for any method in the file with GPT-3.5 Turbo model:

aicomments <RELATIVE_FILE_PATH>

Create also documentation comments in the method body:

aicomments <RELATIVE_FILE_PATH> --inline

Use GPT-4 model (Default is GPT-3.5):

aicomments <RELATIVE_FILE_PATH> --gpt4

Guided mode, confirm documentation generation for each method:

aicomments <RELATIVE_FILE_PATH> --guided

Use a local LLM on your machine:

aicomments <RELATIVE_FILE_PATH> --local --model_path <RELATIVE_MODEL_PATH>

⚙️ Supported Languages

  • Python
  • Typescript
  • Javascript
  • Java
  • Rust
  • Kotlin
  • Go
  • C++
  • C
  • Scala

📋 Requirements

  • Python >= 3.9

🔧 Installation

1. OpenAI API usage

Create your personal OpenAI API key and add it as $OPENAI_API_KEY to your environment with:

export OPENAI_API_KEY=<YOUR_API_KEY>

Install with pipx:

pipx install doc-comments-ai

It is recommended to use pipx for installation, nonetheless it is also possible to use pip.

2. Local LLM usage

By using a local LLM no API key is required. The recommended way for the installation is pip since CMake arguments needs to be passed to the llama.cpp build for better performance which is not possible with pipx. You can also use the OpenAI API with this installation.

[!WARNING]
If your are sensitive to your global pip packages you may consider to checkout the repo and install and run it manually with poetry or conda.

See the following instructions for your machine with CMake: installation-with-hardware-acceleration and install llama-cpp-python with your desired hardware acceleration, e.g. for Metal on Mac run:

CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python

To install doc-comments.ai which should use your previously installed llama.cpp build run:

pip install doc-comments-ai

[!IMPORTANT]
The results by using a local LLM will highly be affected by your selected model. To get similar results compared to GPT-3.5/4 you need to select very large models which require a powerful hardware.

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

doc_comments_ai-0.1.9.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

doc_comments_ai-0.1.9-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file doc_comments_ai-0.1.9.tar.gz.

File metadata

  • Download URL: doc_comments_ai-0.1.9.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.9.18 Linux/5.15.0-1041-azure

File hashes

Hashes for doc_comments_ai-0.1.9.tar.gz
Algorithm Hash digest
SHA256 933129decf4d03c8b9483e89189589e7654ba829e282d2eff2548e6417c89438
MD5 91c9bf282a9417492075b153f0f16b77
BLAKE2b-256 2b669fc55a0cc449f922615af3d888390db1233b281ff5c257ba7da20fbfbf8c

See more details on using hashes here.

File details

Details for the file doc_comments_ai-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: doc_comments_ai-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.9.18 Linux/5.15.0-1041-azure

File hashes

Hashes for doc_comments_ai-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 9193f6b8ba4490d5ef7e641166a4a04837fcf82c732f9c0f96afe4e60975dd94
MD5 a1a9d3f1080a60cf138790d99e70e397
BLAKE2b-256 4ab8f82b19e493e457b7eaf52bee23efee1cf416f5344edc5ebd2874ff7efe74

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