JC SPEEDTEST
Internet speed and network performance checks for Telecom infrastructure, Networking, DevOps and SRE.
Features
- Native download and upload throughput measurements
- Latency (RTT) measurement with TCP/TLS warm-up handling
- JSON output for automation and scripting
- CLI input validation and operational exit codes
- Zero external dependencies beyond
httpx(by default) - Optional
speedtest-clibackend for industry-standard server selection - Immutable, typed result objects (PEP 561 compliant)
Use Cases
jc-speedtest provides a lightweight, programmatic way to measure internet speed and network quality. It is designed to bypass the overhead, ads, and heavy JavaScript of browser-based speed tests, delivering clean data directly to your terminal or Python code.
SRE and DevOps
The package can be used to verify bandwidth and latency in CI/CD pipelines, containerized environments, or remote servers where a browser is not available.
Typical use cases include:
- Measuring throughput without downloading a GUI or browser extensions
- Automating network quality checks before deploying heavy artifacts
- Logging bandwidth metrics in JSON for dashboards (Grafana, Datadog)
- Verifying if a network link is degraded or saturated
Example:
jc-speedtest --json
Networking and Telecommunications Infrastructure
The project focuses on IP layer performance. The native backend uses Cloudflare's global anycast network to measure throughput, ensuring that the request is handled by the Point of Presence (PoP) closest to the probe.
The tool validates the following network layers:
Application
└── HTTP/HTTPS ──> Throughput measurement (Cloudflare API)
Transport
└── TCP ─────────> Latency and TLS handshake overhead
It does not currently provide ICMP ping, packet loss analysis, or jitter measurements, but it offers a reliable application-layer view of network health.
Automation
Structured output makes the package suitable as a building block for operational tools:
jc-speedtest --json --no-upload
The combination of structured results and exit codes allows integration into scripts, CI/CD workflows, and monitoring processes.
Installation
Requires Python 3.10+.
pip install jc-speedtest
For maximum accuracy on gigabit+ connections (optional):
pip install jc-speedtest[speedtest]
Usage
jc-speedtest [--json] [--no-download] [--no-upload] [--timeout SECONDS] [--backend {auto,native,speedtest-cli}]
Use --help to display available commands:
jc-speedtest --help
Examples
Basic run:
jc-speedtest
JSON output:
jc-speedtest --json
Skip phases:
jc-speedtest --no-upload
Force the native backend (Cloudflare):
jc-speedtest --backend native
Force the speedtest-cli backend (if installed):
jc-speedtest --backend speedtest-cli
Backends and Architecture Decisions
By default, jc-speedtest uses --backend auto. In this mode, it prioritizes the native backend for speed and zero configuration.
native(default in auto): Uses Cloudflare's public endpoints via plain HTTP. Zero external dependencies beyondhttpx. Measures latency (with TCP/TLS warm-up), download, and upload.speedtest-cli(optional): Delegates to the well-knownspeedtest-clipackage if installed. Provides more accurate results on very fast connections but relies on third-party servers and has a slower startup time.
If you want to use the industry-standard speedtest-cli servers, install the extra and force the backend:
pip install jc-speedtest[speedtest]
jc-speedtest --backend speedtest-cli
Design Decisions
- Warm-up Request: The first HTTP request always pays the TCP/TLS handshake cost. We discard this first sample in the latency calculation to report the true network RTT.
- Granular Timeouts: We use
httpx.Timeoutwithconnectandpoollimits for handshakes, butreadandwritelimits based on inactivity. This prevents false timeouts on slower connections (e.g., downloading 25MB over a 10 Mbps link). - Byte Measurement: The native backend downloads a 25MB file and uploads a 10MB payload. This is enough to saturate most residential connections, but may slightly underestimate gigabit+ links due to single-connection TCP limits.
Exit Codes
The CLI uses exit codes designed for automation, monitoring and scripting:
| Code | Meaning |
|---|---|
0 |
Measurement completed successfully |
1 |
Error during measurement (timeout, HTTP failure, etc.) |
2 |
Invalid CLI usage (argparse default) |
Python API
from jc_speedtest import run_speedtest
result = run_speedtest(download=True, upload=True, backend="auto")
print(f"Download: {result.download_mbps:.2f} Mbps")
print(f"Upload: {result.upload_mbps:.2f} Mbps")
print(f"Latency: {result.ping_ms:.2f} ms")
print(f"Backend: {result.backend}")
Development
Clone the repository:
git clone https://github.com/jacivaldocarvalho/jc-speedtest.git
cd jc-speedtest
Create a virtual environment:
python -m venv .venv
source .venv/bin/activate
Install development dependencies:
pip install -e ".[dev]"
pre-commit install
Quality checks:
ruff check .
ruff format --check .
mypy src
pytest --cov
Integration tests (hits the real network):
pytest -m integration
CI/CD
GitHub Actions validates the project with Python 3.10, 3.11, 3.12 and 3.13 using:
- Ruff
- Mypy
- Pytest
- Coverage
- Package build
Releases are published to PyPI using GitHub Actions, OpenID Connect (OIDC) and PyPI Trusted Publishing, without long-lived PyPI credentials.
License
Distributed under the MIT License. See LICENSE for more information.
Author
Jacivaldo Carvalho
Telecommunications Engineer | DevOps Engineer | SRE | Networking
Metadata
Release files for jc-speedtest 0.1.0
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 | |
|---|---|---|---|---|
| jc_speedtest-0.1.0.tar.gz | 15.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jc_speedtest-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.6 kB
Release files / jc_speedtest-0.1.0.tar.gz
| Download URL | jc_speedtest-0.1.0.tar.gz |
|---|---|
| Size | 15.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
13dfe6fc1f801da7475e7c3292279ffe312856ec4d46942f23307c465b54e116
|
|
BLAKE2b-256 checksum How to use checksums |
0979a8dd0197d9a0262cf274534e64e2a2cfc6ab920f0b6c06a555cac69b0497
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 22, 2026.
Transparency logRelease files / jc_speedtest-0.1.0-py3-none-any.whl
| Download URL | jc_speedtest-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f5f6a2596a4af6ad3a233268250c592dbcbf560aeaaf721d93ecdfa1abe6cf1
|
|
BLAKE2b-256 checksum How to use checksums |
e7f3c6ae2ca0a2f5c3cd6a646ff87cf8078500b1b5afbfbefd38d35fbcd7fb09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 22, 2026.
Transparency logSecurity for jc-speedtest 0.1.0
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for jc_speedtest-0.1.0.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 Oct 22, 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.