Skip to main content

z4j Flask framework adapter (Apache 2.0) - Phase 1.1

Project description

z4j-flask

PyPI version Python License

License: Apache 2.0 Status: v1.0.0 — first public release.

Flask framework adapter for z4j. Flask-extension shape — one Z4J(app) call and the agent boots on the first request.

Install

pip install z4j-flask z4j-celery z4j-celerybeat

Pick the engine adapter(s) that match your stack:

pip install z4j-flask z4j-rq z4j-rqscheduler
pip install z4j-flask z4j-dramatiq z4j-apscheduler

Configure

Register the extension the standard Flask way:

from flask import Flask
from z4j_flask import Z4J

app = Flask(__name__)
app.config.update(
    Z4J_BRAIN_URL="https://z4j.internal",
    Z4J_TOKEN="z4j_agent_...",        # minted in the brain dashboard
    Z4J_PROJECT_ID="my-project",
)

z4j = Z4J(app)

Or use the application-factory pattern:

z4j = Z4J()

def create_app():
    app = Flask(__name__)
    app.config.from_envvar("FLASK_CONFIG")
    z4j.init_app(app)
    return app

On the first request, the agent connects to the brain and z4j's dashboard populates with every Celery / Dramatiq task your workers discover.

What it does

Piece Purpose
Z4J(app) Flask extension; hooks into the app lifecycle
Config from app.config Reads Z4J_* keys — idiomatic Flask configuration
Lazy boot Agent starts on first request, not at import time (so flask --help stays fast)
Teardown integration Flushes the event buffer on SIGTERM / graceful shutdown

Reliability

z4j-flask follows the project-wide safety rule: z4j never breaks your Flask app. Agent failures are caught at the boundary, logged, and swallowed.

Documentation

License

Apache 2.0 — see LICENSE. Your Flask application is never AGPL-tainted by importing z4j_flask.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

z4j_flask-1.0.0.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

z4j_flask-1.0.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file z4j_flask-1.0.0.tar.gz.

File metadata

  • Download URL: z4j_flask-1.0.0.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.8

File hashes

Hashes for z4j_flask-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b6c5f6e26ed99e7a653e7738165445791af0ece14bab7150e98d2727edb81ec2
MD5 fb0652fc8a6045eec833a33d5487e891
BLAKE2b-256 b73c8bb5d005514d2136039abc17f5af1e8debc8030612da0250eab30d5c1ca3

See more details on using hashes here.

File details

Details for the file z4j_flask-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: z4j_flask-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.8

File hashes

Hashes for z4j_flask-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0ee3198c7723461badb726c20695247b8560e2ec386885ad7ffdffac96c2141
MD5 d64085577b254a8fa0ed072361e7ce97
BLAKE2b-256 53791c66b1b87d8bb23d8bd8a9885dd9173c8230850544dbd8438e8efa9f390b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page