Skip to main content

asynchronous configuration provider ( tailored to support dynamic client-server relations)

Project description

fakts

codecov PyPI version Maintenance Maintainer PyPI pyversions PyPI status PyPI download day

DEVELOPMENT

Inspiration

Fakts was designed to make configuration of apps compatible with concurrency pattern, it is designed to allow for asynchronous retrieval of configuration from various sources, may it be a config file, environmental variables or a remote server.

Core Design

Fakts uses Grants to obtain configuration asynchronously, a grant is a way of retrieving the configuration from a specific source. It can be a local config file (eg. yaml, toml, json), environemnt variables, a remote configuration (eg. from a fakts server), a database. The fakts class then wraps the grant to ensure both a sychronous and asychronous interface that is threadsafe.

Grants are designed to be composable through MetaGrants so by desigining a specifc grant structure, one can highly customize the retrieval logic. Please check out the

Example:

async with Fakts(grant=YamlGrant("config.yaml")) as fakts:
    config = await fakts.aget("group_name")

or

with Fakts(grant=YamlGrant("config.yaml")) as fakts:
    config = fakts.get("group_name")

Fakts should be used as a context manager, and will set the current fakts context variable to itself, letting you access the current fakts instance from anywhere in your code (async or sync) without specifically passing a referece. To understand how the async sync code access work, please check out the documentation for koil.

Composability

You can compose grants through meta grants in order to load configuration from multiple sources (eg. a local, file that can be overwritten by a remote configuration, or some envionment variables).

Example:

async with Fakts(grant=FailsafeGrant(
    grants=[
        EnvGrant(),
        YamlGrant("config.yaml")
    ]
)) as fakts:
    config = await fakts.get("group_name")

In this example fakts will load the configuration from the environment variables first, and if that fails, it will load it from the yaml file.

Special Use Case: Dynamic Server Relations

Fakts provides the remote grant protocol for retrieval of configuration in dynamic client-server relationships. With these grants you provide a software manifest for a configuration server (fakts-server), that then grants the configuration (either through user approval (similar to device code grant)). These grants are mainly used to setup or claim an oauth2 application on the backend securely that then can be used to identify the application in the future. These grants are at the moment highly specific to the arkitekt platform and subject to change.

Sister packages

These packages provide contrib modules to support auto configuration through a fakts instance

  • herre: oauth2 client
  • rath: graphql client (typed through turms)

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

fakts-0.3.37.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

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

fakts-0.3.37-py3-none-any.whl (29.7 kB view details)

Uploaded Python 3

File details

Details for the file fakts-0.3.37.tar.gz.

File metadata

  • Download URL: fakts-0.3.37.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.6 Linux/6.2.0-32-generic

File hashes

Hashes for fakts-0.3.37.tar.gz
Algorithm Hash digest
SHA256 f501aec288e3d481b99d3b49a759d724e5eee220396a30deed37dd29e78ead3d
MD5 89f07ae299300a40d297025ba2a571c6
BLAKE2b-256 1498a24dfb640b2978c5d660e01446809e1e3907af35f81f8bff99d7eb1f1396

See more details on using hashes here.

File details

Details for the file fakts-0.3.37-py3-none-any.whl.

File metadata

  • Download URL: fakts-0.3.37-py3-none-any.whl
  • Upload date:
  • Size: 29.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.6 Linux/6.2.0-32-generic

File hashes

Hashes for fakts-0.3.37-py3-none-any.whl
Algorithm Hash digest
SHA256 b8b92bb134e05fca948f287c85ffbeb7c5282463b292de4daca288e38f97e642
MD5 c840533508238fba147633cf3ecd9400
BLAKE2b-256 f21c37547ff737cecce0de38a96e31cc69c26115ea73e969e5358ef73caf4fbb

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