Metadata-Version: 2.5
Name: wshapnin
Version: 0.1.0
Summary: Measure your functions: p50/p95/p99, errors and what runs inside what, per minute and per version, and find the release that made something slower. Never harms the host application.
Project-URL: Homepage, https://princteq.com/wshapnin
Project-URL: Documentation, https://github.com/princteq/wshapnin-sdk/blob/main/python/docs/README.md
Project-URL: Repository, https://github.com/princteq/wshapnin-sdk
Project-URL: Issues, https://github.com/princteq/wshapnin-sdk/issues
Project-URL: Changelog, https://github.com/princteq/wshapnin-sdk/releases
Author-email: Princteq <info@princteq.com>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: fastapi,latency,metrics,monitoring,observability,performance
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
Classifier: Topic :: System :: Monitoring
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# wshapnin — Python

Measure your functions. wshapnin shows how long they take, how often they fail, what runs
inside them — and tells you when a release made something slower.

```sh
pip install wshapnin          # no dependencies, Python 3.10+
```

<!-- run -->
```python
import asyncio

import wshapnin


@wshapnin.track("invoices.list", labels={"endpoint": "/invoices"})
async def list_invoices():
    async with wshapnin.timer("invoices.db"):  # recorded as inside invoices.list
        await asyncio.sleep(0)
    return []


asyncio.run(list_invoices())
```

With FastAPI, put `@wshapnin.track` below the route decorator (and below `@inject` if you
use `dependency_injector`).

- **Calls, errors (with exception class names), p50/p95/p99** per minute and per version.
- **Blocks inside blocks**: see whether the endpoint got slower because of the query or the rendering.
- **Releases**: `WSHAPNIN_VERSION`, or `track(version="2")` for one
  function — each with a before/after report.
- **A CI gate**: `python -m wshapnin.client report --workload billing-api` exits 1 when a
  release made an endpoint worse.

**It cannot break your app.** Nothing is sent per call (~1 µs in memory, one background
send every 10 s); a slow or unreachable wshapnin never makes your code wait (metrics wait in
the background, up to 5 minutes); a wrong declaration gives you your function back unchanged; your
exceptions pass through untouched. `WSHAPNIN_DISABLED=1` turns it all off. Nothing is
sent until `WSHAPNIN_API_KEY`, your project's key from [wshapnin](https://princteq.com/wshapnin), is set.

## Documentation

[Getting started](https://github.com/princteq/wshapnin-sdk/blob/main/python/docs/getting-started.md) ·
[Measuring](https://github.com/princteq/wshapnin-sdk/blob/main/python/docs/measuring.md) ·
[Blocks inside blocks](https://github.com/princteq/wshapnin-sdk/blob/main/python/docs/nesting.md) ·
[Versions and releases](https://github.com/princteq/wshapnin-sdk/blob/main/python/docs/versions-and-releases.md) ·
[Errors](https://github.com/princteq/wshapnin-sdk/blob/main/python/docs/errors.md) ·
[CI: release gate](https://github.com/princteq/wshapnin-sdk/blob/main/python/docs/ci.md) ·
[Frameworks](https://github.com/princteq/wshapnin-sdk/blob/main/python/docs/frameworks.md) ·
[Configuration](https://github.com/princteq/wshapnin-sdk/blob/main/python/docs/configuration.md) ·
[How it works](https://github.com/princteq/wshapnin-sdk/blob/main/python/docs/how-it-works.md) ·
[Safety guarantees](https://github.com/princteq/wshapnin-sdk/blob/main/python/docs/safety.md) ·
[Troubleshooting](https://github.com/princteq/wshapnin-sdk/blob/main/python/docs/troubleshooting.md) ·
[API reference](https://github.com/princteq/wshapnin-sdk/blob/main/python/docs/api.md) ·
[Developing](https://github.com/princteq/wshapnin-sdk/blob/main/python/docs/development.md)

License: Apache-2.0.
