Skip to main content

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)

Protocol Buffer Types

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

from prefab_cloud_python 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.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)

Metadata

Release files for prefab-cloud-python 0.12.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 prefab-cloud-python 0.12.1
File Size Uploaded
prefab_cloud_python-0.12.1.tar.gz 37.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prefab-cloud-python 0.12.1
File Interpreter ABI Platform
prefab_cloud_python-0.12.1-py3-none-any.whl Python 3 none any Details

Total release size: 86.6 kB

Release files / prefab_cloud_python-0.12.1.tar.gz

Download URL prefab_cloud_python-0.12.1.tar.gz
Size 37.9 kB
Tags Source
SHA-256 checksum
How to use checksums
eaf9bcfa053b8aefe5e14a5de50e83f9b6572af1ab3253056f5c12b9f43f7eaf
BLAKE2b-256 checksum
How to use checksums
dcc8c65d5eaaac82a86ba73bd38fb66652d406d588265b57f4eb8415ed5c5c07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 20, 2025.

Transparency log

Release files / prefab_cloud_python-0.12.1-py3-none-any.whl

Download URL prefab_cloud_python-0.12.1-py3-none-any.whl
Size 48.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bcc8b3884ca49cc81371ff4a880ed2465efcc3b7d6a5ddce40ac4fb10a22dc97
BLAKE2b-256 checksum
How to use checksums
2bc44cf1f79ed7d8c454915222d10df096b0e087c0a9340542fd9722e25e3b59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 20, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.12.1 This release

2 release files

0.12.0

2 release files

0.11.4

2 release files

0.11.3

2 release files

0.11.2

2 release files

0.11.1

2 release files

0.10.9

2 release files

0.10.3

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

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