datastreamcorelib 1.7.1__tar.gz → 1.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. datastreamcorelib-1.8.0/.bumpversion.toml +24 -0
  2. datastreamcorelib-1.8.0/.dockerignore +13 -0
  3. datastreamcorelib-1.8.0/.gitignore +137 -0
  4. datastreamcorelib-1.8.0/.gitlab-ci.yml +41 -0
  5. datastreamcorelib-1.8.0/.pre-commit-config.yaml +89 -0
  6. datastreamcorelib-1.8.0/AGENTS.md +9 -0
  7. datastreamcorelib-1.8.0/Dockerfile +57 -0
  8. datastreamcorelib-1.8.0/Dockerfile_alpine +57 -0
  9. datastreamcorelib-1.8.0/PKG-INFO +126 -0
  10. datastreamcorelib-1.8.0/README.rst +112 -0
  11. datastreamcorelib-1.8.0/docker/entrypoint-test.sh +10 -0
  12. datastreamcorelib-1.8.0/docker/entrypoint-tox.sh +8 -0
  13. datastreamcorelib-1.8.0/docker/prek_init.sh +10 -0
  14. datastreamcorelib-1.8.0/pyproject.toml +66 -0
  15. datastreamcorelib-1.8.0/run_tests.sh +36 -0
  16. {datastreamcorelib-1.7.1 → datastreamcorelib-1.8.0}/src/datastreamcorelib/__init__.py +1 -1
  17. {datastreamcorelib-1.7.1 → datastreamcorelib-1.8.0}/src/datastreamcorelib/abstract.py +3 -5
  18. {datastreamcorelib-1.7.1 → datastreamcorelib-1.8.0}/src/datastreamcorelib/datamessage.py +5 -7
  19. {datastreamcorelib-1.7.1 → datastreamcorelib-1.8.0}/src/datastreamcorelib/imagemessage.py +6 -6
  20. {datastreamcorelib-1.7.1 → datastreamcorelib-1.8.0}/src/datastreamcorelib/pubsub.py +15 -11
  21. {datastreamcorelib-1.7.1 → datastreamcorelib-1.8.0}/src/datastreamcorelib/reqrep.py +5 -6
  22. {datastreamcorelib-1.7.1 → datastreamcorelib-1.8.0}/src/datastreamcorelib/utils.py +3 -2
  23. datastreamcorelib-1.8.0/tests/__init__.py +1 -0
  24. datastreamcorelib-1.8.0/tests/conftest.py +13 -0
  25. datastreamcorelib-1.8.0/tests/fixtures.py +102 -0
  26. datastreamcorelib-1.8.0/tests/test_abc.py +41 -0
  27. datastreamcorelib-1.8.0/tests/test_binpackers.py +99 -0
  28. datastreamcorelib-1.8.0/tests/test_datamessage.py +121 -0
  29. datastreamcorelib-1.8.0/tests/test_datastreamcorelib.py +8 -0
  30. datastreamcorelib-1.8.0/tests/test_fakes.py +85 -0
  31. datastreamcorelib-1.8.0/tests/test_heartbeat.py +16 -0
  32. datastreamcorelib-1.8.0/tests/test_helpers.py +13 -0
  33. datastreamcorelib-1.8.0/tests/test_imagemessage.py +142 -0
  34. datastreamcorelib-1.8.0/tests/test_pubsub_async.py +269 -0
  35. datastreamcorelib-1.8.0/tests/test_pubsumessage.py +44 -0
  36. datastreamcorelib-1.8.0/tests/test_rep.py +201 -0
  37. datastreamcorelib-1.8.0/tests/test_req.py +149 -0
  38. datastreamcorelib-1.8.0/tests/test_socketdesc.py +14 -0
  39. datastreamcorelib-1.8.0/tests/test_subscription.py +96 -0
  40. datastreamcorelib-1.8.0/tox.ini +17 -0
  41. datastreamcorelib-1.8.0/uv.lock +1064 -0
  42. datastreamcorelib-1.7.1/PKG-INFO +0 -123
  43. datastreamcorelib-1.7.1/README.rst +0 -103
  44. datastreamcorelib-1.7.1/pyproject.toml +0 -76
  45. {datastreamcorelib-1.7.1 → datastreamcorelib-1.8.0}/LICENSE +0 -0
  46. {datastreamcorelib-1.7.1 → datastreamcorelib-1.8.0}/src/datastreamcorelib/binpackers.py +0 -0
  47. {datastreamcorelib-1.7.1 → datastreamcorelib-1.8.0}/src/datastreamcorelib/logging.py +0 -0
  48. {datastreamcorelib-1.7.1 → datastreamcorelib-1.8.0}/src/datastreamcorelib/py.typed +0 -0
  49. {datastreamcorelib-1.7.1 → datastreamcorelib-1.8.0}/src/datastreamcorelib/testhelpers.py +0 -0
