Skip to main content

Python sdk for Reforge Feature Flags and Config as a Service: https://www.reforge.com

Project description

reforge-python

Python client for reforge.com, providing Config, FeatureFlags as a Service

Note: This library is under active development

Sign up to be notified about updates

Example usage

from sdk_reforge import ReforgeSDK, Options
import sdk_reforge

options = Options(
    sdk_key="your-reforge-api-key"
)

context = {
  "user": {
    "team_id": 432,
    "id": 123,
    "subscription_level": 'pro',
    "email": "alice@example.com"
  }
}


sdk_reforge.set_options(options)

result = sdk_reforge.get_sdk().enabled("my-first-feature-flag", context=context)

print("my-first-feature-flag is:", result)

Protocol Buffer Types

If you need to work with the underlying Protocol Buffer types, the following are re-exported for convenience:

from sdk_reforge import ConfigValue, StringList, ProtoContext, ContextSet, ContextShape, LogLevel, Json, Schema

# Create a config value
config_value = ConfigValue(string="example value")

# Create a JSON value
json_value = ConfigValue(json=Json(json='{"key": "value"}'))

# Create a Schema value
schema_value = Schema(definition='{"type": "object", "properties": {"name": {"type": "string"}}}')

See full documentation https://docs.reforge.com/docs/sdks/python

Development

  1. Ensure that poetry is installed: https://python-poetry.org/docs/#installation
  2. From the root of this directory, run poetry install to ensure dependencies are installed
  3. poetry run python to open a Python REPL with access to the project dependencies

Running tests

To run all tests, including integration tests

poetry run pytest tests

To run only local tests and skip integration tests

poetry run pytest tests -k "not integration"

To run only one specific test file

poetry run pytest tests/name_of_test_file.py

Examples

There are examples in examples

Releasing

  1. Run pre-commit hooks to check and fix formatting, other rule enforcement. poetry run pre-commit run --show-diff-on-failure --color=always --all-files
  2. On a branch
    1. Update the version in pyproject.toml
    2. Update CHANGELOG.md
  3. Merge the branch
  4. git tag <version> && git push --tags
  5. poetry publish --build
    1. To do this you will need an pypi.org account, and to be added to this project (ask Michael for an invitation)

Project details


Download files

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

Source Distribution

sdk_reforge-0.12.0.tar.gz (35.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sdk_reforge-0.12.0-py3-none-any.whl (44.6 kB view details)

Uploaded Python 3

File details

Details for the file sdk_reforge-0.12.0.tar.gz.

File metadata

  • Download URL: sdk_reforge-0.12.0.tar.gz
  • Upload date:
  • Size: 35.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sdk_reforge-0.12.0.tar.gz
Algorithm Hash digest
SHA256 efbe33f89676a252301fbd9b9ecc6039cd4938fa19300ab4a0286b8c5db8dbca
MD5 16df85bf9b201889df7d87dbc93a3d1e
BLAKE2b-256 04a54afaea6a5f0f3e41d41c2ee3d045f0560a123bbce6e4b0c317b5f3a20e51

See more details on using hashes here.

Provenance

The following attestation bundles were made for sdk_reforge-0.12.0.tar.gz:

Publisher: publish.yml on ReforgeHQ/sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sdk_reforge-0.12.0-py3-none-any.whl.

File metadata

  • Download URL: sdk_reforge-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 44.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sdk_reforge-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd34b1990a51e7f158d6463c47047c8b98947a23167e1d05799d4320930c15e1
MD5 40719601636e7902be83ea89041a2b03
BLAKE2b-256 4a2c039684bb1df4edbcb721ff87fd236a3dbced3f66bc664a16025771e0d4b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for sdk_reforge-0.12.0-py3-none-any.whl:

Publisher: publish.yml on ReforgeHQ/sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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