NetShape
Simulate real-world network conditions for any app — without touching your code.
NetShape is a local HTTP/HTTPS forward proxy that wraps any process and applies bandwidth throttling, latency, packet loss, and jitter to its network traffic.
Quick Start
pip install netshape
# Wrap any command — proxy env vars are injected automatically
netshape run --profile 3g -- python my_app.py
netshape run --profile slow-wifi -- npm start
netshape run --profile 4g -- npx electron .
Adjust conditions live without restarting the process:
netshape adjust --bandwidth 500kbps --latency 200ms --loss 2%
netshape adjust --profile 2g
Open the dashboard in your browser to visualise and control in real time:
http://127.0.0.1:8090/dashboard
How It Works
NetShape starts a local forward proxy on 127.0.0.1 and injects three environment variables into the child process:
HTTP_PROXY=http://127.0.0.1:8090
HTTPS_PROXY=http://127.0.0.1:8090
ALL_PROXY=http://127.0.0.1:8090
Any HTTP/HTTPS library that respects these variables (the overwhelming majority do) routes through the proxy automatically. No code changes required.
Your App → NetShape Proxy (throttle/delay/drop) → Internet
For HTTPS, NetShape establishes a transparent CONNECT tunnel — it does not decrypt TLS traffic.
A second port (by default +1) hosts the control API used by CLI commands and the dashboard.
Built-in Profiles
| Profile | Bandwidth | Latency | Loss | Jitter |
|---|---|---|---|---|
2g |
250 kbps | 600 ms | 2.5% | 200 ms |
3g |
780 kbps | 200 ms | 1% | 60 ms |
4g |
9 Mbps | 50 ms | 0.1% | 20 ms |
lte |
20 Mbps | 30 ms | 0.05% | 10 ms |
wifi |
25 Mbps | 10 ms | 0.01% | 5 ms |
broadband |
10 Mbps | 20 ms | 0% | 5 ms |
cable |
50 Mbps | 15 ms | 0% | 3 ms |
fiber |
1 Gbps | 2 ms | 0% | 1 ms |
satellite |
2 Mbps | 600 ms | 0.5% | 100 ms |
netshape profiles # list all profiles
netshape run --profile 3g -- <cmd>
netshape adjust --profile satellite
CLI Reference
netshape run [--profile PROFILE] [--bandwidth BW] [--latency MS]
[--loss PCT] [--jitter MS] [--port PORT] -- <command>
netshape adjust [--profile PROFILE] [--bandwidth BW] [--latency MS]
[--loss PCT] [--jitter MS]
netshape status # current proxy state
netshape metrics # traffic statistics
netshape test # run a self-test through the proxy
netshape rule add --host PATTERN [--bandwidth BW] [--latency MS]
netshape rule list
netshape rule enable <id>
netshape rule disable <id>
netshape rule remove <id>
netshape scenario run <name> # run a built-in or saved scenario
netshape scenario stop
netshape scenario status
netshape scenario list
netshape profiles # list built-in network profiles
Per-Endpoint Rules
Apply different conditions to different hosts:
netshape rule add --host "stripe\.com" --latency 300ms --loss 5%
netshape rule add --host "api\.slow-service\.io" --bandwidth 100kbps
netshape rule list
Rules match by regular expression against the request hostname.
Scenario Scripting
Chain multiple phases to simulate changing conditions over time:
netshape scenario run tunnel-drop # built-in: good → bad → recovery
netshape scenario list # see all built-in and saved scenarios
Multiple Services
Run separate NetShape instances for each process — ports are auto-assigned:
# Terminal 1
netshape run --profile 3g -- npx electron . # proxy on :8090
# Terminal 2
netshape run --profile satellite -- python backend/main.py # proxy on :8092
Each instance has its own dashboard, rules, and metrics.
Compatibility
Works with any app that reads standard proxy environment variables, including:
requests,httpx,aiohttp,urllib3- Node.js (
node-fetch,axios,got,undici) - Electron (renderer process via
session.setProxy()) - LiteLLM, OpenAI SDK, Anthropic SDK
curl,wget
Python note: NetShape sets
ALL_PROXY=http://.... Libraries such as LiteLLM that usehttpxdo not require thesocksiopackage.
Security
NetShape is a local developer tool. The proxy and control API bind to 127.0.0.1 only and are never exposed to the network. See SECURITY.md for the full security model.
Contributing
See CONTRIBUTING.md.
License
MIT — see LICENSE.
Metadata
Release files for netshape 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| netshape-1.0.2.tar.gz | 67.2 kB | With provenance | Details for netshape-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| netshape-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for netshape-1.0.2-py3-none-any.whl |
Total release size: 125.9 kB
Release files / netshape-1.0.2.tar.gz
| Download URL | netshape-1.0.2.tar.gz |
|---|---|
| Size | 67.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67e5de5bd9156593e6b2a0b71dee17c6de15fdde471c6287ab87aaf79eb2a713
|
|
BLAKE2b-256 checksum How to use checksums |
4eefd83ef13c92cc5053a5fb216a08452e6c2670ce063fa3cad7586dd7721c0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 7, 2026.
Transparency logRelease files / netshape-1.0.2-py3-none-any.whl
| Download URL | netshape-1.0.2-py3-none-any.whl |
|---|---|
| Size | 58.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
960a3a8800d929f00def25d45358a7b31f8b62047f6d302115fcad8c82db692f
|
|
BLAKE2b-256 checksum How to use checksums |
bd1b06fdf0ce7e22af98e403ec07c83a5497f287acfcf354409892a713d01117
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 7, 2026.
Transparency logSecurity for netshape 1.0.2
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for netshape-1.0.2.tar.gz
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 Jun 7, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.