Numerator Python SDK
Quickstart
- Create a subclass of
NumeratorFeatureFlagProviderand define feature flags:
from numerator.config import NumeratorConfig
from numerator.context import SimpleContextProvider
from numerator.feature_flags import NumeratorFeatureFlagProvider
class ExampleFeatureFlagProvider(NumeratorFeatureFlagProvider):
def __init__(self, config: NumeratorConfig):
self.config = config
self.context_provider = SimpleContextProvider()
super().__init__(self.config, self.context_provider)
self.init_feature_flag('basic_boolean_flag', False)
self.init_feature_flag('basic_string_flag', 'Hello World')
def is_basic_feature_enabled(self) -> bool:
return self.get_feature_flag('basic_boolean_flag').value()
def get_string_value_for_context(self, context: dict) -> str:
return self.get_feature_flag('basic_string_flag').value(context)
- Use the above feature flag accessors in code:
feature_flags = ExampleFeatureFlagProvider(config)
if feature_flags.is_basic_feature_enabled():
# feature enabled logic
text = feature_flags.get_string_value_for_context({ 'user': '...' })
else:
# feature disabled logic
Advanced Usage
TODO
Release files for numeratorpy 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| numeratorpy-0.0.3.tar.gz | 7.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| numeratorpy-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.8 kB
Release files / numeratorpy-0.0.3.tar.gz
| Download URL | numeratorpy-0.0.3.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36935ed2f6f6828f24e552dbf0bb8ea31d8100500250ac637c503831afe75288
|
|
BLAKE2b-256 checksum How to use checksums |
c54e41ec956a3a9c317693f7f09f52065f0240f39ad281a278389f27e826f8e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|
Release files / numeratorpy-0.0.3-py3-none-any.whl
| Download URL | numeratorpy-0.0.3-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
15f18eca7a348f0e2771c59540b73ddc29f38ef3ca5fac695e32b61bbbf62a09
|
|
BLAKE2b-256 checksum How to use checksums |
9a9a24e5ce2fe3f172a2e367cc0c2accaa7120e45d0a6e08334d1094a7b437b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.19
|