Metadata-Version: 2.4
Name: allstak
Version: 0.1.2
Summary: Official Python SDK for AllStak — error tracking, structured logs, HTTP + DB monitoring, distributed tracing, and cron monitoring with first-class FastAPI, Django and Flask support
Project-URL: Homepage, https://allstak.sa
Project-URL: Documentation, https://allstak.sa/docs/sdks/python
Project-URL: Repository, https://github.com/AllStak/allstak-python
Project-URL: Issues, https://github.com/AllStak/allstak-python/issues
Project-URL: Changelog, https://github.com/AllStak/allstak-python/blob/develop/CHANGELOG.md
Author-email: AllStak <sdk@allstak.sa>
Maintainer-email: AllStak <sdk@allstak.sa>
License: MIT
License-File: LICENSE
Keywords: apm,django,error-tracking,fastapi,flask,logging,monitoring,observability,sqlalchemy,tracing
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
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: Topic :: Software Development :: Bug Tracking
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Logging
Classifier: Topic :: System :: Monitoring
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: httpx>=0.25.0
Provides-Extra: all
Requires-Dist: django>=3.2; extra == 'all'
Requires-Dist: flask>=2.0; extra == 'all'
Requires-Dist: sqlalchemy>=1.4; extra == 'all'
Requires-Dist: starlette>=0.27; extra == 'all'
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest-mock>=3.12; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: python-dotenv>=1.0; extra == 'dev'
Requires-Dist: respx>=0.20; extra == 'dev'
Provides-Extra: django
Requires-Dist: django>=3.2; extra == 'django'
Provides-Extra: fastapi
Requires-Dist: starlette>=0.27; extra == 'fastapi'
Provides-Extra: flask
Requires-Dist: flask>=2.0; extra == 'flask'
Provides-Extra: sqlalchemy
Requires-Dist: sqlalchemy>=1.4; extra == 'sqlalchemy'
Description-Content-Type: text/markdown

# allstak

AllStak SDK for Python, Django, Flask, FastAPI, and plain services. Captures exceptions, logs, inbound and outbound HTTP requests, spans, database telemetry, and cron heartbeats.

## Install

> **Not yet on PyPI.** `pip install allstak` is reserved but does not
> resolve a published artifact yet. Until first publish lands (tracked
> in [`docs/devops/sdk-python-dotnet-first-publish.md`](https://github.com/AllStak/allstak/blob/dev/docs/devops/sdk-python-dotnet-first-publish.md)
> in the platform monorepo), install directly from source:
>
> ```bash
> pip install "git+https://github.com/AllStak/allstak-python.git@develop"
> ```
>
> Once `0.1.x` ships on PyPI, the canonical install becomes:
>
> ```bash
> pip install allstak
> ```

## Setup

```python
import os
import allstak

allstak.init(
    api_key=os.getenv("ALLSTAK_API_KEY"),
    environment=os.getenv("APP_ENV", "production"),
    release=os.getenv("ALLSTAK_RELEASE"),
)

allstak.log.info("worker started")
allstak.capture_exception(RuntimeError("checkout failed"))
```

## FastAPI

```python
from fastapi import FastAPI
from allstak.integrations.fastapi import AllStakFastAPI

app = FastAPI()
AllStakFastAPI(app, service="checkout-api")
```

## Flask

```python
from flask import Flask
from allstak.integrations.flask import AllStakFlask

app = Flask(__name__)
AllStakFlask(app)
```

## Django

Add the middleware:

```python
MIDDLEWARE = [
    "allstak.integrations.django.AllStakDjangoMiddleware",
    *MIDDLEWARE,
]
```

## Spans

```python
with allstak.start_span("checkout.authorize", tags={"provider": "payments"}):
    authorize_payment()
```

## Configuration

| Option | Description |
| --- | --- |
| `api_key` | Project API key. |
| `environment` | Deployment environment. |
| `release` | App version or commit SHA. |
| `flush_interval_ms` | Background flush interval. |
| `buffer_size` | Max buffered events. |

## Privacy

The SDK redacts common sensitive headers and fields. Avoid putting secrets in custom metadata.

## Troubleshooting

- No events: confirm `ALLSTAK_API_KEY` is set before `allstak.init(...)`.
- Missing request telemetry: register the framework integration during app startup.
- Short-lived script: call `allstak.get_client().flush()` before exit when a client is initialized.

## Contributing and Support

- Report bugs with the GitHub bug report template: https://github.com/AllStak/allstak-python/issues/new/choose
- Open pull requests using the checklist in [CONTRIBUTING.md](CONTRIBUTING.md).
- Report security vulnerabilities privately through [SECURITY.md](SECURITY.md).

## License

MIT
