Skip to main content

A tool for analyzing and modifying code repositories using LLMs

Project description

RepoCoder

⚠️ IMPORTANT ALERT ⚠️

**This tool sends all Python file code in your current folder to a third-party Large Language Model (LLM) via API. It is intended for use with small-ish Python projects only. It can be adapted for other languages easily. Currently Anthropic supports 200k tokens of context and Gemini supports 2M. For most small projects this is plenty. You will need to modify if using for larger projects. **


RepoCoder is a powerful tool that allows you to analyze and modify your entire code repository using Large Language Models (LLMs) such as Anthropic's Claude or Google's Gemini. It's designed to run in a Jupyter notebook environment, making it easy to review, improve, and refactor your code.

Features

  • Crawl and analyze your entire code repository
  • Generate a structured representation of your project
  • Send code for review, improvement, completion, or correction to LLMs
  • Support for both Anthropic's Claude and Google's Gemini models
  • Easy-to-use interface within Jupyter notebooks

Installation

You can install RepoCoder using pip:

pip install repocoder

Dependencies

RepoCoder requires the following dependencies:

  • google-generativeai
  • python-dotenv
  • anthropic

You can install these dependencies manually or they will be automatically installed when you install RepoCoder.

Usage

  1. Import RepoCoder in your Jupyter notebook:
from repocoder import send_for_review, print_options
  1. Set up your environment variables for API keys:
import os
os.environ["ANTHROPIC_API_KEY"] = "your_anthropic_api_key"
os.environ["GEMINI_API_KEY"] = "your_gemini_api_key"
  1. View available options:
print_options()
  1. Send your code for review or other actions:
action = "code-review"
send_for_review(action, llm="anthropic")  # or llm="gemini"

Using RepoCoder with Visual Studio Code

If you prefer to use Visual Studio Code (VS Code) as your development environment, you can still use RepoCoder with Jupyter notebooks. To do this:

  1. Install the Jupyter extension for Visual Studio Code.
  2. Open your .ipynb file in VS Code.
  3. You can now run RepoCoder directly within VS Code's Jupyter notebook interface.

The Jupyter extension for VS Code provides an integrated notebook experience, allowing you to edit and run Jupyter notebooks directly in your VS Code environment.

Quick Start with Jupyter Notebook

We provide a Jupyter notebook for easy use of RepoCoder. You can download it directly from our repository:

Download RepoCoder.ipynb

To use it:

  1. Download the notebook and place it in your project directory.
  2. Open the notebook in Jupyter or VS Code with the Jupyter extension.
  3. Run !pip install repocoder in the first cell to install RepoCoder.
  4. Follow the instructions in the notebook to analyze your code repository.

Example

Here's a quick example of how to use RepoCoder:

from repocoder import send_for_review, print_options

# View available options
print_options()

# Define your action
action = "Please review the following code and provide suggestions or identify any errors."

# Send for review using Anthropic's Claude
send_for_review(action, llm="anthropic")

# Or, send for review using Google's Gemini
# send_for_review(action, llm="gemini")

Contributing

We welcome contributions to RepoCoder! Please feel free to submit issues, fork the repository and send pull requests!

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Anthropic for their Claude API
  • Google for their Generative AI API

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

repocoder-0.1.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

repocoder-0.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file repocoder-0.1.0.tar.gz.

File metadata

  • Download URL: repocoder-0.1.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for repocoder-0.1.0.tar.gz
Algorithm Hash digest
SHA256 340fd0845b6d288d92c84dca02ac3a911dfd81ef91323282b8243bebae8af57f
MD5 670b31a43e9061e142157a9d0aa019ff
BLAKE2b-256 6b48277621659928d5c1bde9b5746d1f30d07c00721a0efc3e21ccef43240fc8

See more details on using hashes here.

File details

Details for the file repocoder-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: repocoder-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for repocoder-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d187f9d2683a237f2d3bb172a40ecead9996765b01ef361a0f1b841c55292c2a
MD5 079708f5feb40315833df8f793f5d3b7
BLAKE2b-256 e929bb0e1d3b9124c2614fb03b150c8b3d45aa407c6fec3edc69344e1e002444

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