rule-engine-core
Shared domain library for the rule-engine platform, published to PyPI as
rule-engine-core. The three
FastAPI services (metadata_service, position_server, platform_service,
rule_engine) all depend on it.
What's in it
- Expression parser (
parser.py) — recursive-descent parser turning an infix rule/filter expression into aNodetree (! & |, comparisons, arithmetic, parentheses;AND/OR/NOTare accepted as aliases). - Entities —
RuleandFilter(both extendEntityBase) withvalidate()andevaluate()over metadata fields and nested entities. MetadataStore— loads column metadata from a JSON file or over HTTP.- Postgres DAOs —
EntityDao(rules/filters, persisted as pickled objects) andMetadataDao(themetadatatable). DbPool— thread-safe psycopg2 connection pool; one connection per unit of work viawith pool.acquire() as conn:.tracing— lightweightX-Trace-Idpropagation (contextvars + log stamping- thread/pool helpers) shared across services.
Install
pip install rule-engine-core
Build & publish (manual)
setup.py reads its dependencies from $BUILD_PATH/requirements.txt, so
BUILD_PATH must be set.
python -m pip install --upgrade setuptools wheel twine
cd rule-engine-core
BUILD_PATH="$(pwd)" python setup.py sdist bdist_wheel
twine upload dist/*
Releases are normally cut automatically — see .github/workflows/publish.yml,
which publishes to PyPI (then builds the service images) after CI passes on main.
Note on the pickle serialization contract
Rules and filters are stored in Postgres as pickled Python objects, and
entity_dao.py installs sys.modules aliases so older pickles still load.
Renaming/moving core modules or changing EntityBase's pickled fields can break
unpickling of already-stored entities — treat these as a compatibility contract.
Release files for rule-engine-core 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rule_engine_core-0.1.2.tar.gz | 23.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rule_engine_core-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.3 kB
Release files / rule_engine_core-0.1.2.tar.gz
| Download URL | rule_engine_core-0.1.2.tar.gz |
|---|---|
| Size | 23.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b30f39f9111e3814b37466825bafc63fcdb866d18edd775fd96fe43afeb67b7f
|
|
BLAKE2b-256 checksum How to use checksums |
42b69ed9f72f5fd35e9e76d96b3e92f3ee89854128afc9c74a948206ec9faa29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / rule_engine_core-0.1.2-py3-none-any.whl
| Download URL | rule_engine_core-0.1.2-py3-none-any.whl |
|---|---|
| Size | 21.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
41ca2f8981ddd3b24eeb94fd819785fc9ffd1155673b054919ce146907277faa
|
|
BLAKE2b-256 checksum How to use checksums |
6bacece2f7b87665e58f0c9919c7d6ad321f1bfbe6c5c1e902dc573a9845b250
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|