Skip to main content

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_value and get_object_value work as in any OpenFeature provider. A wrong type or unknown flag returns your default with an error code.
  • datetime and date attributes are compared as instants, so before/after rules work with them.
  • api.add_handler(ProviderEvent.PROVIDER_CONFIGURATION_CHANGED, fn) tells you when flags change; details.flags_changed lists them.
  • Server keys can read every rule. Keep them on the server; browsers use the JavaScript SDK with a client key.

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.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for railflag-openfeature 0.2.1
File Size Uploaded Provenance Actions
railflag_openfeature-0.2.1.tar.gz 14.3 kB With provenance Details for railflag_openfeature-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for railflag-openfeature 0.2.1
File Interpreter ABI Platform Actions
railflag_openfeature-0.2.1-py3-none-any.whl Python 3 none any Details for railflag_openfeature-0.2.1-py3-none-any.whl

Total release size: 28.1 kB

Release files / railflag_openfeature-0.2.1.tar.gz

Download URL railflag_openfeature-0.2.1.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1c2d3bae0991c89f2466166467a31287e98ed40083ccce80be257fbb0aca432e
BLAKE2b-256 checksum
How to use checksums
92e4d841ef58030a9e6a4d7903e10c1bf1674b30c5294ea01156b7ee6febcb3a
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 log

Release files / railflag_openfeature-0.2.1-py3-none-any.whl

Download URL railflag_openfeature-0.2.1-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7b8fd4a32c3f4425be9baa59f21a7699526c76c1ac4b0f292777233318b60a6
BLAKE2b-256 checksum
How to use checksums
46fd3d9be58753e2dabd484935b99f863c7c383cb35943a7c8dff685d635cbec
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 log

Security for railflag-openfeature 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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for railflag_openfeature-0.2.1.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 log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page