Skip to main content

Edge/IoT adaptive reverse proxy with policy routing, caching, and offline-aware fallback.

Project description

edge-proxy-py

PyPI Python Versions License GitHub stars Downloads

edge-proxy-py is a lightweight reverse proxy designed for edge / IoT deployments.

Focus:

  • offline/unstable network conditions
  • routing policies (geo/device/priority)
  • local cache fallback
  • health checks and telemetry

Features

  • Reverse proxy gateway for edge services
  • Policy-based routing (device-id header / path rules)
  • Concurrent backend health checking with connection pooling
  • In-memory cache fallback for GET requests (TTL-based with LRU-like eviction)
  • Prometheus metrics (request count, cache hits/misses, backend health)
  • Graceful shutdown (SIGINT/SIGTERM)

Quickstart

Install

pip install edge-proxy-py

Run

edge-proxy run -c examples/config.yml

Test

curl -H "X-Device-ID: sensor-1" http://localhost:9100/api/data

Architecture

Client ──► edge-proxy ──► Route matching (path_prefix / device_id)
                              │
                         ┌────▼────┐
                         │  Cache  │──► Return cached response (GET only)
                         └────┬────┘
                              │ miss
                         ┌────▼────┐
                         │ Backend │──► forward() via httpx connection pool
                         └────┬────┘
                              ▼
                       Upstream server

Changelog

0.1.1

  • Connection pooling: Shared httpx.AsyncClient singleton for proxy and healthcheck (was creating a client per request/check).
  • Concurrent health checks: Backends checked in parallel via asyncio.gather (was sequential).
  • Graceful shutdown: Signal handlers (SIGINT/SIGTERM) cancel healthcheck loop and close clients cleanly.
  • Logging: Added structured logging throughout; --log-level CLI option.
  • Bare except fixes: All except Exception blocks re-raise asyncio.CancelledError.
  • Build system: Migrated from setuptools to hatchling. Added classifiers, keywords, optional dev/test deps, ruff/pytest config.
  • Tests: Expanded from 1 test to 15+ tests covering config, router, cache, proxy, healthcheck, and backends.
  • CI: Added GitHub Actions workflow (ruff + pytest on 3.10–3.12).

0.1.0

  • Initial release: Reverse proxy, policy-based routing, cache fallback, health checks, Prometheus metrics.

License

MIT

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

edge_proxy_py-0.1.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

edge_proxy_py-0.1.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file edge_proxy_py-0.1.1.tar.gz.

File metadata

  • Download URL: edge_proxy_py-0.1.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for edge_proxy_py-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4ade6fa626c781f5b994ee0ab6e1c2099b03b17861b6d9c9caaa561984be2346
MD5 2562f485b152b2242a81025068af150a
BLAKE2b-256 f0ebebd1036c67f562a963734d005620d1bc7a57007ad43129ea4c6745393d32

See more details on using hashes here.

File details

Details for the file edge_proxy_py-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: edge_proxy_py-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for edge_proxy_py-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f388d76b4fe9f55352ceee6fc9589a1d4fb1077a84b30e54a7bc49d1ebaf2e4e
MD5 1c8d614bde0023853d20ef61c68fbc66
BLAKE2b-256 712da58a94b6eb0d8899c4af6c446984a6bb61ed232f9a2fcc88564fd5ecc9e5

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