Skip to main content

No project description provided

Project description

rust_decider

Rust implementation of bucketing, targeting, overrides, and dynamic config logic.

Usage

# In a virtualenv, python >= 3.7
$ pip install -r requirements-dev.txt
$ maturin develop
$ python
import rust_decider

# Init decider
decider = rust_decider.init("darkmode fractional_availability value", "../cfg.json")

# Bucketing needs a context
ctx = rust_decider.make_ctx({"user_id": "8"})

# Get a decision
x = decider.choose("exp_1", ctx)
assert x.err() is None # check for errors
x.decision() # get the variant

# Get a dynamic config value
y = decider.get_map("dc_map", ctx) # fetch a map DC
assert y.err() is None # check for errors
y.val() # get the actual map itself

Development

cd decider-py/ and run maturin develop to build reddit-decider python wheel.

Publishing

Package is automatically published on merge to master to https://pypi.org/project/reddit-decider/ via drone pipeline.

Formatting / Linting

$ cargo fmt    --manifest-path decider-py/test/Cargo.toml
$ cargo clippy --manifest-path decider-py/test/Cargo.toml

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reddit_decider-1.2.24.tar.gz (43.9 kB view hashes)

Uploaded Source

Built Distributions

reddit_decider-1.2.24-cp37-abi3-musllinux_1_1_x86_64.whl (466.6 kB view hashes)

Uploaded CPython 3.7+ musllinux: musl 1.1+ x86-64

reddit_decider-1.2.24-cp37-abi3-manylinux_2_28_x86_64.whl (434.4 kB view hashes)

Uploaded CPython 3.7+ manylinux: glibc 2.28+ x86-64

reddit_decider-1.2.24-cp37-abi3-macosx_11_0_arm64.whl (385.9 kB view hashes)

Uploaded CPython 3.7+ macOS 11.0+ ARM64

reddit_decider-1.2.24-cp37-abi3-macosx_10_7_x86_64.whl (415.7 kB view hashes)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page