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
- Ensure that
poetry
is installed: https://python-poetry.org/docs/#installation - From the root of this directory, run
poetry install
to ensure dependencies are installed 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
- 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
- On a branch
- Update the version in
pyproject.toml
- Update
CHANGELOG.md
- Update the version in
- Merge the branch
git tag <version> && git push --tags
poetry publish --build
- To do this you will need an pypi.org account, and to be added to this project (ask Michael for an invitation)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 563cbe6f624e398c3acf1822011051b831a1d0f4bbdc2d212f057c81aaa599af |
|
MD5 | 90f5487840f38ee9effbcbd2ed0ea422 |
|
BLAKE2b-256 | d3c61e2213ebcaa35c428d592bc2e07221f2545dda17b5f761e0d3896aabfb6d |
File details
Details for the file prefab_cloud_python-0.10.10-py3-none-any.whl
.
File metadata
- Download URL: prefab_cloud_python-0.10.10-py3-none-any.whl
- Upload date:
- Size: 41.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1fa912f3b3b5a1507e5520a66871742b69284fe348fe8f31f696c435a08f706 |
|
MD5 | ab57147024465941efee9c77f599a807 |
|
BLAKE2b-256 | f2610e840a45b732895ad2f25021b4251c169c7aa9572cf5f3e3749e2976db0f |