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 configEggressService(config)/EggressService.from_toml(toml)— create serviceservice.start()— start proxy, returnsEggressHandlehandle.bound_addresses— dict of listener name -> addresshandle.status()— generation, readiness, uptime, connectionshandle.metrics_text()— Prometheus metricshandle.reload_toml(toml)— hot-reload confighandle.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/-urstandalone UDP relay (uses SOCKS5 UDP ASSOCIATE) - Multiple remotes default to round-robin (matches pproxy behavior)
- Direct fallback requires explicit config
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 eggress-1.0.4.tar.gz.
File metadata
- Download URL: eggress-1.0.4.tar.gz
- Upload date:
- Size: 907.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af780704b34db6b8b9e55a7313d00469b1578cc541fb9966a985fb8e3ba6eb3f
|
|
| MD5 |
a7773c2e81431a29aef7381b394c9581
|
|
| BLAKE2b-256 |
6cbdcaf5f2bfc53ad11f40f5cc98cfd45beacfad59bc615e57a86bbe0fda68be
|
Provenance
The following attestation bundles were made for eggress-1.0.4.tar.gz:
Publisher:
publish-python.yml on eggstack/eggress
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eggress-1.0.4.tar.gz -
Subject digest:
af780704b34db6b8b9e55a7313d00469b1578cc541fb9966a985fb8e3ba6eb3f - Sigstore transparency entry: 2714997889
- Sigstore integration time:
-
Permalink:
eggstack/eggress@93a205c387b502db1ceba8c9fd1a50c5de9e8e37 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/eggstack
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@93a205c387b502db1ceba8c9fd1a50c5de9e8e37 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file eggress-1.0.4-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: eggress-1.0.4-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 5.6 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49919f4a4e732c875f1dfeaa12680beb1172b07acf93afe83c2fee1c1a8fc372
|
|
| MD5 |
ea69ff342a888c34159e34570cc5a93f
|
|
| BLAKE2b-256 |
96251bb7ba4132043efafe927a4ef40cbfaae382ece81066d6035952af7acbff
|
Provenance
The following attestation bundles were made for eggress-1.0.4-cp39-abi3-win_amd64.whl:
Publisher:
publish-python.yml on eggstack/eggress
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eggress-1.0.4-cp39-abi3-win_amd64.whl -
Subject digest:
49919f4a4e732c875f1dfeaa12680beb1172b07acf93afe83c2fee1c1a8fc372 - Sigstore transparency entry: 2714998411
- Sigstore integration time:
-
Permalink:
eggstack/eggress@93a205c387b502db1ceba8c9fd1a50c5de9e8e37 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/eggstack
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@93a205c387b502db1ceba8c9fd1a50c5de9e8e37 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file eggress-1.0.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: eggress-1.0.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c798bde7de03f83d277744af76532eeaad746f351d7a13f982f46fd12fa0196
|
|
| MD5 |
3b1ceaa2cad4c28bc9723f1b8e6a1e06
|
|
| BLAKE2b-256 |
29002219d1880b8967386a23f6ea26f8ffc86cfd7d6c0f9db303868cc8b152a3
|
Provenance
The following attestation bundles were made for eggress-1.0.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish-python.yml on eggstack/eggress
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eggress-1.0.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
7c798bde7de03f83d277744af76532eeaad746f351d7a13f982f46fd12fa0196 - Sigstore transparency entry: 2714998110
- Sigstore integration time:
-
Permalink:
eggstack/eggress@93a205c387b502db1ceba8c9fd1a50c5de9e8e37 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/eggstack
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@93a205c387b502db1ceba8c9fd1a50c5de9e8e37 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file eggress-1.0.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: eggress-1.0.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 5.1 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a0c513d94e77f3b65d4d8a25829613f78099810d1fb857bc4c3661616b568dc
|
|
| MD5 |
088c210239ff2891c7433722789408be
|
|
| BLAKE2b-256 |
166ba559ff2978a6c114477a837d5f23094f7693cd4cf04bc27e6a7e43b7ccb5
|
Provenance
The following attestation bundles were made for eggress-1.0.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
publish-python.yml on eggstack/eggress
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eggress-1.0.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
1a0c513d94e77f3b65d4d8a25829613f78099810d1fb857bc4c3661616b568dc - Sigstore transparency entry: 2714998015
- Sigstore integration time:
-
Permalink:
eggstack/eggress@93a205c387b502db1ceba8c9fd1a50c5de9e8e37 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/eggstack
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@93a205c387b502db1ceba8c9fd1a50c5de9e8e37 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file eggress-1.0.4-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: eggress-1.0.4-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dadb98ccd4358f26d569ba99076c668adb05cb7d1f7bcbf1a7d22657b55f5437
|
|
| MD5 |
6f2bf671640354c91d9868a8f5bda2f2
|
|
| BLAKE2b-256 |
47bc22cbc1d95737fbe3130e869b379dc2e44472b1019ccdd7b04d5639301852
|
Provenance
The following attestation bundles were made for eggress-1.0.4-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
publish-python.yml on eggstack/eggress
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eggress-1.0.4-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
dadb98ccd4358f26d569ba99076c668adb05cb7d1f7bcbf1a7d22657b55f5437 - Sigstore transparency entry: 2714998196
- Sigstore integration time:
-
Permalink:
eggstack/eggress@93a205c387b502db1ceba8c9fd1a50c5de9e8e37 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/eggstack
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@93a205c387b502db1ceba8c9fd1a50c5de9e8e37 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file eggress-1.0.4-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: eggress-1.0.4-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efc76621e25814edfe8cbad403906c10cc7a9366389a65e8b60c9ca2e962828e
|
|
| MD5 |
6ae7294a9d2498d4cf8fbe7dbe7e0680
|
|
| BLAKE2b-256 |
ceab700d95c652b1e48402dcfd174aed8efd83f2ba408e12391e5e61119e8bac
|
Provenance
The following attestation bundles were made for eggress-1.0.4-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
publish-python.yml on eggstack/eggress
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eggress-1.0.4-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
efc76621e25814edfe8cbad403906c10cc7a9366389a65e8b60c9ca2e962828e - Sigstore transparency entry: 2714998590
- Sigstore integration time:
-
Permalink:
eggstack/eggress@93a205c387b502db1ceba8c9fd1a50c5de9e8e37 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/eggstack
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@93a205c387b502db1ceba8c9fd1a50c5de9e8e37 -
Trigger Event:
workflow_dispatch
-
Statement type: