Skip to main content

replgpt

replgpt is a Python hacking tool that lets you seamlessly switch between code authoring, LLM code generation, and code execution, all within a single terminal session. Imagine using a REPL, and being able to switch between Python and natural language, and being able to execute both.

If you've ever been frustrated with copying and pasting code generated by ChatGPT and some other environment, this is the tool for you.

What It Is Not

replgpt is not an IDE. It is not an editor based coding agent, though it shares some functionality. If you are building a new feature on an existing code base, this may not be the best tool for that job. However, if you want to work with generated Python code without toggling between windows, are looking to jump start building a new idea with Python, want to learn about an existing library, it might be up your alley.

Features

  • Standard Python REPL: Execute Python commands just like the standard Python REPL. The code you write and it's results will be automatically added to your chat context.
  • LLM Code Generation: Enter natural language text. Ask questions about an error message without needing to type it in. Or, ask it to write you a function. The function will immediatel be available in your REPL session.

Getting Started

Installation

Install replgpt directly from PyPI:

pip install replgpt

Set Up API Key

Set the OPENAI_API_KEY environment variable with your OpenAI API key:

export OPENAI_API_KEY="your-openai-api-key"

After installing, start the REPL with:

replgpt

Functionality

Python

Enter any valid Python code. When executed, the command and it's output will be included in the Agent's memory.

Natural Language

Enter a query to the AI Agent. It can answer questions you have about the code you've run or errors you've seen. Help you debug code that isn't behaving in a way you'd expect. Or, ask the Agent to write a function for you which will automatically become availabe in your REPL session.

Commands

There are several commands you can issue to the REPL to control its behavior:

  • /help - Print additional information about the REPL and commands you can run.

  • /file_to_context <file_path> - Read the contents of a local file and load it into the Agent's context window. This is can be used to import documentation into the Agent's memory, or give it knowledge of existing code you'd like to work with inside of the REPL. Or, if you want to understand a project's dependencies better, run /file_to_context requirements.txt and ask your agent about the libraries the libraries used.

  • /auto_eval - Controls what the REPL will do with code generated by your AI agent. The default strategy of 'always' means that any code returned by the Agent will be executed. If you have any concerns about this behavior, you can toggle this to never. Alternatively, the 'infer' strategy will make an additional LLM to evaluate the safety of the generated code. In practice this should only allow definitions (functions and classes) but will not execute code that could have side effects.

Metadata

Release files for replgpt 0.1.1

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

Source distribution (sdist)

Source distribution for replgpt 0.1.1
File Size Uploaded
replgpt-0.1.1.tar.gz 11.3 kB Details

Built distribution (wheel)

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

Total release size: 23.0 kB

Release files / replgpt-0.1.1.tar.gz

Download URL replgpt-0.1.1.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5b09aaea4eed0624ce13c1fb0b4e1c64fe6f68af51f580edd09671d9031dc747
BLAKE2b-256 checksum
How to use checksums
b1297626ee58ca0176dba593bb72c211475b0cbac5fc054a60c28dd51bcebec4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.10

Release files / replgpt-0.1.1-py3-none-any.whl

Download URL replgpt-0.1.1-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19dae55e5227be55ec83a344b6c16aff43cc7021ec12b3b1881c7b6bd6e481fa
BLAKE2b-256 checksum
How to use checksums
7b2e9929e297cabfc651fdd39105fc06e5bcb421e8bf511c8c6a440073d33c97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

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