Skip to main content

Python configs for humans. Using OS environment.

Project description

Python configs for humans.

Using OS environment.

Before you ask - this library doesn't support type-casts and other features. Just env parsing.

How to?

At first, install libary:

pip install betterconf

And... write simple config:

from betterconf import field, Config

class MyConfig(Config):
    my_var = field("my_var")

cfg = MyConfig()
print(cfg.my_var)

Try to run:

my_var=1 python our_file.py

With default values:

from betterconf import field, Config

class MyConfig(Config):
    my_var = field("my_var", default="hello world")

cfg = MyConfig()
print(cfg.my_var)
# hello world

Override values when it's needed (for an example: test cases)

from betterconf import field, Config

class MyConfig(Config):
    my_var = field("my_var", default="hello world")

cfg = MyConfig(my_var="WOW!")
print(cfg.my_var)
# WOW!

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

betterconf-1.1.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

betterconf-1.1-py3-none-any.whl (3.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page