Skip to main content

Load configuration from the environment for your python app.

Project description

PyPI version Build Status codecov

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 or pip 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)

Uploaded Source

Built Distribution

python_set_ings-0.2.2-py2.py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 2 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