polidoro-config 1.0.1

Creator: railscoder56

Last updated:

Add to Cart

Description:

polidoroconfig 1.0.1

Polidoro Config
Polidoro Config it is a configuration manager for you project































Python Versions








Basic Usage
Create a class inheriting from ConfigBase
from pconfig import ConfigBase

class Config(ConfigBase):
DB_HOST = 'localhost'
ENVIRONMENT = 'development'
...

When the class is instantiated will load from environment variables.
# script.py
from pconfig import ConfigBase

class Config(ConfigBase):
MY_VAR = 'default_value'

print(Config.MY_VAR)

>>> python script.py
default_value

>>> MY_VAR="new_value" python script.py
new_value

If you have the python-dotenv installed will load the .env automatically.
Also, you can load from a .yaml file setting the file path in the Config class:
# script.py
from pconfig import ConfigBase

class Config(ConfigBase):
file_path = "my_config.yml"
MY_VAR = 'default_value'

For more information see the Documentation

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.