railflag-openfeature
Railflag's OpenFeature provider for Python 3.10+. It downloads your environment's flag config once,
evaluates every flag check in process (about 15 µs, no network call), and picks up changes within a
second over Server-Sent Events. If the stream drops it polls every 30 s, and if Railflag can't be
reached it keeps serving the last config it had. The only dependency is openfeature-sdk.
import os
from openfeature import api
from openfeature.evaluation_context import EvaluationContext
from railflag import RailflagProvider
api.set_provider_and_wait(RailflagProvider(
sdk_key=os.environ["RAILFLAG_SERVER_KEY"], # a server key: Environments → keys
base_url="https://relay.railflag.com", # required: your Railflag relay
))
client = api.get_client()
if client.get_boolean_value("new-checkout", False, EvaluationContext("user-42", {"plan": "pro", "country": "GR"})):
...
get_boolean_value,get_string_value,get_integer_value,get_float_valueandget_object_valuework as in any OpenFeature provider. A wrong type or unknown flag returns your default with an error code.datetimeanddateattributes are compared as instants, sobefore/afterrules work with them.api.add_handler(ProviderEvent.PROVIDER_CONFIGURATION_CHANGED, fn)tells you when flags change;details.flags_changedlists them.- Server keys can read every rule. Keep them on the server; browsers use the JavaScript SDK with a client key.
- Once a minute the provider sends how many times each flag returned each variation, for Release Watch. It sends counts only, such as
{"new-checkout": {"1": 42}}, and never contexts or user ids. Sending runs on a background thread and never delays a flag check. Turn it off withsend_exposures=False.
Same answers as every other SDK
railflag/evaluate.py is a port of packages/eval. The tests run it against
packages/eval/vectors/eval-vectors.json (hashes, buckets and thousands of evaluations generated by
the TypeScript evaluator), so a user lands in the same variation whichever SDK evaluates the flag.
Context values follow JavaScript rules: 1 and True are different, numbers print as JavaScript
prints them, and strings sort by UTF-16 code units.
Known differences: regexes in matches rules run on Python's re (with ASCII \d/\w), and a
date-time without a time zone is read as UTC.
Development
uv sync
uv run pytest
SY_EMAIL=... SY_PASSWORD=... uv run python examples/live_check.py # against production; rotates the Development server key
Metadata
Release files for railflag-openfeature 0.3.0
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 |
|---|---|---|---|---|
| railflag_openfeature-0.3.0.tar.gz | 15.7 kB | With provenance | Details for railflag_openfeature-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| railflag_openfeature-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for railflag_openfeature-0.3.0-py3-none-any.whl |
Total release size: 31.3 kB
Release files / railflag_openfeature-0.3.0.tar.gz
| Download URL | railflag_openfeature-0.3.0.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68a8bf041a6f90295e91547915bcc897fbf9b708a2aa7c3b2df08657ce92bacd
|
|
BLAKE2b-256 checksum How to use checksums |
8e8d785167709a95b0bdc9754b41d4a60ed7a75d64966ad02a45ca4c239ab18a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logRelease files / railflag_openfeature-0.3.0-py3-none-any.whl
| Download URL | railflag_openfeature-0.3.0-py3-none-any.whl |
|---|---|
| Size | 15.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca1ea7564b2bf208710b8f1aa642dd49b60459cd9344129e745fd3f2fddb1e42
|
|
BLAKE2b-256 checksum How to use checksums |
92e8e38a8b5db3b574ede7ce2a62ccdf32669c3bc67a79b082293c59ff5c49b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logSecurity for railflag-openfeature 0.3.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for railflag_openfeature-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logA 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.