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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: repocoder-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 bc28a4b1bfeb5fca4d51efd130a06d5e526131f2c8bf3af1a23efe7d5eed4395
MD5 abdcfb04ce60f0fc68f4f67c54673e1a
BLAKE2b-256 9cdbed7145e147181fb5e7a6ce286bdb78e7d6b2ef4292031e1c02044d899869

See more details on using hashes here.

File details

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

File metadata

  • Download URL: repocoder-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 52a38239e16a5961ba7938ec3e3d13f9cfc5de68403e8d09210db352f8baed6d
MD5 fa73113ac9fb8df78ba08239b631f519
BLAKE2b-256 679e9a490313113d1e8d08c124c97b796e0a31258c0474fa4896b568ef3e5a5d

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