cli-speeder
Make your Python CLIs start instantly (10x-100x faster).
Python scripts are notoriously slow to start because they import heavy libraries (like pandas, torch, boto3, pydantic) at the top level, even if the user only runs a simple command like --help.
cli-speeder fixes this with zero code refactoring.
Installation
pip install cli-speeder
Usage
There are two ways to use this.
Method 1: The "One-Liner" (Recommended)
Add this once at the very top of your script (before your heavy imports).
from cli_speeder import speed_up_modules
# Magic: Forces these modules to load lazily
speed_up_modules(["pandas", "tensorflow", "boto3"])
# --- Your normal code stays exactly the same! ---
import pandas as pd \# 0ms (Instant)
import tensorflow as tf \# 0ms (Instant)
import boto3 \# 0ms (Instant)
def process_data():
\# The libraries only actually load HERE, when you use them.
df = pd.read_csv("data.csv")
Method 2: Manual Proxy (Granular Control)
If you want specific control over exactly which object is lazy.
from cli_speeder import lazy_import, lazy_from_import
# Replace 'import pandas as pd' with:
pd = lazy_import("pandas")
# Replace 'from pandas import DataFrame' with:
DataFrame = lazy_from_import("pandas", "DataFrame")
Benchmarks
Time to run python script.py --help:
| Library | Standard Import | With cli-speeder |
|---|---|---|
| Pandas | ~0.8s | < 0.01s |
| Torch | ~2.5s | < 0.01s |
| Boto3 | ~0.5s | < 0.01s |
Debugging / Production Safety
Lazy loading is great for CLIs, but sometimes (like in production workers) you might want standard behavior to catch ImportError immediately.
You can force all imports to happen immediately (disable lazy loading) by setting an environment variable:
export CLI_SPEEDER_EAGER=1
python my_script.py
License
cli_speeder is licensed under the Apache License 2.0. See the LICENSE file for more details.
Metadata
Release files for cli-speeder 0.1.3
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 | |
|---|---|---|---|---|
| cli_speeder-0.1.3.tar.gz | 8.5 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cli_speeder-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.1 kB
Release files / cli_speeder-0.1.3.tar.gz
| Download URL | cli_speeder-0.1.3.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b739aa3c0f0ec7c5fc4c040ffc9b676ffdebe89826c8519acad120a31abcbf64
|
|
BLAKE2b-256 checksum How to use checksums |
fcd07e5871dca1431285703ec89935cc371fbc7a820d442a5c6c47fcc945d3e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Nov 29, 2025.
Transparency logRelease files / cli_speeder-0.1.3-py3-none-any.whl
| Download URL | cli_speeder-0.1.3-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e0f7c5c8a0b577905f1f3088069d81e7f16fb36629ed26e511faa6824052f7e
|
|
BLAKE2b-256 checksum How to use checksums |
9bb02f0fdbe2c6c0304c7c920bfbf8cfed612bcd3f95c62f0ce38fe2f332191f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Nov 29, 2025.
Transparency logSecurity for cli-speeder 0.1.3
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 cli_speeder-0.1.3.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 Nov 29, 2025.
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.