https://github.com/navdeep-g/trybox
A terminal-based Python scratchpad to write, save, and safely run code snippets in isolated subprocesses. Designed for quick experiments, organized prototyping, and offline use.
https://github.com/navdeep-g/trybox
cli developer-tools prototyping python sandbox terminal
Last synced: 3 months ago
JSON representation
A terminal-based Python scratchpad to write, save, and safely run code snippets in isolated subprocesses. Designed for quick experiments, organized prototyping, and offline use.
- Host: GitHub
- URL: https://github.com/navdeep-g/trybox
- Owner: navdeep-G
- License: apache-2.0
- Created: 2025-05-03T14:37:33.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-17T01:33:19.000Z (about 1 year ago)
- Last Synced: 2025-06-25T02:40:06.635Z (about 1 year ago)
- Topics: cli, developer-tools, prototyping, python, sandbox, terminal
- Language: Python
- Homepage:
- Size: 61.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# π§ͺ trybox
**trybox** is a local-first utility for Python developers to write, save, and safely execute code snippets in isolated subprocesses. It offers a clean interface to tag and timestamp experiments, making it easy to organize, revisit, and rerun them at any time. Built entirely on the Python standard library, trybox runs fully offline, without telemetry or cloud dependencies, and is ideal for quick prototyping, testing ideas, or maintaining a persistent scratchpad.
## β¨ Features
- π Save Python snippets with descriptions and timestamps
- π§± Run snippets in isolated subprocess environments
- π Browse and rerun previous experiments easily
- π Fully offline β no telemetry or cloud sync
- π Built with the Python standard library only
## β Why trybox?
While traditional IDEs like PyCharm or quick ad hoc scripts like `test.py` are common for experimenting with Python, they both come with limitations.
**trybox** is designed for developers who want a fast, organized, and terminal-based way to write, save, and run short Python experiments β without managing files manually or switching out of the terminal.
## π Why not just use PyCharm?
Even if you already use PyCharm or another IDE, trybox still fills an important gap:
- **π§ Isolation** β You can prototype without touching your project structure
- **β‘ Speed** β No need to open a GUI or manage files β launch from the terminal instantly
- **π Clean Workspace** β Keeps scratch code out of your repo
- **π§ Snippet History** β Snippets are saved, timestamped, and searchable β unlike PyCharm scratch files
- **π₯ Headless Support** β Perfect for remote servers, SSH, or containers where GUI tools arenβt available
- **π₯ Safety** β Snippets run in isolated subprocesses, with support for timeouts and future sandboxing
**TryBox complements IDEs** β itβs not a replacement. Use your IDE for structured dev work, and use trybox when you just want to experiment.
## π Why not just use a script like `python test.py`?
Yes, you *can* just write `scratch.py` or `test.py` and run it. But TryBox exists to solve the common pain points of doing that repeatedly:
| Problem | What Developers Typically Do | How TryBox Solves It |
|----------------------------------|-----------------------------------------------|--------------------------------------------------------|
| π₯ Workspace clutter | Create lots of throwaway files: `test1.py`, `scratch.py` | Automatically tags and organizes saved snippets |
| π§ Forgetting useful code | Lose valuable experiments or overwrite them | Keeps everything archived, timestamped, and reusable |
| ποΈ Poor snippet management | Manually manage files or use vague names | Built-in history, tagging, and snippet preview |
| π§ͺ Lack of isolation | Runs all code in the same environment | Executes snippets in a subprocess for safety |
| π Reuse is tedious | Copy/paste or retype code when needed again | Rerun old snippets from the list in one command |
| β‘ Slower workflow | Create, save, run β all manually | Write, save, and run directly from the terminal/editor |
TryBox is like a personal Python scratchpad β but with memory, structure, and zero setup.
**trybox is ideal for:**
- β‘ Rapid prototyping or testing one-off ideas
- π§ͺ Running isolated code safely without polluting your workspace
- π§ Keeping a searchable archive of past experiments
- π₯ Working in minimal or remote environments without a GUI
- π§° Building a habit of local, organized experimentation
It's a personal Python scratchpad β clean, efficient, and always ready in your terminal.
## π§ͺ Example
1. Open a terminal and activate your virtual environment, if using one:
```
source venv/bin/activate
```
2. Run the main interface:
```
python -m trybox.main
```
3. Choose option `[1]` to create a new snippet
You'll be prompted to enter a description and write your code in your editor.
4. Example input:
```
Enter tag/description: greet user
```
In your editor, write the following code and save:
```python
name = input("What is your name? ")
print(f"Hello, {name}! Welcome to TryBox.")
```
5. After saving, your snippet will be stored.
If auto-run is enabled, youβll immediately see something like:
```
What is your name? Alice
Hello, Alice! Welcome to TryBox.
```
6. Or, choose option `[2]` from the main menu to run it manually later.
## βοΈ License
π This project is licensed under the Apache License, Version 2.0.