DeployRamp SDK - Feature flag management for Python
Project description
DeployRamp Python SDK
Python SDK for DeployRamp — AI-native feature flag management with gradual rollouts, real-time updates, and automatic error-monitored rollbacks.
Installation
pip install deployramp
Quick Start
import deployramp
deployramp.init(deployramp.SdkConfig(
public_token="drp_pub_your_token",
traits={"plan": "pro", "region": "us-east"},
))
# Evaluate a feature flag
if deployramp.flag("new-checkout-flow"):
process_new_checkout()
else:
process_old_checkout()
# Report errors — DeployRamp uses these to auto-roll back bad deploys
try:
process_checkout()
except Exception as e:
deployramp.report(e, flag_name="new-checkout-flow")
deployramp.close()
Trait-Based Targeting
import deployramp
deployramp.init(deployramp.SdkConfig(public_token="drp_pub_your_token"))
# Update traits after login
deployramp.set_traits({"plan": "enterprise", "cohort": "beta"})
# Override traits for a single evaluation
enabled = deployramp.flag("beta-feature", trait_overrides={"cohort": "alpha"})
Measure Performance
Track how each flag branch performs across your user population:
import deployramp
result = deployramp.measure(
"fast-algorithm",
enabled_fn=lambda: new_algorithm(data),
disabled_fn=lambda: old_algorithm(data),
)
API Reference
init(config: SdkConfig) -> None
Initialize the SDK. Fetches flags and opens a WebSocket for real-time updates.
flag(name: str, trait_overrides: dict | None = None) -> bool
Evaluate a feature flag. Returns False if the SDK is not initialized or the flag is unknown/disabled.
set_traits(traits: dict[str, str]) -> None
Replace the current traits used for flag evaluation.
measure(name: str, enabled_fn, disabled_fn, trait_overrides: dict | None = None)
Run the appropriate branch and report execution time to DeployRamp.
report(error: Exception | str, flag_name: str | None = None, trait_overrides: dict | None = None) -> None
Report an error to DeployRamp for automatic rollback monitoring.
close() -> None
Flush pending evaluations and close connections.
SdkConfig
@dataclass
class SdkConfig:
public_token: str # Required. Your public token from deployramp.com
base_url: str = "https://flags.deployramp.com"
traits: dict[str, str] = field(default_factory=dict)
Requirements
- Python 3.10+
websockets >= 12.0
Links
License
MIT
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deployramp-0.1.7.tar.gz.
File metadata
- Download URL: deployramp-0.1.7.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3838f466d9210a1af36f045ddf14709d636b38b543747f09e55a30ffc51bc0f0
|
|
| MD5 |
9eb558bea347a01a6b50cc7287265c02
|
|
| BLAKE2b-256 |
e4f5135e2be02a0318d8c22607a284fc5381c710ddc1a65e0cacc198debae4c6
|
Provenance
The following attestation bundles were made for deployramp-0.1.7.tar.gz:
Publisher:
sdk-release-python.yml on deployramp/deployramp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deployramp-0.1.7.tar.gz -
Subject digest:
3838f466d9210a1af36f045ddf14709d636b38b543747f09e55a30ffc51bc0f0 - Sigstore transparency entry: 1280889430
- Sigstore integration time:
-
Permalink:
deployramp/deployramp@03b8ce4b0ddcd1c9083086e37fae711d51334777 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/deployramp
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
sdk-release-python.yml@03b8ce4b0ddcd1c9083086e37fae711d51334777 -
Trigger Event:
push
-
Statement type:
File details
Details for the file deployramp-0.1.7-py3-none-any.whl.
File metadata
- Download URL: deployramp-0.1.7-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6b857e93743ac1d687a8210d7b613e5bf6a7148a4046b203626681f01ef450e
|
|
| MD5 |
85fa6791923128196914768d05b95393
|
|
| BLAKE2b-256 |
e01e3f4655538bfbbea9fa93c1e0cb52319fa395ba699408ae3185fbb0e46dfa
|
Provenance
The following attestation bundles were made for deployramp-0.1.7-py3-none-any.whl:
Publisher:
sdk-release-python.yml on deployramp/deployramp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deployramp-0.1.7-py3-none-any.whl -
Subject digest:
a6b857e93743ac1d687a8210d7b613e5bf6a7148a4046b203626681f01ef450e - Sigstore transparency entry: 1280889432
- Sigstore integration time:
-
Permalink:
deployramp/deployramp@03b8ce4b0ddcd1c9083086e37fae711d51334777 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/deployramp
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
sdk-release-python.yml@03b8ce4b0ddcd1c9083086e37fae711d51334777 -
Trigger Event:
push
-
Statement type: