datastreamservicelib
AsyncIO eventloop helpers and Abstract Base Classes for making services that use ZMQ nice, easy and DRY.
Python 3.12, 3.13 and 3.14 are supported.
Usage
Use the CookieCutter template at https://gitlab.com/advian-oss/python-datastreamserviceapp_template or see src/datastreamservicelib/console.py for publisher and subscriber examples.
Create and run services inside a managed event loop:
import asyncio
from pathlib import Path
from datastreamservicelib.service import SimpleService
async def main() -> int:
service = SimpleService(Path("config.toml"))
return await service.run()
raise SystemExit(asyncio.run(main()))
Local development
Install uv and create the locked development environment:
uv sync --locked --python 3.12 uv run --locked prek install --install-hooks uv run --locked prek run --all-files uv run --locked pytest
Use Python 3.12 for development when checking compatibility with the oldest supported version. To use another supported interpreter, run uv sync --locked --python 3.14. Commands run through uv run use the project environment; manual activation is optional.
The hooks use Ruff for linting and formatting, strict Pyrefly for type checking, and Bandit for security checks. The configuration remains .pre-commit-config.yaml; prek is the hook runner. Individual checks and CLI help are available with:
uv run --locked ruff check src tests uv run --locked ruff format --check src tests uv run --locked pyrefly check uv run --locked bandit -r src uv run --locked testpublisher --help uv run --locked testsubscriber --help
Refresh uv.lock after editing dependencies with uv lock. Commit both the metadata and lockfile. Build the wheel and source distribution with uv build.
Version bumps
Preview and apply a patch bump with:
uv run --locked bump-my-version bump patch --dry-run -v uv run --locked bump-my-version bump patch uv lock uv build
.bumpversion.toml updates the project metadata, package version, version test, and production image tags in this README. Review and commit the changes; bumping does not automatically commit or create a tag.
Containers
Dockerfile uses Debian Trixie. Dockerfile_alpine uses Alpine 3.24. Both provide test, tox, devel_shell and production targets. Production uses Python 3.14; tox tests Python 3.12, 3.13 and 3.14.
Run all container builds and checks with Docker or Podman:
CONTAINER_ENGINE=docker ./run_tests.sh CONTAINER_ENGINE=podman ./run_tests.sh
Limit the run when developing a particular target:
CONTAINER_ENGINE=podman VARIANTS=debian TARGETS=tox ./run_tests.sh
The script copies source into each image and does not mount the host virtualenv, Git hooks, or SSH agent. Public dependencies need no SSH forwarding. It does not need a shared temporary directory in Podman Machine.
An optional wheelhouse can be used during builds:
WHEELHOUSE_URL=http://host.docker.internal:3141/debian/ CONTAINER_ENGINE=podman ./run_tests.sh
Set VARIANTS=debian when using a Debian-specific wheelhouse. For Alpine, use the appropriate wheelhouse URL. The script maps host.docker.internal to the host gateway; without WHEELHOUSE_URL, uv uses its normal package index.
Development shell
Build and run a development shell:
docker build --target devel_shell -t datastreamservicelib:devel_shell . docker run --rm -it datastreamservicelib:devel_shell
Podman equivalent:
podman build --format docker --target devel_shell -t datastreamservicelib:devel_shell . podman run --rm -it datastreamservicelib:devel_shell
Run uv run --locked pytest or uv run --locked docker/prek_init.sh inside the container. Rebuild to include source edits. For interactive source editing, mount the repository at /app; its VM sharing configuration must permit this when using Podman. The development environment is kept at /opt/venv inside the container.
Tox
Run a single interpreter in the tox image:
podman build --format docker --target tox -t datastreamservicelib:tox . podman run --rm datastreamservicelib:tox -e py314
For Docker, use docker instead of podman and omit --format docker. With no arguments, the tox image runs all supported interpreters. Each tox environment syncs from uv.lock and runs hooks, pytest, Pyrefly and Bandit.
Production
Build a production image and inspect the publisher/subscriber commands:
docker build --target production -t datastreamservicelib:1.16.0 . docker run --rm datastreamservicelib:1.16.0 testpublisher --help docker run --rm datastreamservicelib:1.16.0 testsubscriber --help
Podman equivalent:
podman build --format docker --target production -t datastreamservicelib:1.16.0 . podman run --rm datastreamservicelib:1.16.0 testpublisher --help
The default command displays help for both tools. To exchange messages between containers, use a common network and a TCP socket, or a shared volume and an IPC socket. IPC sockets shared between macOS and a Linux VM do not behave like native Linux sockets.
Continuous integration
GitLab runs the Python test matrix and builds wheel/source distributions. It also builds and runs all four container targets on Debian and Alpine using run_tests.sh. Container jobs require a privileged Docker-in-Docker runner with shared TLS certificates. Local validation uses Podman; remote runner behavior must be verified in GitLab.
Metadata
Release files for datastreamservicelib 1.16.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datastreamservicelib-1.16.0.tar.gz | 104.2 kB | Without provenance | Details for datastreamservicelib-1.16.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datastreamservicelib-1.16.0-py3-none-any.whl | Python 3 | none | any | Details for datastreamservicelib-1.16.0-py3-none-any.whl |
Total release size: 119.3 kB
Release files / datastreamservicelib-1.16.0.tar.gz
| Download URL | datastreamservicelib-1.16.0.tar.gz |
|---|---|
| Size | 104.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d22d58f481f3f786d928aa1b902f8d5353e7f93995c964f09eba7c3635e96875
|
|
BLAKE2b-256 checksum How to use checksums |
8de38c93427085c174cee0c5101e908ea4e516da494f3ff3b1328a1c307f6d70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Release files / datastreamservicelib-1.16.0-py3-none-any.whl
| Download URL | datastreamservicelib-1.16.0-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2f26a88ac87e28cadd2a0f173903260b09927f0caa6c77bae15833c5557c355a
|
|
BLAKE2b-256 checksum How to use checksums |
3ebbf10af054e6e337eeff2dc9701c1dcb8f10a7218b9d1d77c8b974c9ec4f76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Security for datastreamservicelib 1.16.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.