Skip to main content

Configuration parameter handling library

Project description

uncouple

uncouple provides a Pydantic-based interface on top of python-decouple for managing configurations, incuding out of the box support for parsing network addresses, YAML data and more.

Installation

Install uncouple using pip:

pip install uncouple

Synopsis

from uncouple import Config, StringList, Addr, YarlUrl
from pathlib import Path


class OptionsConfig(Config):
    TIMEOUT: int
    WHITELIST: StringList
    LOG_PATH: Path


class AppConfig(Config):
    NAME: str = 'my-default-name'
    REMOTE_ADDR: Addr
    API_URL: YarlUrl
    OPTIONS: OptionsConfig


# With environment as:
#
# APP_REMOTE_ADDR=localhost:1234
# APP_API_URL=http://api.example.com:1234/foo
# APP_OPTIONS_TIMEOUT=60
# APP_OPTIONS_WHITELIST=john,paul,george,ringo
# APP_OPTIONS_LOG_PATH=/var/logs/app
#
config = AppConfig.load(prefix='APP')

# Accessing configuration values
config.NAME  # 'my-default-name', from default
config.REMOTE_ADDR  # Addr(host='localhost', port=1234)
config.API_URL  # yarl.URL('http://api.example.com:1234/foo')
config.OPTIONS.TIMEOUT  # 60
config.OPTIONS.WHITELIST  # ['john', 'paul', 'george', 'ringo']
config.OPTIONS.LOG_PATH  # Path('/var/logs/app')

Contributing

Contributions to uncouple are welcome! Please follow the standard GitHub pull request workflow. Make sure to add unit tests for any new or changed functionality and ensure your code passes existing tests.

For bug reports, feature requests, or general inquiries, please open an issue.


This template provides a foundation for the README. Depending on the package's complexity and additional functionalities not covered in the snippet, you might need to expand on certain sections or add new ones, such as "Advanced Usage", "API Reference", or "Troubleshooting".

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

uncouple-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

uncouple-0.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file uncouple-0.1.0.tar.gz.

File metadata

  • Download URL: uncouple-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.11.10 Darwin/23.4.0

File hashes

Hashes for uncouple-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c41c14239ef6c94e1ec061462ea6ccab047e83f567d510097bfe55468aeac24f
MD5 51bcf190e648e4e8cc6614bcaa57e2bf
BLAKE2b-256 f13f16340ba8217b2e69034fcfa6382918357f6601b5063133364a5c1c8c13cb

See more details on using hashes here.

File details

Details for the file uncouple-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: uncouple-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.11.10 Darwin/23.4.0

File hashes

Hashes for uncouple-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e910a881d58a19b22e2fbdccf3038ee860f3b73639130b76fe69f11e0256caf7
MD5 c2c719eb0fedcba641b368d417bb9c0a
BLAKE2b-256 18eba363fe4fcba8b03f81d078812412d63540b7936d6f043a26c3ae3a91ab1f

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