Skip to main content

Python SDK for Numerator Feature Management Platform

Project description

Numerator Python SDK

Quickstart

  1. Create a subclass of NumeratorFeatureFlagProvider and 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)
  1. 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

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

numeratorpy-0.0.3.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numeratorpy-0.0.3-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file numeratorpy-0.0.3.tar.gz.

File metadata

  • Download URL: numeratorpy-0.0.3.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for numeratorpy-0.0.3.tar.gz
Algorithm Hash digest
SHA256 36935ed2f6f6828f24e552dbf0bb8ea31d8100500250ac637c503831afe75288
MD5 b5ef91699db1800304d97e5009a1c6e1
BLAKE2b-256 c54e41ec956a3a9c317693f7f09f52065f0240f39ad281a278389f27e826f8e3

See more details on using hashes here.

File details

Details for the file numeratorpy-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: numeratorpy-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for numeratorpy-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 15f18eca7a348f0e2771c59540b73ddc29f38ef3ca5fac695e32b61bbbf62a09
MD5 d2a838a8d56b36c329d0f3580478f19b
BLAKE2b-256 9a9a24e5ce2fe3f172a2e367cc0c2accaa7120e45d0a6e08334d1094a7b437b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page