Skip to main content

eggress Python bindings

Python bindings for the eggress proxy framework, powered by PyO3 and the Rust embed API.

Installation (local development)

pip install maturin
cd crates/eggress-python
rm -f ../../target/wheels/eggress-*.whl   # stale wheels break the install glob below
maturin build --target x86_64-apple-darwin   # adjust target for your platform
pip install --force-reinstall target/wheels/eggress-*.whl

Prebuilt wheels

Prebuilt wheels are published to PyPI for:

  • Linux x86_64 and aarch64 (manylinux)
  • macOS x86_64 and arm64
  • Windows x86_64

The wheel uses the Python stable ABI (abi3-py39), so one wheel per platform supports all declared Python versions (3.9–3.13). Other platforms can install from the source distribution (requires Rust toolchain).

Supported Python versions: 3.9, 3.10, 3.11, 3.12, 3.13.

Quick start

from eggress import EggressService

with EggressService.from_toml("""
    version = 1
    [[listeners]]
    name = "socks"
    bind = "127.0.0.1:0"
    protocols = ["socks5"]
""").start() as handle:
    addr = handle.bound_addresses["socks"]
    print(f"SOCKS5 listening on {addr}")
    print(handle.metrics_text())

Async usage

import asyncio
from eggress import EggressService

async def main():
    async with await EggressService.from_toml(TOML).astart() as handle:
        print("Listening on", await handle.bound_addresses)

asyncio.run(main())

API

  • EggressConfig.from_toml(toml) / EggressConfig.from_file(path) — parse config
  • EggressService(config) / EggressService.from_toml(toml) — create service
  • service.start() — start proxy, returns EggressHandle
  • handle.bound_addresses — dict of listener name -> address
  • handle.status() — generation, readiness, uptime, connections
  • handle.metrics_text() — Prometheus metrics
  • handle.reload_toml(toml) — hot-reload config
  • handle.shutdown() — graceful shutdown (idempotent; safe to call twice)
  • Context manager support: with service.start() as handle: ...

Always use explicit lifecycle management. Prefer context managers or explicit handle.shutdown() in a finally block. Do not rely on Python garbage collection to shut down the service — object destruction is a best-effort fallback, not the lifecycle API.

pproxy Compatibility

Eggress provides a pproxy compatibility surface validated against pproxy==2.7.9 and bounded by the canonical capability manifest. Legacy cipher implementations and unsupported native transports fail explicitly rather than being silently substituted:

  • URI Translation: translate_pproxy_args() converts pproxy CLI arguments to eggress TOML
  • Same Protocols: HTTP, SOCKS4/4a, SOCKS5, Shadowsocks (AEAD), Trojan
  • Same Schedulers: Round-robin, least-connections, first-available
  • Enhanced Features: Hot-reload, structured errors, context managers

See docs/python/PPROXY_EMBEDDED_USAGE_PATTERNS.md for migration guidance.

pproxy drop-in API

from eggress import PPProxyService, start_pproxy, check_pproxy_args

# Check compatibility before starting
report = check_pproxy_args(["-l", "socks5://:1080", "-r", "http://proxy:8080"])
print(f"Tier: {report.tier}, OK: {report.ok}")

# Start from pproxy args
with start_pproxy(["-l", "socks5://127.0.0.1:0"]) as handle:
    print(handle.bound_addresses)

# Start from local URI
with PPProxyService.from_uri("socks5://127.0.0.1:0") as handle:
    print(handle.bound_addresses)

# Start from TOML
with PPProxyService.from_toml(toml_str) as handle:
    print(handle.bound_addresses)

The optional eggress-pproxy-compat distribution additionally provides python -m pproxy, a pproxy console script, and the top-level pproxy package backed by the same compatibility entry point. pproxy.server helper calls reuse the existing protocol/proxy adapters, while pproxy.sysproxy delegates system-proxy apply/rollback to the native backend where the platform supports it. See the namespace strategy below before installing it.

API Contract (Phase C1)

A machine-readable contract of the bounded pproxy adapter is maintained at python/compat/pproxy_api_contract.json. The exact upstream installed-package inventory is maintained separately in compat/pproxy-2.7.9/namespace-baseline.json and the active parity manifest. Use scripts/pproxy_surface_probe.py with isolated oracle and wheel interpreters to compare module names, top-level exports, tracked signatures, async classification, and class bases. Importability is not a claim that private pproxy internals are functionally reproduced.

Classification summary

Tier Count Examples
adapted_target 3 Connection, Server, Rule → PPProxyService
intentional_non_parity 1 DIRECT sentinel
internal_observed 87 Protocol classes, cipher classes, server internals

Validation

# Regenerate the contract
python3.11 python/compat/extract_api.py

# Run 56 contract validation tests
python3.11 -m pytest tests/compat/test_pproxy_api_contract.py -v

# Run 46 behavioral probes
python3.11 python/compat/behavioral_probes.py

Namespace strategy

