Skip to main content

ZoneMinder API, Logger and other base utilities for python programmers

Project description

What

pyzmv2 is a rewrite of pyzm.

It's a pythonic wrapper that integrates with ZM and also operates as a standalone ML library. Key features:

  • ZM API
  • ZM Event Server
  • ZM Logger
  • ZM Memory
  • Machine Learning Modules (with our without ZM)

Installation

See the installation guide on ReadTheDocs.

Documentation & Examples

Latest documentation is available here. The documentation includes a full example.

Features

  • API auth using tokens or legacy (manages refresh logins automatically)
  • Monitors
  • Events with filters
  • States
  • Configs
  • EventNotification callbacks
  • Mapped Memory access
  • Direct access to ML algorithms
  • Remote ML detection server (pyzm.serve) — run models on a GPU box, detect from anywhere
  • Amazon Rekognition support for object detection

Training UI

pyzm includes a Streamlit-based UI for fine-tuning YOLO models on your own data:

/opt/zoneminder/venv/bin/python -m streamlit run pyzm/train/app.py -- --base-path /var/lib/zmeventnotification/models

The --base-path flag points to your ZoneMinder models directory (defaults to /var/lib/zmeventnotification/models). Projects are stored in ~/.pyzm/training/.

Testing

pyzm has three test tiers:

Unit / integration tests (no hardware required):

pip install pytest
python -m pytest tests/ -m "not e2e and not zm_e2e" -v

ML end-to-end tests (require real ML models on disk):

# Requires models in /var/lib/zmeventnotification/models/
# and the test image at tests/test_ml_e2e/bird.jpg (included in repo)
python -m pytest tests/test_ml_e2e/ -v

# Skip the slower remote-serve tests:
python -m pytest tests/test_ml_e2e/ -v -m "not serve"

ZoneMinder end-to-end tests (require a live ZM server):

One-time setup:

sudo /opt/zoneminder/venv/bin/pip install pytest
cp tests/.env.zm_e2e.sample .env.zm_e2e   # edit with your ZM server details
# Readonly tests (auth, monitors, events, zones, frames, detection):
sudo -u www-data /opt/zoneminder/venv/bin/python -m pytest tests/test_zm_e2e/ -v -p no:cacheprovider

# Include write tests (event notes, stop/start/restart, DB tagging):
sudo -u www-data ZM_E2E_WRITE=1 /opt/zoneminder/venv/bin/python -m pytest tests/test_zm_e2e/ -v -p no:cacheprovider

ZM E2E tests auto-skip when .env.zm_e2e is missing, so pytest tests/ is always safe.

Developer Notes (for myself)

To make a release:

./scripts/make_release.sh

To skip PyPI upload (e.g. package already published):

./scripts/make_release.sh --skip-pypi

To test docs:

cd docs/
make html && python -m http.server -d _build/html

To test a CHANGELOG:

# __version__ in pyzm/__init__.py should be updated
# replace v2.0.3 with whatever future version
GITHUB_TOKEN=$(gh auth token) git-cliff --tag "v2.0.3"

Limitations

  • Requires Python 3.10+

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

pyzm-2.1.3.tar.gz (219.8 kB view details)

Uploaded Source

Built Distribution

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

pyzm-2.1.3-py3-none-any.whl (153.3 kB view details)

Uploaded Python 3

File details

Details for the file pyzm-2.1.3.tar.gz.

File metadata

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

File hashes

Hashes for pyzm-2.1.3.tar.gz
Algorithm Hash digest
SHA256 0b7c011c4ae1b9517dab91c9df4b19073701a3161c2d502ff2a65a8d72531aea
MD5 de735f60e9f3247c33ea019c5f8b5efb
BLAKE2b-256 aee1caf38f217659348bbfdc31f1271893adf8342b41188d11f09d7632f09b47

See more details on using hashes here.

File details

Details for the file pyzm-2.1.3-py3-none-any.whl.

File metadata

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

File hashes

Hashes for pyzm-2.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2d9a74d93e7f8d1a4966b7ece7f52252d8b1b4a7b7e0101ec0b0b4ebb2b66ea6
MD5 0e46a8c84c3e0cbc21d27f17e21ef041
BLAKE2b-256 b5bd0a042b5ddfb2822b00f7e1209bc72d493d36dd13d218a9fa268c27afb3fd

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