Skip to main content

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 content field, stores in memory, and executes xclip command
  • POST /evaluate - Safely evaluates Python literals using ast.literal_eval and stores results
  • GET /answer - Renders HTML showing the latest evaluation result
  • GET /result - Renders HTML showing all evaluation results

Installation

Development Installation

  1. Install dependencies:
pip install bottle
  1. Run the app directly:
python app.py

Package Installation

  1. Build the package:
pip install build
python -m build

This will create dist/remote-agent-0.1.0.tar.gz and wheel files.

  1. Install locally:
pip install dist/remote-agent-0.1.0*.whl
  1. Run using the console script:
remote-agent

The app will start on http://localhost:8080

Publishing to PyPI

Prerequisites

  1. Create accounts:

  2. Install required tools:

pip install build twine

Build and Upload Steps

  1. Update version in pyproject.toml if needed:
version = "0.1.0"
  1. 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)
  1. Test on TestPyPI first (recommended):
twine upload --repository testpypi dist/*

You'll be prompted for:

  1. Test installation from TestPyPI:
pip install --index-url https://test.pypi.org/simple/ remote-agent
  1. Upload to PyPI (production):
twine upload dist/*

You'll be prompted for:

  1. 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/answer in browser (latest result)
  • Open http://localhost:8080/result in browser (all results)

Notes

  • Storage is in-memory (data is lost on restart)
  • Evaluation uses ast.literal_eval for safety (only Python literals, no code execution)
  • Clipboard command requires xclip to be installed on the system
  • The app runs on localhost:8080 by default

Requirements

  • Python 3.7+
  • Bottle (only dependency)
  • xclip (for clipboard functionality on Linux)

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

sailor_remote_agent-0.1.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sailor_remote_agent-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

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

Hashes for sailor_remote_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2272c13974032e46519027a502c3aa7eaa2f79d80ab7f87cd6158aa9d8aab4b5
MD5 01fa198aa9cc3285131b99dd6b2edea5
BLAKE2b-256 d72f23c47b167957f8d0db064811df11d76a862e717f07eee32d77f25dedf547

See more details on using hashes here.

File details

Details for the file sailor_remote_agent-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sailor_remote_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 981f5a50ac75d05c06005c2c21165f3416b3a0c2aa07816ea08b75eb90e3c26d
MD5 d155d0ad212512ac82def56a2d942dbd
BLAKE2b-256 e16ba49f68bbc9c07af7713daedc1c76ef51c6464325a1bcaacdc4410e912ae6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page