@@ -0,0 +1,24 @@
1
+ [tool.bumpversion]
2
+ current_version = "1.8.0"
3
+ commit = false
4
+ tag = false
5
+
6
+ [[tool.bumpversion.files]]
7
+ filename = "pyproject.toml"
8
+ search = 'version = "{current_version}"'
9
+ replace = 'version = "{new_version}"'
10
+
11
+ [[tool.bumpversion.files]]
12
+ filename = "src/datastreamcorelib/__init__.py"
13
+ search = '__version__ = "{current_version}"'
14
+ replace = '__version__ = "{new_version}"'
15
+
16
+ [[tool.bumpversion.files]]
17
+ filename = "tests/test_datastreamcorelib.py"
18
+ search = '__version__ == "{current_version}"'
19
+ replace = '__version__ == "{new_version}"'
20
+
21
+ [[tool.bumpversion.files]]
22
+ filename = "README.rst"
23
+ search = "datastreamcorelib:{current_version}"
24
+ replace = "datastreamcorelib:{new_version}"
@@ -0,0 +1,13 @@
1
+ .tox
2
+ .git
3
+ *build*
4
+ *.pyc
5
+ __pycache__
6
+ .pytest_cache
7
+ *.egg*
8
+ .mypy_cache
9
+ .python-version
10
+ .venv
11
+ .ruff_cache
12
+ HANDOFF.md
13
+ dist
@@ -0,0 +1,137 @@
1
+ # IDE settings
2
+ .idea
3
+
4
+ # pytest artefakts
5
+ pytest*.xml
6
+
7
+ # Byte-compiled / optimized / DLL files
8
+ __pycache__/
9
+ *.py[cod]
10
+ *$py.class
11
+
12
+ # C extensions
13
+ *.so
14
+
15
+ # Distribution / packaging
16
+ .Python
17
+ build/
18
+ develop-eggs/
19
+ dist/
20
+ downloads/
21
+ eggs/
22
+ .eggs/
23
+ lib/
24
+ lib64/
25
+ parts/
26
+ sdist/
27
+ var/
28
+ wheels/
29
+ pip-wheel-metadata/
30
+ share/python-wheels/
31
+ *.egg-info/
32
+ .installed.cfg
33
+ *.egg
34
+ MANIFEST
35
+
36
+ # PyInstaller
37
+ # Usually these files are written by a python script from a template
38
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
39
+ *.manifest
40
+ *.spec
41
+
42
+ # Installer logs
43
+ pip-log.txt
44
+ pip-delete-this-directory.txt
45
+
46
+ # Unit test / coverage reports
47
+ htmlcov/
48
+ .tox/
49
+ .nox/
50
+ .coverage
51
+ .coverage.*
52
+ .cache
53
+ nosetests.xml
54
+ coverage.xml
55
+ *.cover
56
+ *.py,cover
57
+ .hypothesis/
58
+ .pytest_cache/
59
+
60
+ # Translations
61
+ *.mo
62
+ *.pot
63
+
64
+ # Django stuff:
65
+ *.log
66
+ local_settings.py
67
+ db.sqlite3
68
+ db.sqlite3-journal
69
+
70
+ # Flask stuff:
71
+ instance/
72
+ .webassets-cache
73
+
74
+ # Scrapy stuff:
75
+ .scrapy
76
+
77
+ # Sphinx documentation
78
+ docs/_build/
79
+
80
+ # PyBuilder
81
+ target/
82
+
83
+ # Jupyter Notebook
84
+ .ipynb_checkpoints
85
+
86
+ # IPython
87
+ profile_default/
88
+ ipython_config.py
89
+
90
+ # pyenv
91
+ .python-version
92
+
93
+ # pipenv
94
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
96
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
97
+ # install all needed dependencies.
98
+ #Pipfile.lock
99
+
100
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
101
+ __pypackages__/
102
+
103
+ # Celery stuff
104
+ celerybeat-schedule
105
+ celerybeat.pid
106
+
107
+ # SageMath parsed files
108
+ *.sage.py
109
+
110
+ # Environments
111
+ .env
112
+ .venv
113
+ env/
114
+ venv/
115
+ ENV/
116
+ env.bak/
117
+ venv.bak/
118
+
119
+ # Spyder project settings
120
+ .spyderproject
121
+ .spyproject
122
+
123
+ # Rope project settings
124
+ .ropeproject
125
+
126
+ # mkdocs documentation
127
+ /site
128
+
129
+ # mypy
130
+ .mypy_cache/
131
+ .dmypy.json
132
+ dmypy.json
133
+
134
+ # Pyre type checker
135
+ .pyre/
136
+
137
+ .ruff_cache/
@@ -0,0 +1,41 @@
1
+ stages:
2
+ - test
3
+ - build
4
+
5
+ python-tests:
6
+ stage: test
7
+ image: ghcr.io/astral-sh/uv:0.12.12-python3.14-trixie
8
+ parallel:
9
+ matrix:
10
+ - PYTHON_VERSION: ["3.12", "3.13", "3.14", "3.15"]
11
+ script:
12
+ - uv sync --locked --python "$PYTHON_VERSION"
13
+ - uv run --locked prek run --all-files
14
+ - uv run --locked pytest --junitxml=pytest.xml tests/
15
+ - uv build
16
+ artifacts:
17
+ when: always
18
+ reports:
19
+ junit: pytest.xml
20
+
21
+ container-tests:
22
+ stage: build
23
+ image: docker:29.8.0-cli
24
+ services:
25
+ - name: docker:29.8.0-dind
26
+ alias: docker
27
+ variables:
28
+ DOCKER_HOST: tcp://docker:2376
29
+ DOCKER_TLS_CERTDIR: /certs
30
+ DOCKER_TLS_VERIFY: "1"
31
+ DOCKER_CERT_PATH: /certs/client
32
+ DOCKER_BUILDKIT: "1"
33
+ parallel:
34
+ matrix:
35
+ - VARIANTS: [debian, alpine]
36
+ TARGETS: [test, tox, devel_shell, production]
37
+ before_script:
38
+ - apk add --no-cache bash
39
+ - docker info
40
+ script:
41
+ - CONTAINER_ENGINE=docker ./run_tests.sh
@@ -0,0 +1,89 @@
1
+ # Run these hooks with prek: https://prek.j178.dev/
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+ default_language_version:
4
+ python: python3
5
+ default_install_hook_types:
6
+ - pre-commit
7
+ - commit-msg
8
+ repos:
9
+ - repo: https://github.com/compilerla/conventional-pre-commit
10
+ rev: v4.5.0
11
+ hooks:
12
+ - id: conventional-pre-commit
13
+ stages: [commit-msg]
14
+ args: []
15
+ - repo: https://github.com/pre-commit/pre-commit-hooks
16
+ rev: v6.0.0
17
+ hooks:
18
+ - id: no-commit-to-branch
19
+ - id: check-executables-have-shebangs
20
+ - id: check-ast
21
+ - id: check-toml
22
+ - id: trailing-whitespace
23
+ - id: end-of-file-fixer
24
+ - id: check-yaml
25
+ - id: check-added-large-files
26
+ - id: check-case-conflict
27
+ - id: check-json
28
+ - id: check-merge-conflict
29
+ - id: check-symlinks
30
+ - id: pretty-format-json
31
+ args:
32
+ - --autofix
33
+ - repo: local
34
+ hooks:
35
+ - id: ruff-check
36
+ name: Ruff lint
37
+ entry: uv run --locked ruff check --fix
38
+ language: system
39
+ types_or: [python, pyi]
40
+ - id: ruff-format
41
+ name: Ruff format
42
+ entry: uv run --locked ruff format
43
+ language: system
44
+ types_or: [python, pyi]
45
+ - repo: local
46
+ hooks:
47
+ - id: pyrefly
48
+ name: Pyrefly type check
49
+ entry: uv run --locked pyrefly check
50
+ language: system
51
+ pass_filenames: false
52
+ files: \.(py|pyi|toml)$
53
+ - repo: https://github.com/Lucas-C/pre-commit-hooks
54
+ rev: v1.5.6
55
+ hooks:
56
+ - id: forbid-crlf
57
+ - id: remove-crlf
58
+ - id: forbid-tabs
59
+ - id: remove-tabs
60
+ - repo: https://github.com/PyCQA/bandit
61
+ rev: 1.9.4
62
+ hooks:
63
+ - id: bandit
64
+ args: ["--skip=B101"]
65
+ - repo: https://github.com/Lucas-C/pre-commit-hooks-markup
66
+ rev: v1.0.1
67
+ hooks:
68
+ - id: rst-linter
69
+ - repo: https://github.com/Yelp/detect-secrets
70
+ rev: v1.5.0
71
+ hooks:
72
+ - id: detect-secrets
73
+ entry: uv run --locked detect-secrets-hook
74
+ language: system
75
+ exclude: '^uv\.lock$'
76
+ # args: ['--baseline', '.secrets.baseline']
77
+ - repo: https://github.com/shellcheck-py/shellcheck-py
78
+ rev: v0.11.0.1-1
79
+ hooks:
80
+ - id: shellcheck
81
+ args: ["--external-sources"]
82
+ - repo: local
83
+ hooks:
84
+ - id: uv-lock
85
+ name: Check uv lockfile
86
+ entry: uv lock --check
87
+ language: system
88
+ files: ^(pyproject\.toml|uv\.lock)$
89
+ pass_filenames: false
@@ -0,0 +1,9 @@
1
+ # Agent instructions
2
+
3
+ - Use the [`ponytail`](https://github.com/DietrichGebert/ponytail) skill for all coding work.
4
+ - Run `uv run --locked prek install` when you set up this repository. This installs the basic pre-commit checks.
5
+ - Run `uv run --locked prek run --all-files` regularly. Run it before pushing or creating a PR when those actions are authorized.
6
+ - Run `ponytail-audit` before every commit. Fix findings caused by the staged change before committing.
7
+ - Use conventional commits, keep commits focused and their messages concise.
8
+ - Write all documentation in Simplified Technical English (STE). Use short, active sentences and consistent terms. Give one instruction per sentence. Preserve exact commands and identifiers.
9
+ - If authorized to push, create a draft PR at first opportunity so CI can be utilized most effectively.
@@ -0,0 +1,57 @@
1
+ # syntax=docker/dockerfile:1
2
+ FROM ghcr.io/astral-sh/uv:0.12.12 AS uv
3
+
4
+ # Run the full supported Python matrix in an isolated tooling environment.
5
+ FROM advian/tox-base:debian-trixie AS tox
6
+ ARG PYTHON_VERSIONS="3.15 3.14 3.13 3.12"
7
+ ENV PYENV_ROOT=/root/.pyenv
8
+ ENV PATH="/opt/tox/bin:/root/.pyenv/shims:/root/.pyenv/bin:$PATH"
9
+ COPY --from=uv /uv /uvx /usr/local/bin/
10
+ ARG UV_FIND_LINKS=
11
+ ARG UV_INSECURE_HOST=host.docker.internal
12
+ RUN resolved="$(pyenv_resolve $PYTHON_VERSIONS)" \
13
+ && for version in $resolved; do pyenv install -s "$version"; done \
14
+ && pyenv global $resolved \
15
+ && uv venv --python "$(pyenv which python)" /opt/tox \
16
+ && uv pip install --python /opt/tox/bin/python 'tox>=4,<5'
17
+ WORKDIR /app
18
+ COPY . /app
19
+ ENTRYPOINT ["/app/docker/entrypoint-tox.sh"]
20
+
21
+ FROM python:3.14-trixie AS builder_base
22
+ ENV LC_ALL=C.UTF-8 PYTHONFAULTHANDLER=1 PYTHONUNBUFFERED=1 \
23
+ PYTHONHASHSEED=random UV_PROJECT_ENVIRONMENT=/opt/venv \
24
+ PATH="/opt/venv/bin:$PATH"
25
+ COPY --from=uv /uv /uvx /usr/local/bin/
26
+ ARG UV_FIND_LINKS=
27
+ ARG UV_INSECURE_HOST=host.docker.internal
28
+ RUN apt-get update && apt-get install -y --no-install-recommends bash git build-essential libffi-dev libssl-dev tini openssh-client cargo && rm -rf /var/lib/apt/lists/*
29
+ WORKDIR /app
30
+ COPY uv.lock pyproject.toml README.rst /app/
31
+ RUN uv sync --locked --no-install-project
32
+
33
+ FROM builder_base AS production_build
34
+ COPY src /app/src
35
+ COPY LICENSE /app/LICENSE
36
+ RUN uv sync --locked --no-dev --no-editable \
37
+ && uv build --wheel
38
+
39
+ FROM python:3.14-slim-trixie AS production
40
+ ENV PATH="/opt/venv/bin:$PATH" PYTHONUNBUFFERED=1
41
+ RUN apt-get update && apt-get install -y --no-install-recommends bash libffi8 tini && rm -rf /var/lib/apt/lists/*
42
+ COPY --from=production_build /opt/venv /opt/venv
43
+ WORKDIR /app
44
+ ENTRYPOINT ["/usr/bin/tini", "--"]
45
+ CMD ["python", "-c", "import datastreamcorelib; print(datastreamcorelib.__version__)"]
46
+
47
+ FROM builder_base AS devel_build
48
+ COPY . /app
49
+ RUN uv sync --locked
50
+
51
+ FROM devel_build AS test
52
+ ENTRYPOINT ["/usr/bin/tini", "--", "/app/docker/entrypoint-test.sh"]
53
+
54
+ FROM devel_build AS devel_shell
55
+ RUN apt-get update && apt-get install -y zsh vim && rm -rf /var/lib/apt/lists/* \
56
+ && echo '. /opt/venv/bin/activate' >> /root/.zshrc
57
+ ENTRYPOINT ["/bin/zsh"]
@@ -0,0 +1,57 @@
1
+ # syntax=docker/dockerfile:1
2
+ FROM ghcr.io/astral-sh/uv:0.12.12 AS uv
3
+
4
+ # Run the full supported Python matrix in an isolated tooling environment.
5
+ FROM advian/tox-base:alpine-3.24 AS tox
6
+ ARG PYTHON_VERSIONS="3.15 3.14 3.13 3.12"
7
+ ENV PYENV_ROOT=/root/.pyenv
8
+ ENV PATH="/opt/tox/bin:/root/.pyenv/shims:/root/.pyenv/bin:$PATH"
9
+ COPY --from=uv /uv /uvx /usr/local/bin/
10
+ ARG UV_FIND_LINKS=
11
+ ARG UV_INSECURE_HOST=host.docker.internal
12
+ RUN resolved="$(pyenv_resolve $PYTHON_VERSIONS)" \
13
+ && for version in $resolved; do pyenv install -s "$version"; done \
14
+ && pyenv global $resolved \
15
+ && uv venv --python "$(pyenv which python)" /opt/tox \
16
+ && uv pip install --python /opt/tox/bin/python 'tox>=4,<5'
17
+ WORKDIR /app
18
+ COPY . /app
19
+ ENTRYPOINT ["/app/docker/entrypoint-tox.sh"]
20
+
21
+ FROM python:3.14-alpine3.24 AS builder_base
22
+ ENV LC_ALL=C.UTF-8 PYTHONFAULTHANDLER=1 PYTHONUNBUFFERED=1 \
23
+ PYTHONHASHSEED=random UV_PROJECT_ENVIRONMENT=/opt/venv \
24
+ PATH="/opt/venv/bin:$PATH"
25
+ COPY --from=uv /uv /uvx /usr/local/bin/
26
+ ARG UV_FIND_LINKS=
27
+ ARG UV_INSECURE_HOST=host.docker.internal
28
+ RUN apk add --no-cache bash git build-base libffi-dev openssl-dev tini openssh-client cargo linux-headers
29
+ WORKDIR /app
30
+ COPY uv.lock pyproject.toml README.rst /app/
31
+ RUN uv sync --locked --no-install-project
32
+
33
+ FROM builder_base AS production_build
34
+ COPY src /app/src
35
+ COPY LICENSE /app/LICENSE
36
+ RUN uv sync --locked --no-dev --no-editable \
37
+ && uv build --wheel
38
+
39
+ FROM python:3.14-alpine3.24 AS production
40
+ ENV PATH="/opt/venv/bin:$PATH" PYTHONUNBUFFERED=1
41
+ RUN apk add --no-cache bash libffi tini
42
+ COPY --from=production_build /opt/venv /opt/venv
43
+ WORKDIR /app
44
+ ENTRYPOINT ["/sbin/tini", "--"]
45
+ CMD ["python", "-c", "import datastreamcorelib; print(datastreamcorelib.__version__)"]
46
+
47
+ FROM builder_base AS devel_build
48
+ COPY . /app
49
+ RUN uv sync --locked
50
+
51
+ FROM devel_build AS test
52
+ ENTRYPOINT ["/sbin/tini", "--", "/app/docker/entrypoint-test.sh"]
53
+
54
+ FROM devel_build AS devel_shell
55
+ RUN apk add --no-cache zsh vim \
56
+ && echo '. /opt/venv/bin/activate' >> /root/.zshrc
57
+ ENTRYPOINT ["/bin/zsh"]
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.5
2
+ Name: datastreamcorelib
3
+ Version: 1.8.0
4
+ Summary: Helpers and utilities for https://gitlab.com/advian-oss/python-datastreamservicelib that are not eventloop specific.
5
+ Project-URL: Homepage, https://gitlab.com/advian-oss/python-datastreamcorelib/
6
+ Project-URL: Repository, https://gitlab.com/advian-oss/python-datastreamcorelib/
7
+ Author-email: Eero af Heurlin <eero.afheurlin@iki.fi>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Requires-Python: <4.0,>=3.12
11
+ Requires-Dist: libadvian<2.0,>=1.9.0
12
+ Requires-Dist: msgpack<2.0,>=1.2.4
13
+ Description-Content-Type: text/x-rst
14
+
15
+ =================
16
+ datastreamcorelib
17
+ =================
18
+
19
+ Core message types and abstract base classes for ZeroMQ event loop adapters.
20
+
21
+ CI tests Python 3.12, 3.13, 3.14, and 3.15.
22
+
23
+ For an asyncio adapter, see https://gitlab.com/advian-oss/python-datastreamservicelib.
24
+ For a service template, see https://gitlab.com/advian-oss/python-datastreamserviceapp_template.
25
+
26
+ Local development
27
+ -----------------
28
+
29
+ Install uv_. Create the development environment with Python 3.12 to check
30
+ compatibility with the oldest supported version::
31
+
32
+ uv sync --locked --python 3.12
33
+ uv run --locked prek install --install-hooks
34
+ uv run --locked prek run --all-files
35
+ uv run --locked pytest
36
+
37
+ .. _uv: https://docs.astral.sh/uv/getting-started/installation/
38
+
39
+ To change the interpreter, run ``uv sync --locked --python 3.14``.
40
+ The hooks use Ruff for linting and formatting, Pyrefly for type checking,
41
+ and Bandit for security checks. Run each check directly when necessary::
42
+
43
+ uv run --locked ruff check src tests
44
+ uv run --locked ruff format --check src tests
45
+ uv run --locked pyrefly check
46
+ uv run --locked bandit -r src
47
+
48
+ Run ``uv lock`` after you change dependencies. Commit ``pyproject.toml`` and
49
+ ``uv.lock`` together. Run ``uv build`` to build the wheel and source distribution.
50
+
51
+ Version bumps
52
+ ^^^^^^^^^^^^^
53
+
54
+ Preview and apply a patch version bump::
55
+
56
+ uv run --locked bump-my-version bump patch --dry-run -v
57
+ uv run --locked bump-my-version bump patch
58
+ uv lock
59
+ uv build
60
+
61
+ The bump updates the project metadata, the package version, the version test,
62
+ and the image tags in this README. Review the changes before you commit them.
63
+
64
+ Containers
65
+ ----------
66
+
67
+ ``Dockerfile`` uses Debian Trixie. ``Dockerfile_alpine`` uses Alpine 3.24.
68
+ Both provide the ``test``, ``tox``, ``devel_shell``, and ``production`` targets.
69
+ Both production images use Python 3.14.
70
+
71
+ Run the container checks with Docker or Podman::
72
+
73
+ CONTAINER_ENGINE=docker ./run_tests.sh
74
+ CONTAINER_ENGINE=podman ./run_tests.sh
75
+
76
+ To check one variant and target, set ``VARIANTS`` and ``TARGETS``::
77
+
78
+ CONTAINER_ENGINE=podman VARIANTS=debian TARGETS=tox ./run_tests.sh
79
+
80
+ The script builds from a copy of the source. It uses the package index by
81
+ default. To add a wheelhouse, set ``WHEELHOUSE_URL``::
82
+
83
+ VARIANTS=debian WHEELHOUSE_URL=http://host.docker.internal:3141/debian/ ./run_tests.sh
84
+
85
+ Use the wheelhouse URL for the selected distribution. The script maps
86
+ ``host.docker.internal`` to the host gateway.
87
+
88
+ Development shell
89
+ ^^^^^^^^^^^^^^^^^
90
+
91
+ Build and start a shell::
92
+
93
+ docker build --target devel_shell -t datastreamcorelib:devel_shell .
94
+ docker run --rm -it datastreamcorelib:devel_shell
95
+
96
+ For Podman, replace ``docker`` with ``podman``. Add ``--format docker`` to
97
+ the build command. Run ``uv run --locked pytest`` inside the shell.
98
+ Rebuild the image to include source edits.
99
+
100
+ Tox
101
+ ^^^
102
+
103
+ Run the tox image with no arguments to test all four Python versions.
104
+ To test one version, pass its tox environment name::
105
+
106
+ docker build --target tox -t datastreamcorelib:tox .
107
+ docker run --rm datastreamcorelib:tox -e py314
108
+
109
+ Production
110
+ ^^^^^^^^^^
111
+
112
+ Build and run an image with the installed library::
113
+
114
+ docker build --target production -t datastreamcorelib:1.8.0 .
115
+ docker run --rm datastreamcorelib:1.8.0
116
+
117
+ The default command prints the package version. Pass a different command to
118
+ use the installed library from another program.
119
+
120
+ Continuous integration
121
+ ----------------------
122
+
123
+ GitLab runs the Python test matrix and builds the wheel and source
124
+ distribution. It also checks all four container targets on Debian and Alpine.
125
+ The container jobs require a privileged Docker-in-Docker runner with shared
126
+ TLS certificates.
@@ -0,0 +1,112 @@
1
+ =================
2
+ datastreamcorelib
3
+ =================
4
+
5
+ Core message types and abstract base classes for ZeroMQ event loop adapters.
6
+
7
+ CI tests Python 3.12, 3.13, 3.14, and 3.15.
8
+
9
+ For an asyncio adapter, see https://gitlab.com/advian-oss/python-datastreamservicelib.
10
+ For a service template, see https://gitlab.com/advian-oss/python-datastreamserviceapp_template.
11
+
12
+ Local development
13
+ -----------------
14
+
15
+ Install uv_. Create the development environment with Python 3.12 to check
16
+ compatibility with the oldest supported version::
17
+
18
+ uv sync --locked --python 3.12
19
+ uv run --locked prek install --install-hooks
20
+ uv run --locked prek run --all-files
21
+ uv run --locked pytest
22
+
23
+ .. _uv: https://docs.astral.sh/uv/getting-started/installation/
24
+
25
+ To change the interpreter, run ``uv sync --locked --python 3.14``.
26
+ The hooks use Ruff for linting and formatting, Pyrefly for type checking,
27
+ and Bandit for security checks. Run each check directly when necessary::
28
+
29
+ uv run --locked ruff check src tests
30
+ uv run --locked ruff format --check src tests
31
+ uv run --locked pyrefly check
32
+ uv run --locked bandit -r src
33
+
34
+ Run ``uv lock`` after you change dependencies. Commit ``pyproject.toml`` and
35
+ ``uv.lock`` together. Run ``uv build`` to build the wheel and source distribution.
36
+
37
+ Version bumps
38
+ ^^^^^^^^^^^^^
39
+
40
+ Preview and apply a patch version bump::
41
+
42
+ uv run --locked bump-my-version bump patch --dry-run -v
43
+ uv run --locked bump-my-version bump patch
44
+ uv lock
45
+ uv build
46
+
47
+ The bump updates the project metadata, the package version, the version test,
48
+ and the image tags in this README. Review the changes before you commit them.
49
+
50
+ Containers
51
+ ----------
52
+
53
+ ``Dockerfile`` uses Debian Trixie. ``Dockerfile_alpine`` uses Alpine 3.24.
54
+ Both provide the ``test``, ``tox``, ``devel_shell``, and ``production`` targets.
55
+ Both production images use Python 3.14.
56
+
57
+ Run the container checks with Docker or Podman::
58
+
59
+ CONTAINER_ENGINE=docker ./run_tests.sh
60
+ CONTAINER_ENGINE=podman ./run_tests.sh
61
+
62
+ To check one variant and target, set ``VARIANTS`` and ``TARGETS``::
63
+
64
+ CONTAINER_ENGINE=podman VARIANTS=debian TARGETS=tox ./run_tests.sh
65
+
66
+ The script builds from a copy of the source. It uses the package index by
67
+ default. To add a wheelhouse, set ``WHEELHOUSE_URL``::
68
+
69
+ VARIANTS=debian WHEELHOUSE_URL=http://host.docker.internal:3141/debian/ ./run_tests.sh
70
+
71
+ Use the wheelhouse URL for the selected distribution. The script maps
72
+ ``host.docker.internal`` to the host gateway.
73
+
74
+ Development shell
75
+ ^^^^^^^^^^^^^^^^^
76
+
77
+ Build and start a shell::
78
+
79
+ docker build --target devel_shell -t datastreamcorelib:devel_shell .
80
+ docker run --rm -it datastreamcorelib:devel_shell
81
+
82
+ For Podman, replace ``docker`` with ``podman``. Add ``--format docker`` to
83
+ the build command. Run ``uv run --locked pytest`` inside the shell.
84
+ Rebuild the image to include source edits.
85
+
86
+ Tox
87
+ ^^^
88
+
89
+ Run the tox image with no arguments to test all four Python versions.
90
+ To test one version, pass its tox environment name::
91
+
92
+ docker build --target tox -t datastreamcorelib:tox .
93
+ docker run --rm datastreamcorelib:tox -e py314
94
+
95
+ Production
96
+ ^^^^^^^^^^
97
+
98
+ Build and run an image with the installed library::
99
+
100
+ docker build --target production -t datastreamcorelib:1.8.0 .
101
+ docker run --rm datastreamcorelib:1.8.0
102
+
103
+ The default command prints the package version. Pass a different command to
104
+ use the installed library from another program.
105
+
106
+ Continuous integration
107
+ ----------------------
108
+
109
+ GitLab runs the Python test matrix and builds the wheel and source
110
+ distribution. It also checks all four container targets on Debian and Alpine.
111
+ The container jobs require a privileged Docker-in-Docker runner with shared
112
+ TLS certificates.
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+ set -eu
3
+ if [ "$#" -gt 0 ]; then
4
+ exec "$@"
5
+ fi
6
+
7
+ uv run --locked docker/prek_init.sh
8
+ uv run --locked pytest --junitxml=pytest.xml tests/
9
+ uv run --locked pyrefly check
10
+ uv run --locked bandit -r src
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ set -eu
3
+ if [ ! -d .git ]; then
4
+ git init
5
+ git checkout -b container-tests
6
+ git add .
7
+ fi
8
+ exec /opt/tox/bin/tox "$@"