Skip to main content

pinexq-tools

Utility tools for the DataCybernetics PinexQ platform. Distributed as pinexq-tools; modules live under the pinexq namespace.

Modules

pinexq.monitoring

Context managers that report an UptimeKuma push heartbeat when a block finishes — status=up on clean exit, status=down on exception — with ping set to the time spent inside the context.

from pinexq.monitoring import UptimeKumaPush, AsyncUptimeKumaPush

with UptimeKumaPush("https://kuma.example/api/push/abc123"):
    do_work()

async with AsyncUptimeKumaPush("https://kuma.example/api/push/abc123"):
    await do_work()

Read-only helpers that ask a Prometheus HTTP API whether a service's alert rules are active, per environment (distinguished by the tenant_cluster_name label). Instead of re-deriving health from raw metrics, they read the alerts the rules already encode.

query_prometheus_alerts_absent(...) returns True when there are no pending/firing alerts for the service on that cluster (i.e. healthy):

from pinexq.monitoring import query_prometheus_alerts_absent

healthy = query_prometheus_alerts_absent(
    "https://prometheus.example",   # base URL, without the /api/v1 suffix
    "epex-trader",                  # value of the `service` label on the rules
    "pinexq-k3s-prod",              # value of the `tenant_cluster_name` label
    username="user",
    password="password",
)
# healthy is True when the service has no active alerts on that cluster

query_prometheus_alert_rules(...) returns the per-cluster state of each alert rule for the service as a {rule_name: state} mapping ("inactive", "pending", or "firing"). Because it enumerates loaded rules, it also confirms the rules are present:

from pinexq.monitoring import query_prometheus_alert_rules

states = query_prometheus_alert_rules(
    "https://prometheus.example",
    "epex-trader",
    "pinexq-k3s-prod",
    username="user",
    password="password",
)
# {"M7MessagesDropped": "inactive", "M7QueueSpilling": "firing", ...}
all_ok = all(state == "inactive" for state in states.values())

all_prometheus_alerts_inactive(...) wraps that call and returns a single boolean — True when every matching rule is inactive. Unlike query_prometheus_alerts_absent, it raises ValueError if the service / tenant_cluster_name matched no rules, so a typo can't be mistaken for a healthy result:

from pinexq.monitoring import all_prometheus_alerts_inactive

healthy = all_prometheus_alerts_inactive(
    "https://prometheus.example",
    "epex-trader",
    "pinexq-k3s-prod",
    username="user",
    password="password",
)

Credentials may instead be embedded in the connection string as userinfo — explicit username / password override any embedded ones:

query_prometheus_alerts_absent(
    "https://user:password@prometheus.example", "epex-trader", "pinexq-k3s-prod"
)

Both accept an optional keyword-only timeout (seconds, default 10.0), authenticate via HTTP basic auth, and raise httpx.HTTPStatusError on a non-2xx response or RuntimeError if the API reports a non-success status.

Development

uv sync --all-groups
uv build
ruff check .
pytest

Metadata

Release files for pinexq-tools 0.1.0

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

Built distribution (wheel)

Table of built distributions (wheels) for pinexq-tools 0.1.0
File Interpreter ABI Platform
pinexq_tools-0.1.0-py3-none-any.whl Python 3 none any Details

Release files / pinexq_tools-0.1.0-py3-none-any.whl

Download URL pinexq_tools-0.1.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a37910b36773ef135fa6dceceaf868f4f65f6d14a2374694a2178db849ceee49
BLAKE2b-256 checksum
How to use checksums
8b3c245c486e26f2ea8e335ddc2e44f98913086617a95b5b12caf6c3a0d57143
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Security for pinexq-tools 0.1.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.1.0 This release

1 release file 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