A simple integration for CronMon
Project description
cron-mon-py
A simple Python package to make using CronMon in your cron jobs and scheduled tasks quick and easy.
Installation
cron-mon-py can be installed via pip - or your Python package manager of choice - like any other Python package you might install
pip install cron-mon-py
cron-mon-pyisn't currently published anywhere, so this doesn't work just yet. You can however, install from Gitpip install git+https://github.com/cron-mon-io/cron-mon-py.git
Example
Simply import the monitor decorator and use it on any function that serves as the entry point to your cron job/ scheduled task that you wish to monitor:
You'll need to have setup a Monitor and an API key within CronMon itself, and have exposed the API key in an environment variable called
CRON_MON_API_KEY.
from cron_mon import monitor
# Replace <your-monitor-id> with your actual Monitor ID
@monitor("<your-monitor-id>")
def cron_job():
"""Your cron job code here"""
...
Development
Setting up a development environment
cron-mon-py uses uv to manage dependencies, so you'll need uv installed to get setup to work on cron-mon-py. You can either install uv on your machine, or you can use the dev container provided in the repository if your IDE supports dev containers (hint: it's very well supported on Visual Studio Code).
Once you have uv setup, you can use the Makefile provided to install all dependencies and run the tests. The available commands are as follows:
install: Install all of the required dependencies to work oncron-mon-pystatic-tests: Run static tests viaruffandmypyunit-tests: Run unit tests viapytesttest: Run all of the available tests forcron-mon-py(static-testsandunit-tests)build: Build the packagedocs: Build the package's docsserve-docs: Serve the package's documentation with hot-reloadformat: Autoformat the code withruff*
*You can avoid having to use
make formatif you setup your IDE to autoformat on save. The provided dev container has this already setup for you.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cron_mon_py-0.1.0.tar.gz.
File metadata
- Download URL: cron_mon_py-0.1.0.tar.gz
- Upload date:
- Size: 55.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.4.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
172d40d5c96f7676ef844a43f87232e9b03d27eb660a33022d206f36344781ba
|
|
| MD5 |
1eda1ce3fa1187a48f9f293558cd9837
|
|
| BLAKE2b-256 |
6c8ef14d94ccd342096100864a2a63545cddc37eea200271bc273d8cffd9e0b6
|
File details
Details for the file cron_mon_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cron_mon_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.4.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
865e0a1d6099f416b11e6acdf21105fcaf7da37aaef1214812e662e1ccd55ab7
|
|
| MD5 |
5164da8d9ce21b2ee3e3af692aada688
|
|
| BLAKE2b-256 |
4619c3bc997725e8aa4cad2b22bedc002f017ed32f2b033e6a8881112aafb864
|