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.5.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.5-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: konfigo-0.0.5.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.5.tar.gz
Algorithm Hash digest
SHA256 6cd120598a3ee9a943fce2bca08552d66c4ba2427e65f38b57b43be47d3c03ea
MD5 8aa85a70f80208b3f5dfc643d0e14a93
BLAKE2b-256 edfce2df2ea8aba8cac4fdfa9453b6177047baca0c2c47e5b990d4644db31f40

See more details on using hashes here.

Provenance

The following attestation bundles were made for konfigo-0.0.5.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.5-py3-none-any.whl.

File metadata

  • Download URL: konfigo-0.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5240f3729967a1088c7f7bcd45c9929be30b6ca41816a952688f700354492039
MD5 0cb292e9bfe41ab473e69a325b59e572
BLAKE2b-256 8cc8e208c66bb016c0147dbb4b2d472d8ab0bbc33ca7dbf21e1ddeb0924dd15c

See more details on using hashes here.

Provenance

The following attestation bundles were made for konfigo-0.0.5-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