Invisible Timing Toolkit
Opt-in timing for Python programs. Import the library, enable the hooks you want, and selected runtime calls print how long they took. Application code stays free of decorators and manual timers.
The PyPI name is lupaxa-invisible-timing-toolkit. The import path is
lupaxa.invisible_timing_toolkit. lupaxa is a namespace package — there
is no lupaxa/__init__.py.
Install
pip install lupaxa-invisible-timing-toolkit
Requires Python 3.10+. There are no required runtime dependencies.
HTTP timing needs requests:
pip install "lupaxa-invisible-timing-toolkit[http]"
From a clone of this repository (editable install):
make init
make python-install-dev
This is a library only. There is no console script and no
python -m entry point.
A walkthrough of the same API lives in demo.py at the repository
root (not shipped in the wheel):
python demo.py
Usage
Timing lines go to stdout. A hook that cannot be installed prints a notice and the process keeps running. Each run prints its own duration; the samples show the line shape.
enable() replaces the current flags. A flag you leave at its default
is turned off. modules limits function timing to those module-name
prefixes (myapp also matches myapp.utils). Omit modules to keep
the current set. The environment default is __main__.
from lupaxa.invisible_timing_toolkit import enable
enable(
func=True,
files=True,
http=True,
modules={"__main__", "myapp"},
)
Note: Function timing (
sys.setprofile) and therangereplacement apply to the whole process. Leave them off unless you are profiling.
Choose the Output
output has three settings. The default is stdout.
enable(files=True) # stdout
enable(files=True, output="stdout+logging")
enable(files=True, output="logging")
stdout prints each line. stdout+logging prints the line and also
sends it to the invisible_timing logger. logging sends the line to
that logger and does not print it. INFO is a timing line and
WARNING is a skipped hook:
import logging
logging.basicConfig(
level=logging.INFO,
format="%(levelname)s %(name)s %(message)s",
)
enable(files=True, output="logging")
with open("notes.txt", "w", encoding="utf-8") as handle:
handle.write("hello\n")
INFO invisible_timing [FILE] open('notes.txt') took 0.000128s
stdout+logging prints that same [FILE] line and writes the logger
record above.
Function Calls
from lupaxa.invisible_timing_toolkit import enable
enable(func=True, modules={"__main__"})
def slow() -> None:
return None
slow()
[FUNC] __main__.slow took 0.000012s
Loop Iterations
range is replaced with a generator. Each line is the time spent
in the loop body for that step.
from lupaxa.invisible_timing_toolkit import enable
enable(loops=True)
for _ in range(2):
pass
[LOOP] range iteration 0 took 0.000001s
[LOOP] range iteration 1 took 0.000001s
File Opens
Pass the path as a string if you want that string in the line.
Path.write_text does not go through builtins.open.
from lupaxa.invisible_timing_toolkit import enable
enable(files=True)
with open("notes.txt", "w", encoding="utf-8") as handle:
handle.write("hello\n")
[FILE] open('notes.txt') took 0.000128s
HTTP Requests
Requires requests. requests.get and the other helpers call
Session.request, which is the wrapped method.
import requests
from lupaxa.invisible_timing_toolkit import enable
enable(http=True)
requests.get("https://example.com", timeout=5)
[HTTP] GET https://example.com took 0.112321s (status=200)
When requests is not installed the hook skips itself:
requests is not available; HTTP timing skipped
SQLite Queries
import sqlite3
from lupaxa.invisible_timing_toolkit import enable
enable(sqlite=True)
connection = sqlite3.connect(":memory:")
connection.execute("CREATE TABLE demo (name TEXT)")
connection.execute("SELECT name FROM demo")
connection.close()
When sqlite3.Cursor.execute can be replaced, each statement is printed:
[SQL] 'CREATE TABLE demo (name TEXT)' took 0.000120s
[SQL] 'SELECT name FROM demo' took 0.000040s
On current CPython the cursor type is immutable, so the hook prints a notice and does not time the statements:
sqlite3.Cursor appears immutable; sqlite timing disabled for this runtime
Subprocess Calls
import subprocess
from lupaxa.invisible_timing_toolkit import enable
enable(subprocess=True)
subprocess.run(["/bin/echo", "hello"], check=False, capture_output=True, text=True)
[PROC] subprocess.run(['/bin/echo', 'hello'],) took 0.003166s (returncode=0)
The bracketed value is the positional arguments. A one-argument call is a one-item tuple, so the printed line keeps the trailing comma.
Module Imports
from lupaxa.invisible_timing_toolkit import enable
enable(imports=True)
import json
[IMPORT] import 'json' took 0.000004s
Turn Hooks Off
disable() blocks later installs. Callables that are already patched
stay patched, so a file open after disable() can still print.
from lupaxa.invisible_timing_toolkit import disable
disable()
apply() installs whatever is currently enabled. enable() calls it
for you.
What it Times
| Hook | Target | Flag |
|---|---|---|
| Functions | sys.setprofile |
func=True |
| Loops | builtins.range |
loops=True |
| Files | builtins.open |
files=True |
| HTTP | requests.Session.request |
http=True |
| SQLite | sqlite3.Cursor.execute |
sqlite=True |
| Subprocesses | subprocess.run |
subprocess=True |
| Imports | builtins.__import__ |
imports=True |
Environment Variables
Set these before the package is imported. The shared manager reads
them once, at import, and installs any hook whose variable is truthy.
1, true, and yes count. The default module list is __main__.
| Variable | Effect |
|---|---|
INVISIBLE_TIMING=1 |
Time function calls |
INVISIBLE_TIMING_LOOPS=1 |
Time range iterations |
INVISIBLE_TIMING_FILES=1 |
Time open calls |
INVISIBLE_TIMING_HTTP=1 |
Time requests calls |
INVISIBLE_TIMING_SQLITE=1 |
Time sqlite3 executes |
INVISIBLE_TIMING_SUBPROC=1 |
Time subprocess.run |
INVISIBLE_TIMING_IMPORTS=1 |
Time imports |
INVISIBLE_TIMING_MODULES |
Comma-separated module prefixes for function timing |
INVISIBLE_TIMING_OUTPUT |
stdout, stdout+logging, or logging |
export INVISIBLE_TIMING=1
export INVISIBLE_TIMING_FILES=1
export INVISIBLE_TIMING_MODULES=__main__,myapp
python myapp.py
That is the same as calling
enable(func=True, files=True, modules={"__main__", "myapp"})
after import. Opening a file then prints a [FILE] line, and
functions defined in myapp or __main__ print [FUNC] lines.
Set INVISIBLE_TIMING_OUTPUT=stdout+logging or
INVISIBLE_TIMING_OUTPUT=logging before import to change the
destination. stdout is the default. enable() resets output to
stdout unless you pass it again.
Check
make init
make python-check
Metadata
Release files for lupaxa-invisible-timing-toolkit 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lupaxa_invisible_timing_toolkit-0.1.1.tar.gz | 10.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lupaxa_invisible_timing_toolkit-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.7 kB
Release files / lupaxa_invisible_timing_toolkit-0.1.1.tar.gz
| Download URL | lupaxa_invisible_timing_toolkit-0.1.1.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e73a3f3b8c6fbc1e500a1e539f8aa7d763295736e198ded69af2bd47d8bb9687
|
|
BLAKE2b-256 checksum How to use checksums |
6cc8e532371bc191e8a9952650dc1935d18021738afaee3ebcb25584b4aa11eb
|
| 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 Oct 7, 2026.
Transparency logRelease files / lupaxa_invisible_timing_toolkit-0.1.1-py3-none-any.whl
| Download URL | lupaxa_invisible_timing_toolkit-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2c89e082169b4936e4a08e27a3c56d0ab8b7503d4a0c35644cb6361413e12449
|
|
BLAKE2b-256 checksum How to use checksums |
9d0beb440ae54ced497d829cbc891e08bad8fae1612bcfe2f8a888bfe1f3f2b6
|
| 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 Oct 7, 2026.
Transparency log