Skip to main content

aailab-tools

aailab-tools provides a notify() decorator that reports the completion status of a function to the blade_dashboard notification API.

Installation

pip install aailab-tools

Configuration

The decorator reads its configuration from environment variables. On a multi-user server, the recommended setup is to export them globally once and let each project inherit them.

Recommended variables:

  • SERVER_NOTIFY: full notification endpoint URL, for example http://127.0.0.1:8000/api/notify
  • API_TOKEN: API token expected by blade_dashboard server
  • AAILAB_MACHINE_ID: optional machine identifier; if omitted, hostname is used

Example global setup:

cat > /etc/profile.d/aailab-tools.sh <<'EOF'
export SERVER_NOTIFY=http://127.0.0.1:8000/api/notify
export API_TOKEN=your-token
export AAILAB_MACHINE_ID=$(hostname)
EOF
chmod 644 /etc/profile.d/aailab-tools.sh

The decorator checks configuration in this order:

  1. Process environment variables
  2. .env in the current working directory
  3. .env next to the calling script
  4. ~/.config/aailab-tools/.env or $XDG_CONFIG_HOME/aailab-tools/.env
  5. ~/.aailab-tools.env

The .env files are fallback sources for cases where the process environment is not set explicitly.

Usage

from aailab_tools import notify


@notify("user@example.com", "admin@example.com")
def run_job():
    return 42

On success, the server receives status 0. If the function raises an exception, the exception text is sent as the status and the exception is re-raised.

Metadata

Release files for aailab-tools 0.1.2

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

Source distribution (sdist)

Source distribution for aailab-tools 0.1.2
File Size Uploaded Provenance
aailab_tools-0.1.2.tar.gz 4.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aailab-tools 0.1.2
File Interpreter ABI Platform
aailab_tools-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.5 kB

Release files / aailab_tools-0.1.2.tar.gz

Download URL aailab_tools-0.1.2.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
adc46d1bf269b1fd88e2d234d5bc93b1153dce87806d07a35a0365392083f007
BLAKE2b-256 checksum
How to use checksums
7a186f186173328721ce623cc1bb7cc143eb036c09b41fa6db0a8d99576910f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.12

Release files / aailab_tools-0.1.2-py3-none-any.whl

Download URL aailab_tools-0.1.2-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1935aedc37742fd70bd694251d40026426a5a89633885cc964bac2a204329b0
BLAKE2b-256 checksum
How to use checksums
d7c2b4632f12081e5140d96f5d522fc613c67d825fd8ae0894c44cfff04c3700
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.12

Security for aailab-tools 0.1.2

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.

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