Skip to main content

stacktrace-sdk-python

Python SDK for the Artim Stacktrace backend. This package provides basic error reporting and event capture utilities similar to the existing React SDK.

Usage

from bug_sdk_python import ArtimStacktrace

ArtimStacktrace.init(
    api_key="your-api-key",
    project_id="your-project-id",
)

ArtimStacktrace.capture_message("Something went wrong", level="warn")

try:
    1 / 0
except Exception as error:
    ArtimStacktrace.capture_exception(error)

ArtimStacktrace.set_user({"id": "123", "email": "user@example.com"})

# Or identify by callback
ArtimStacktrace.identify(lambda: {"id": "123", "email": "user@example.com"})

Features

  • init sets API key, project id, environment, release, and backend endpoint
  • capture_exception sends exception details and stacktrace
  • capture_message sends simple event messages
  • set_user and identify attach user context to events
  • default backend endpoint: https://stacktrace-backend.artim-industries.com/api/events

Using with FastAPI

add this to main.py


@app.middleware("http")
async def artim_middleware(request: Request, call_next):
    try:
        response = await call_next(request)
        return response
    except Exception as e:
        capture_exception(e)
        raise

Environment detection

One project holds several environments (development, staging, production, plus any custom ones). environment and release are detected automatically and only need to be passed to init() to override the detection.

Environment is resolved in this order:

  1. environment passed to init()
  2. ARTIM_ENV, then ENVIRONMENT, ENV, APP_ENV, STAGE, DJANGO_ENV, FLASK_ENV, RAILS_ENV
  3. Debug flags — ARTIM_DEBUG, DEBUG, FLASK_DEBUG, DJANGO_DEBUG set to a truthy value, or Django's settings.DEBUG → development
  4. otherwise production

Aliases are normalized: dev, local, debug → development; stage, stg, preview → staging; prod, live → production. Any other value is kept as a custom environment and registered on the project automatically.

Release detection

  1. release passed to init()
  2. ARTIM_RELEASE, then APP_VERSION, RELEASE, SOURCE_VERSION, HEROKU_SLUG_COMMIT, RAILWAY_GIT_COMMIT_SHA, FLY_MACHINE_VERSION, GIT_COMMIT, GITHUB_SHA
  3. Installed package version, when distribution names your package:
    ArtimStacktrace.init(api_key="...", distribution="my-service")
    
  4. version from pyproject.toml in the working directory
  5. Short git SHA of HEAD
  6. "unknown" plus a warning

To check what the SDK resolved:

ArtimStacktrace.get_environment()
ArtimStacktrace.get_release()

Metadata

Release files for stacktrace-sdk-python 0.2.0

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

Source distribution (sdist)

Source distribution for stacktrace-sdk-python 0.2.0
File Size Uploaded Provenance Actions
stacktrace_sdk_python-0.2.0.tar.gz 7.1 kB Without provenance Details for stacktrace_sdk_python-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stacktrace-sdk-python 0.2.0
File Interpreter ABI Platform Actions
stacktrace_sdk_python-0.2.0-py3-none-any.whl Python 3 none any Details for stacktrace_sdk_python-0.2.0-py3-none-any.whl

Total release size: 14.9 kB

Release files / stacktrace_sdk_python-0.2.0.tar.gz

Download URL stacktrace_sdk_python-0.2.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
03956d121a603c5bbde3299d03401094a6ea2902c1fde3a6b1dd2d851c3e541b
BLAKE2b-256 checksum
How to use checksums
02f48f314f573fb07d7e31ea9941ff4f5634e9fe817cb1dbf24f656220de1f7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Release files / stacktrace_sdk_python-0.2.0-py3-none-any.whl

Download URL stacktrace_sdk_python-0.2.0-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
843ca953f5250883be765d9ce6aa367b3e8fdde884a9e4fe1fb153e5043e8382
BLAKE2b-256 checksum
How to use checksums
f419d81906fcf916aadf6d7131f3ae1fb89bb292c9bfdf70cbed2664ccf4e0f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Security for stacktrace-sdk-python 0.2.0

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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