Engine for evaluating Unleash feature flags
Actively maintained. Last release 5 days ago. A safe choice.
pip install yggdrasil-enginePython Bindings to Yggdrasil
Provides high level bindings to the Unleash Yggdrasil engine.
Implements the engine methods the Python SDK uses.
src/: the Rust part, compiled into the Python moduleyggdrasil_engine.yggdrasil_nativelib.rs: the Python glue around the core engine
python/yggdrasil_engine/: the Python packagetests/: python testsscripts/smoke_test.py: checks an installed wheel; the publish workflow runs it on every platform
Test locally
Rust and Python 3.10 or newer is needed. Run everything from this folder (python-engine/).
The Python tests include the client specification, which they read from the repository root:
git clone --depth 1 --branch v6.1.0 https://github.com/Unleash/client-specification.git ../client-specification
Rust
cargo fmt --check
cargo clippy --all-targets --all-features -- -D warnings
Python
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install --group dev
Then build the engine, with one of the two commands below.
Both turn on the test-helpers cargo feature. It adds test-only functions to the module, which
tests/test_context_reader.py needs. The published wheel is built without it.
While developing: maturin develop
maturin develop --features test-helpers
- compiles the Rust code and puts the module into
python/yggdrasil_engine/; the virtual environment uses this folder directly, so Python changes apply without rebuilding - after changing Rust code, run it again
- debug build by default (faster to compile, slower to run); add
--releasefor an optimised build
Like CI: install the package
MATURIN_PEP517_ARGS="--features test-helpers" python -m pip install .
- builds the package the way the wheel is built (release mode) and installs it into the virtual environment, so the tests run against the installed package
- after changing any code, Rust or Python, run it again