Load configuration from the environment for your python app.
Project description
DEPRECATED
This package is deprecated. pydantic provides the same featureset and much more.
Python set-ings
Load configuration from the environment for your python app. Supports typecasting and default values. Settings are made available in a way which plays nicely with IDEs and is easy to read.
Installation
pipenv install python-set-ings
orpip install python-set-ings
Usage
# my_app/settings.py
from set_ings import Property
from set_ings import Settings as SettingsBase
Settings(SettingsBase):
_PREFIX = 'YOUR_PREFIX'
FOO = Property(10, cast=int)
BAR = Property()
settings = Settings()
Then make sure you set the environment variables defined in your settings.
For the example above you would have to set YOUR_PREFIX_BAR
and optionally
YOUR_PREFIX_FOO
.
To use the settings anywhere in your app:
from my_app.settings import settings
print(settings.FOO + 2)
Contributing
Installation
git clone git@github.com:evocount/python-set-ings.git
cd python-set-ings
pipenv install --dev
Running tests
pipenv run pytest --cov
License
This project is licensed under the MIT License.
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
python-set-ings-0.2.2.tar.gz
(4.5 kB
view hashes)
Built Distribution
Close
Hashes for python_set_ings-0.2.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb8a0c1d5e3b57456cfd0f1255556cf392f5dc3376fe4fba8e7ea97c7b47f58d |
|
MD5 | 72609b0a2b24dbbfb6ed7146db8f9eff |
|
BLAKE2b-256 | 3942160fcd04534f26e55c9ab032cf566e85b215d831c42860b1399d4d0436b1 |