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
- Import RepoCoder in your Jupyter notebook:
from repocoder import send_for_review, print_options
- 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"
- View available options:
print_options()
- 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:
- Install the Jupyter extension for Visual Studio Code.
- Open your
.ipynb
file in VS Code. - 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:
To use it:
- Download the notebook and place it in your project directory.
- Open the notebook in Jupyter or VS Code with the Jupyter extension.
- Run
!pip install repocoder
in the first cell to install RepoCoder. - 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")
Colab Example: Notebook
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
Built Distribution
File details
Details for the file repocoder-0.1.5.tar.gz
.
File metadata
- Download URL: repocoder-0.1.5.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9b633afc8d4cfcce028caa14d680e0cd2fb082b0c909572f64d66d89a2184e3 |
|
MD5 | 14858a21c735b2bfe8c3e496289e569f |
|
BLAKE2b-256 | c022d5ac3af12c58509b3818a9b39f84bc480cf49580536445e128ea924a38df |
File details
Details for the file repocoder-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: repocoder-0.1.5-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 578800b5a05f1efc54c13959196b9bbb01b495a4d0c7a58618d6d016a13194c0 |
|
MD5 | 34c05387131441a83d60e3a2f3accf56 |
|
BLAKE2b-256 | aff1e3a6dd39c11916a6ba3fdcf73f2c9196a493c679d7a548c00fd2ce07788f |