Skip to main content

Python client SDK for Konfigo Realtime Config

Project description

Konfigo Python SDK

Python PyPI Typed CI/CD Version License: MIT

Python client SDK for Konfigo Realtime Config. It mirrors the .NET SDK concepts:

  • config groups and keys are declared with decorators;
  • class/key schemas are discovered and sent to the backend as a version;
  • config values are stored as string entries with per-key generations;
  • stale and equal-generation updates are ignored;
  • subscription events with generation 1 are treated as initial state and do not overwrite the already loaded snapshot.

Install

pip install -e .

For the gRPC adapter, install the grpc extra — the service_pb2 / service_pb2_grpc modules are pre-generated from protos/service.proto and ship with the package:

pip install -e ".[grpc]"

Declaring Options

from dataclasses import dataclass
from konfigo import config_group, config_key


@config_group(key="Payments", group_name="Payments", description="Payment gateway")
@dataclass
class PaymentsOptions:
    provider: str = config_key(default_value="Stripe")
    timeout_seconds: int = config_key(default_value="30")

Runtime Usage

from konfigo import KonfigoClient, RealtimeConfigOptions, bind_config, discover_definitions
from konfigo.grpc_transport import GrpcRealtimeConfigTransport

options = RealtimeConfigOptions(
    is_enabled=True,
    service_id="orders",
    version="1.0.0",
    url="realtime-config.internal:443",
)

transport = GrpcRealtimeConfigTransport(options.url)
definitions = discover_definitions(PaymentsOptions)
client = await KonfigoClient.create(
    options=options,
    transport=transport,
    definitions=definitions,
)

task = client.start_background_task()

payments = bind_config(client.store.snapshot(), PaymentsOptions)

Framework integrations can subscribe to client.store.subscribe(...) and rebind dataclasses when values change.

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

konfigo-0.0.6.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

konfigo-0.0.6-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file konfigo-0.0.6.tar.gz.

File metadata

  • Download URL: konfigo-0.0.6.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for konfigo-0.0.6.tar.gz
Algorithm Hash digest
SHA256 a56736a280fca73210a069af6ebe190661c6ab73a6835c97667fee4ab94a9bd3
MD5 a6a9876d0a86cae4986b9c0dc7c630b6
BLAKE2b-256 f269253051a88ee29453eef8fe404f9020c0aa8e973083849c7e818917dd5333

See more details on using hashes here.

Provenance

The following attestation bundles were made for konfigo-0.0.6.tar.gz:

Publisher: ci.yml on maximiliysiss/konfigo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file konfigo-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: konfigo-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for konfigo-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a17096e9c3a92941d531e71fbc93efcacf4c22afbe10f873613779c2ae830deb
MD5 53b6842f6d45b7a9cf24edb905c284f9
BLAKE2b-256 eed8fb00e71634c8ae28bf0500415efb907b94744499428e88b33a161be4b386

See more details on using hashes here.

Provenance

The following attestation bundles were made for konfigo-0.0.6-py3-none-any.whl:

Publisher: ci.yml on maximiliysiss/konfigo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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