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-production-aa5b.up.railway.app",  # 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.1.0

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.1.0
File Size Uploaded Provenance Actions
railflag_openfeature-0.1.0.tar.gz 14.1 kB With provenance Details for railflag_openfeature-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 27.7 kB

Release files / railflag_openfeature-0.1.0.tar.gz

Download URL railflag_openfeature-0.1.0.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1bd9434dc1543616af1d115eb3e4ea60513423dd832ade1619b049aa794dde45
BLAKE2b-256 checksum
How to use checksums
beaab5025a85f395f6f6147f76a4a6cc8e4a05b1efa738a842b3bdf2a9e0e06c
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 17, 2026.

Transparency log

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

Download URL railflag_openfeature-0.1.0-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7f8008cff593a8ac2bcd21ade11a27f0b64e93dceeebb6358cc28ca853609cb
BLAKE2b-256 checksum
How to use checksums
d5ee525744b9f6362f27f9b355b1eadcd22d11b0f62d8cb6c954f9f8628686f2
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 17, 2026.

Transparency log

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

Select from 2 files

Attestation for railflag_openfeature-0.1.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 17, 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