Skip to main content

⚡ pytrackio


The fastest way to add performance tracking to any Python project. One decorator. Zero dependencies. No servers. No config. Just answers.

Tests PyPI version Python License: MIT Zero Dependencies PRs Welcome


pip install pytrackio
from pytrackio import track, timer, counter, report

@track
def process_order(order_id):
    ...

with timer("db_query"):
    results = db.execute(query)

counter("api_calls").increment()
report()
================================================================================
  pytrackio - Performance Report         uptime: 4.21s
================================================================================
  Name                         Calls      Avg      Min      Max      p95      p99  Errors
--------------------------------------------------------------------------------
  process_order                   42   120.34    98.10   310.50   290.10   308.40       -
  db_query                        18    45.20    40.10    89.30    87.20    89.10       -
--------------------------------------------------------------------------------
  Counters
--------------------------------------------------------------------------------
  api_calls: 42
================================================================================

Why pytrackio?

Sometimes you just need to know how fast your code runs, without setting up servers, installing agents, or managing infrastructure.

pytrackio runs inside your process, requires zero setup, and gives you real answers in seconds.

Feature pytrackio
Setup time 30 seconds
External server required None
Dependencies 0
Works in scripts and notebooks Yes
p95 and p99 percentiles Yes
Async support Yes
Thread-safe Yes

Installation

pip install pytrackio

Requirements: Python 3.10+ and zero external dependencies.


Usage

@track - decorate any function

from pytrackio import track

@track
def fetch_user(user_id: int):
    ...

@track
async def send_notification(user_id: int):
    await mailer.send(...)

@track(name="payment_gateway")
def charge_card(amount: float):
    ...

Tracks call count, avg, min, max, p95, p99 latency, error count, and error rate.


timer() - track any code block

from pytrackio import timer

with timer("image_resize"):
    resized = resize_image(img, width=800)

async with timer("external_api"):
    result = await fetch_data()

counter() - named event counters

from pytrackio import counter

counter("cache_hits").increment()
counter("retries").increment(3)
counter("queue_size").decrement()
counter("requests").reset()

print(counter("cache_hits").value)

report() - print everything

from pytrackio import report

report()
report(show_counters=False)
report(colour=False)

Returns the report as a string for logging or alerting.


Export data

from pytrackio import export_json, export_csv, export_dict

export_json("metrics.json")
export_csv("metrics.csv")
data = export_dict()

Raw registry access

from pytrackio import get_registry

registry = get_registry()

for s in registry.all_summaries():
    if s.error_rate > 5.0:
        print(f"{s.name} error rate: {s.error_rate:.1f}%")

registry.reset()

Real-world example

from pytrackio import track, timer, counter, report

@track
def get_product(product_id: int) -> dict:
    counter("db_reads").increment()
    return db.query(Product).get(product_id)

@track
async def checkout(cart_id: int) -> str:
    with timer("payment"):
        result = await payment_gateway.charge(cart_id)
    counter("orders_placed").increment()
    return result["order_id"]

report()

Contributing

See CONTRIBUTING.md - PRs welcome.


Changelog

See CHANGELOG.md for version history.


Author

Deepanshu - Python Developer and Open Source Author. Creator of pytrackio. Building tools that solve real problems for real developers.


License

MIT - free to use, modify, and distribute.

Metadata

Release files for pytrackio 0.10.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytrackio 0.10.1
File Size Uploaded Provenance
pytrackio-0.10.1.tar.gz 10.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pytrackio 0.10.1
File Interpreter ABI Platform
pytrackio-0.10.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.3 kB

Release files / pytrackio-0.10.1.tar.gz

Download URL pytrackio-0.10.1.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f25a19b7c5a20c72e1381dac5bef5b31e37dc9b5377b4ae61c37bd8417b813ec
BLAKE2b-256 checksum
How to use checksums
5af68b92a89ee9fa40c4a6f1690b5d1e6954232a9409597b5c0b792e8bb2b8ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / pytrackio-0.10.1-py3-none-any.whl

Download URL pytrackio-0.10.1-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25d121df07a65ebee5d6f1162a1146582ae6a029ff19bdeeaaf3c4f0cbe47422
BLAKE2b-256 checksum
How to use checksums
2d208483338db99eb8d563db6cfd1f872e3651e53be18ae7f74d2e78422465c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for pytrackio 0.10.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page