This guide describes how to build, run, test, lint, and statically analyze the first-party code in this repository. InstantX is primarily a deployment-and-integration project: an off-the-shelf broker/observability stack orchestrated with docker-compose, glued together by first-party Python services and scripts plus an Apache NiFi flow.
First-party Python lives in:
deployment/eventPublisher— the Flask Event Publisher API.deployment/kafka_speed_exporter— a Prometheus exporter.deployment/nifi/nifi-scripts— the NiFi encoder/decoder scripts (Poetry project, with the test suite).
The full platform is built and run with Docker Compose. All commands run from deployment/:
# Build images and start the stack
docker-compose up --build -d
# Start without rebuilding
docker-compose up -d
# Tear down
docker-compose downThe NiFi scripts package is a standard Poetry project:
cd deployment/nifi/nifi-scripts
poetry install # installs runtime + dev dependenciespoetry.lock is committed, so poetry install is reproducible and GitHub's dependency graph
can resolve exact versions for this directory. Requires Poetry 2.x
(pipx install 'poetry>=2.0,<3.0'). After changing dependencies, run poetry lock and commit
the result — CI's poetry-lock job runs poetry check --lock and fails if the two drift apart.
The package supports Python >=3.9, matching the runtime images
(eventPublisher and
kafka_speed_exporter both build on
python:3.9-slim). Two dev tools have since dropped 3.9, so the dev group declares a version
per interpreter range and you get different versions depending on your local Python:
| Tool | Python 3.9 | Python 3.10+ |
|---|---|---|
pytest |
8.4.x | 9.1.x |
bandit |
1.8.x | 1.9.x |
Both are minor-version differences in the tooling only — they do not affect the code under test.
CI runs ruff and bandit on Python 3.12 via a plain pip install, independently of Poetry.
The Event Publisher uses a pinned requirements.txt:
cd deployment/eventPublisher
pip install -r requirements.txtAll build and analysis tools used here are free/libre and open source (Docker, Poetry, pytest, ruff, bandit).
The first-party automated test suite uses pytest and lives in the NiFi scripts package:
cd deployment/nifi/nifi-scripts
poetry run pytest # run the suite
poetry run pytest -s --cov=src --cov-report=xml # with coverageMajor new functionality must be accompanied by automated tests, and bug fixes should add a regression test where practical. This policy is stated in CONTRIBUTING.md and reinforced by a checklist item in the pull request template.
Python code is linted with ruff. The shared configuration lives in
deployment/nifi/nifi-scripts/pyproject.toml under [tool.ruff].
Run it across all first-party Python from the repository root:
ruff check \
deployment/eventPublisher \
deployment/kafka_speed_exporter \
deployment/nifi/nifi-scripts \
--config deployment/nifi/nifi-scripts/pyproject.tomlruff is available as a Poetry dev dependency in the NiFi scripts package (poetry run ruff ...) or as a standalone tool (pipx install ruff / uvx ruff).
Python code is scanned for common security issues with bandit before each major release:
bandit -r \
deployment/eventPublisher \
deployment/kafka_speed_exporter \
deployment/nifi/nifi-scripts/srcbandit is available as a Poetry dev dependency in the NiFi scripts package (poetry run bandit ...) or standalone (pipx install bandit). Findings of medium severity or higher are addressed (fixed or, where a finding is a false positive, suppressed with a justifying comment) before release.
poetry run pytestpasses (add/update tests for your change).ruff check ... --config deployment/nifi/nifi-scripts/pyproject.tomlreports no errors.bandit -r ...reports no unaddressed medium-or-higher findings.- Update CHANGELOG.md for user-facing changes.