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.
identity—CurrentUser, header parsing,require_admin, and theapp_user/user_account_accesslookup; framework-neutral identity primitives 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.
Release order for consumer services
Every service installs this package from PyPI, so a change here is invisible to them until it's published. When a service needs new core API:
- Bump
versioninsetup.py. - Build and
twine upload. - Then bump the
rule-engine-core>=<version>floor in that service'srequirements.txtandpyproject.toml.
Until step 2 lands, a service PR carrying a raised floor fails at pip install and its CI
goes red. That's the point — it's the reminder to publish, and it beats an ImportError
in prod. So publish before merging the consumer.
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.
Docker
-> psql --username=$POSTGRES_USER -d $POSTGRES_DB
Metadata
Release files for rule-engine-core 0.2.1
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 |
|---|---|---|---|---|
| rule_engine_core-0.2.1.tar.gz | 28.2 kB | Without provenance | Details for rule_engine_core-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rule_engine_core-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for rule_engine_core-0.2.1-py3-none-any.whl |
Total release size: 52.7 kB
Release files / rule_engine_core-0.2.1.tar.gz
| Download URL | rule_engine_core-0.2.1.tar.gz |
|---|---|
| Size | 28.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9eeb414ff97c4bf30d083bd8644e0066da1177f2796d23e21a6f6f1ebdf2264
|
|
BLAKE2b-256 checksum How to use checksums |
589aea60393e415f3e65467b47718171b3ac6b248e853e899e86ea45b18a9d32
|
| 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.2.1-py3-none-any.whl
| Download URL | rule_engine_core-0.2.1-py3-none-any.whl |
|---|---|
| Size | 24.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c2895eae4aefb9bed6ce8ea3017156725618a6436ea5d16f179c0cc12748604
|
|
BLAKE2b-256 checksum How to use checksums |
25c4f9df10e64c12b4a8183cdfc709d34fad80d09fc15cb5343038e072d68401
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Security for rule-engine-core 0.2.1
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.