The optional eggress-pproxy-compat distribution installs a bounded top-level pproxy package containing the documented connection/server factories and protocol/cipher submodules. The canonical eggress distribution retains eggress.pproxy and eggress.start_pproxy() for translation and managed-service workflows. Do not install the compatibility distribution alongside upstream pproxy in the same environment. See docs/python/PPROXY_NAMESPACE_STRATEGY.md for the compatibility boundary.

Migrating from pproxy

from eggress import start_pproxy

# Same arguments you'd pass to pproxy
with start_pproxy(["-l", "socks5://:1080", "-r", "http://proxy:8080"]) as handle:
    print(handle.bound_addresses)

Or inspect the translation first:

from eggress import translate_pproxy_args

result = translate_pproxy_args(["-l", "socks5://:1080", "-r", "http://proxy:8080"])
print(result.toml)         # generated eggress TOML
print(result.warnings)     # partial-behavior notes
print(result.unsupported)  # unsupported features

Error model

Exception Meaning
EggressError Base exception
ConfigError TOML parsing or validation error
StartupError Listener bind or readiness timeout
ReloadError Config reload failure
ShutdownError Runtime shutdown error
UnsupportedFeatureError Feature not supported
InternalError Unexpected internal error

Limitations

  • GIL is released for blocking Rust calls
  • Requires Python >= 3.9
  • Listener bind changes require restart (not reloadable)
  • No logging initialization unless configured in TOML

Non-parity with pproxy

  • Shadowsocks TCP uses standard SIP003 AEAD framing (wire-compatible with shadowsocks-rust/ssserver/sslocal); single-hop upstream only
  • No inbound Shadowsocks or Trojan listeners (upstream-only) — inbound Shadowsocks listener is available in the Rust binary; Python bindings expose the embed API which omits this for now
  • No legacy stream ciphers (aes-ctr, aes-cfb, rc4-md5, etc.)
  • No SSH, Unix socket, or transparent proxy (redir) transport
  • No pproxy daemon mode (--daemon)
  • No -ul/-ur standalone UDP relay (uses SOCKS5 UDP ASSOCIATE)
  • Multiple remotes default to round-robin (matches pproxy behavior)
  • Direct fallback requires explicit config

Release files for eggress 1.0.7

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

Source distribution (sdist)

Source distribution for eggress 1.0.7
File Size Uploaded
eggress-1.0.7.tar.gz 1.0 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for eggress 1.0.7
File
eggress-1.0.7-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
eggress-1.0.7-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
eggress-1.0.7-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details
eggress-1.0.7-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
eggress-1.0.7-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 27.6 MB

Release files / eggress-1.0.7.tar.gz

Download URL eggress-1.0.7.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
f90686dcce9078010d1b4d11952d819985500c4d794f7cad627061e278d45e41
BLAKE2b-256 checksum
How to use checksums
fdbb0242868f2e98db84c985d1a202d4e844d03c4e8f097ef7de90476690a6a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release files / eggress-1.0.7-cp39-abi3-win_amd64.whl

Download URL eggress-1.0.7-cp39-abi3-win_amd64.whl
Size 5.6 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
fa9f06ace8d273a2dc749162b65864343005d97bae097479c85f392420425c7a
BLAKE2b-256 checksum
How to use checksums
08bae5a1599521df04a2f694d8291d21c168697a43cc993d1833a5ecb13e495a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release files / eggress-1.0.7-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL eggress-1.0.7-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 5.5 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
c5f6e48b1bad72978172dce6a5d19d6af859e078da686401b4b0b28b411040f6
BLAKE2b-256 checksum
How to use checksums
a227328840b1ab18581d72b02dc186b08016e0d4bd853ed0e90f39a82c315573
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release files / eggress-1.0.7-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL eggress-1.0.7-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 5.2 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
656df2ecc43d6e27af8227fb71fc64211102f705aed714b73f19078cf310e823
BLAKE2b-256 checksum
How to use checksums
5eb200689946c327a51c7d65db0ac2a32b60980d5d307bee511974eb8e7a2584
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release files / eggress-1.0.7-cp39-abi3-macosx_11_0_arm64.whl

Download URL eggress-1.0.7-cp39-abi3-macosx_11_0_arm64.whl
Size 5.0 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
66972cfd0b273e8ff1d353e81fc32a355732ebfda2e14c0e7498d6be510093b0
BLAKE2b-256 checksum
How to use checksums
deaa5196e7ee923957676e67b66bb8e2d22f0ed04e2c6084cd8f8134fe3136de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release files / eggress-1.0.7-cp39-abi3-macosx_10_12_x86_64.whl

Download URL eggress-1.0.7-cp39-abi3-macosx_10_12_x86_64.whl
Size 5.3 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
6844fcfadc5aa6adee2fd535e88bd48939d49903b0b92db7f9763e8654ee95c1
BLAKE2b-256 checksum
How to use checksums
ec906701134340abf66383887efcfa68091604d586d896c0cf06209e8eb7d08a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release history Release notifications | RSS feed

1.0.9

11 release files

1.0.8

11 release files

This release

1.0.7 This release

6 release files

1.0.6

6 release files

1.0.5

6 release files

1.0.4

6 release files

1.0.1

1 release file

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