Minimal Bottle web app for clipboard and evaluation operations
Project description
Remote Agent
A minimal Python web app + API built with Bottle for clipboard operations and safe expression evaluation.
Features
- GET /ping - Health check endpoint returning
{pong: "ok"} - POST /clipboard - Accepts JSON with
contentfield, stores in memory, and executes xclip command - POST /evaluate - Safely evaluates Python literals using
ast.literal_evaland stores results - GET /answer - Renders HTML showing the latest evaluation result
- GET /result - Renders HTML showing all evaluation results
Installation
Development Installation
- Install dependencies:
pip install bottle
- Run the app directly:
python app.py
Package Installation
- Build the package:
pip install build
python -m build
This will create dist/remote-agent-0.1.0.tar.gz and wheel files.
- Install locally:
pip install dist/remote-agent-0.1.0*.whl
- Run using the console script:
remote-agent
The app will start on http://localhost:8080
Publishing to PyPI
Prerequisites
-
Create accounts:
- PyPI account: https://pypi.org/account/register/
- TestPyPI account: https://test.pypi.org/account/register/
-
Install required tools:
pip install build twine
Build and Upload Steps
- Update version in
pyproject.tomlif needed:
version = "0.1.0"
- Build the package:
python -m build
This creates:
dist/remote-agent-0.1.0.tar.gz(source distribution)dist/remote-agent-0.1.0-py3-none-any.whl(wheel)
- Test on TestPyPI first (recommended):
twine upload --repository testpypi dist/*
You'll be prompted for:
- Username: your TestPyPI username
- Password: your TestPyPI API token (create at https://test.pypi.org/manage/account/token/)
- Test installation from TestPyPI:
pip install --index-url https://test.pypi.org/simple/ remote-agent
- Upload to PyPI (production):
twine upload dist/*
You'll be prompted for:
- Username:
__token__ - Password: your PyPI API token (create at https://pypi.org/manage/account/token/)
- Verify installation:
pip install remote-agent
remote-agent
Project Structure
.
├── app.py # Main application
├── __init__.py
├── views/
│ ├── answer.tpl # Template for latest result
│ └── result.tpl # Template for all results
├── pyproject.toml # Package configuration
└── README.md # This file
API Usage Examples
Health Check
curl http://localhost:8080/ping
# Response: {"pong": "ok"}
Clipboard Operation
curl -X POST http://localhost:8080/clipboard \
-H "Content-Type: application/json" \
-d '{"content": "Hello World"}'
# Response: {"status": "ok"}
Evaluate Expression
curl -X POST http://localhost:8080/evaluate \
-H "Content-Type: application/json" \
-d '{"expr": "[1, 2, 3]"}'
# Response: {"status": "ok", "result": [1, 2, 3]}
View Results
- Open
http://localhost:8080/answerin browser (latest result) - Open
http://localhost:8080/resultin browser (all results)
Notes
- Storage is in-memory (data is lost on restart)
- Evaluation uses
ast.literal_evalfor safety (only Python literals, no code execution) - Clipboard command requires
xclipto be installed on the system - The app runs on
localhost:8080by default
Requirements
- Python 3.7+
- Bottle (only dependency)
- xclip (for clipboard functionality on Linux)
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sailor_remote_agent-0.1.0.tar.gz.
File metadata
- Download URL: sailor_remote_agent-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2272c13974032e46519027a502c3aa7eaa2f79d80ab7f87cd6158aa9d8aab4b5
|
|
| MD5 |
01fa198aa9cc3285131b99dd6b2edea5
|
|
| BLAKE2b-256 |
d72f23c47b167957f8d0db064811df11d76a862e717f07eee32d77f25dedf547
|
File details
Details for the file sailor_remote_agent-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sailor_remote_agent-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
981f5a50ac75d05c06005c2c21165f3416b3a0c2aa07816ea08b75eb90e3c26d
|
|
| MD5 |
d155d0ad212512ac82def56a2d942dbd
|
|
| BLAKE2b-256 |
e16ba49f68bbc9c07af7713daedc1c76ef51c6464325a1bcaacdc4410e912ae6
|