Skip to main content

Monitor your Python scripts with one decorator — retries, timing, and smart error explanations.

Project description

py-eeive

Monitor your Python scripts with one decorator — automatic retries, timing, and smart error explanations.

No external dependencies. Works with sync and async functions.

Install

pip install py-eeive

Usage

from py_eeive import monitor

@monitor(retries=3, retry_delay=5, log=True, language="english")
def main():
    # your script here
    ...

main()

Parameters

Parameter Default Description
retries 1 How many times to retry on failure
retry_delay 5 Seconds to wait between retries
log True Save error log to logs/ folder as JSON
language "english" Output language: "english", "russian", "spanish", "greek"
custom_errors None Your own error explanations (dict)
exponential_backoff False Double the delay on each retry
retry_on (Exception,) Only retry on these specific exceptions

Example output — success

[py-eeive] Starting: main
──────────────────────────────────────────────────
[py-eeive] ✅ Finished in 2.4 sec

Example output — failure

[py-eeive] Starting: main
──────────────────────────────────────────────────
[py-eeive] ❌ Attempt 1/3 — Line 12 — ZeroDivisionError: division by zero
[py-eeive] 🔄 Retrying in 5 sec...
[py-eeive] ❌ Attempt 2/3 — Line 12 — ZeroDivisionError: division by zero
[py-eeive] 🔄 Retrying in 5 sec...
[py-eeive] ❌ Attempt 3/3 — Line 12 — ZeroDivisionError: division by zero

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💥 Script failed permanently
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  Error:   ZeroDivisionError: division by zero
  Line:    12 in file main.py
  Cause:   You are dividing a number by zero.
  Fix:     Check that the denominator is not 0 before dividing.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ⏱  15.3 sec
  📄 Log saved: logs/main_2026-04-24_12-00-00.json
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Custom error explanations

MY_ERRORS = {
    "MyCustomError": {
        "cause": "Something specific to my app went wrong.",
        "fix": "Check the config file."
    }
}

@monitor(retries=2, custom_errors=MY_ERRORS)
def main():
    ...

Async support

Works with async functions out of the box:

@monitor(retries=3, retry_delay=2)
async def fetch_data():
    ...

Retry only on specific exceptions

@monitor(retries=5, retry_on=(ConnectionError, TimeoutError))
def main():
    ...

License

MIT

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

py_eeive-1.0.0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

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

py_eeive-1.0.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for py_eeive-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b7e3fbe9fced105f6474b8df3b460fb2372f6fb439b7055d4a9c9693bf3005da
MD5 72ee3720fba11959f59bde4060024b16
BLAKE2b-256 fa4cf43f1e98362dabd5a24ae3ea27f052c75e35e4411fafa615d93a42b75452

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for py_eeive-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 deb5234b3438c97844a8c6f1dba99b223e672a6edd0c393392d0ce7e02cae9fb
MD5 6a24b4eba9a7e0b0905a1ada639c1c8b
BLAKE2b-256 4c483c7be9a7df579fa2a30b8ae1791c9b80c3cf1a32bea9aac0319c92a6d887

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