Skip to main content

Python client for Prefab Feature Flags, Dynamic log levels, and Config as a Service: https://www.prefab.cloud

Project description

prefab-cloud-python

Python client for prefab.cloud, providing Config, FeatureFlags as a Service

Note: This library is under active development

Sign up to be notified about updates

Example usage

from prefab_cloud_python import Client, Options
import prefab_cloud_python

options = Options(
    prefab_api_key="your-prefab-api-key"
)

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


prefab_cloud_python.set_options(options)

result = prefab_cloud_python.get_client().enabled("my-first-feature-flag", context=context)

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

See full documentation https://docs.prefab.cloud/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

prefab_cloud_python-0.10.10.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

prefab_cloud_python-0.10.10-py3-none-any.whl (41.3 kB view details)

Uploaded Python 3

File details

Details for the file prefab_cloud_python-0.10.10.tar.gz.

File metadata

  • Download URL: prefab_cloud_python-0.10.10.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.6.0

File hashes

Hashes for prefab_cloud_python-0.10.10.tar.gz
Algorithm Hash digest
SHA256 563cbe6f624e398c3acf1822011051b831a1d0f4bbdc2d212f057c81aaa599af
MD5 90f5487840f38ee9effbcbd2ed0ea422
BLAKE2b-256 d3c61e2213ebcaa35c428d592bc2e07221f2545dda17b5f761e0d3896aabfb6d

See more details on using hashes here.

File details

Details for the file prefab_cloud_python-0.10.10-py3-none-any.whl.

File metadata

File hashes

Hashes for prefab_cloud_python-0.10.10-py3-none-any.whl
Algorithm Hash digest
SHA256 a1fa912f3b3b5a1507e5520a66871742b69284fe348fe8f31f696c435a08f706
MD5 ab57147024465941efee9c77f599a807
BLAKE2b-256 f2610e840a45b732895ad2f25021b4251c169c7aa9572cf5f3e3749e2976db0f

See more details on using hashes here.

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