Skip to main content

Configure-Tron

https://img.shields.io/pypi/v/configuretron.svg https://img.shields.io/travis/channelcat/configuretron.svg Documentation Status Updates

Configuretron enables type hinted configuration files and secrets for python. Easily add secrets to your configuration that are encryptable from clients and decryptable from trusted developers and running services.

Features

  • Type-hinted configuration

  • Simple, readable YAML configs

  • Config in source control

  • Secrets safely in source control

  • Easily swap environments

  • Control who can encrypt and decrypt

Installation

$ python -m pip install configuretron

Usage

config.yml

config:
    api_url: https://apitopia.com/api/v1
    api_timeout: 20

config.py

@dataclass
class Config:
    api_url: str
    api_timeout: int = 30

config = configuretron.from_yaml(Config, "config.yml")

Adding Secrets

Adding encryption just takes a few console commands

$ python -m configuretron --yaml=config.yml setup_encryption

Copy the generated base64 private key into an environment variable (in this example, PRIVATE_KEY)

Encrypt and variables in the config (in this example, api_token):

$ python -m configuretron --yaml=config.yml encrypt --key api_token

Then pass the key to the config

private_key = configuretron.env_base64_value('PRIVATE_KEY')
config = configuretron.from_yaml(Config, "config.yml", private_key=private_key)

Environmental overrides

To override values per-environment, add them into the config like so:

config:
    api_url: http://localhost:8080/api/v1
    api_timeout: 20
env:
    prod:
        config:
            api_url: https://apitopia.com/api/v1

Then just pass env when initializing the configuration:

config = configuretron.from_yaml(Config, "config.yml", env="prod")

TODO Features

  • Config heirarchy

  • Type validation

  • Multiple layered configs

History

0.1.0 (2022-12-22)

  • First release on PyPI.

Metadata

Release files for configuretron 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for configuretron 0.3.0
File Size Uploaded Provenance
configuretron-0.3.0.tar.gz 17.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for configuretron 0.3.0
File Interpreter ABI Platform
configuretron-0.3.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 25.2 kB

Release files / configuretron-0.3.0.tar.gz

Download URL configuretron-0.3.0.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
183390aed14af72fe23516c9bf48a892cd0793c3edc64adefe2b9f04bdd96b04
BLAKE2b-256 checksum
How to use checksums
e2f130549d5857b0a8655ab24522ce8f9aafc6f67c6a9d733df050019c1f22d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / configuretron-0.3.0-py2.py3-none-any.whl

Download URL configuretron-0.3.0-py2.py3-none-any.whl
Size 8.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
71a90714371b91c0b7f2d62d32ccfba9cf3a58f7fec6c42aedb86bc0f3b12de7
BLAKE2b-256 checksum
How to use checksums
29cc5b451cf5f54e9e7ee3a91a2edd7f1539ed4af4f1aa4307ccdb8cf061d950
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Security for configuretron 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page