Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Latest commit

 

History

History
109 lines (78 loc) · 2.36 KB

README.md

File metadata and controls

109 lines (78 loc) · 2.36 KB

Status PyPi Python 3.6+ MIT Coverage

twelvefactor

Utilities for creating a 12 factor application, at present it allows you to parse the processes environment variables into a configuration dictionary.

For more information check the Documentation.

Installing

Install using poetry

poetry add twelvefactor

Install using pipenv

pip install twelvefactor

Install using pip

pip install twelvefactor

Example

Flask

import flask
import twelvefactor

SCHEMA = {
    'DEBUG': {
        'type': bool,
        'default': False,
    },
    'SECRET_KEY': str,
}

app = flask.Flask()
app.config.update(twelvefactor.config(SCHEMA))

Django

# settings.py
import dj_database_url
import twelvefactor

SCHEMA = {
    "DEBUG": {"type": bool, "default": False},
    "SECRET_KEY": str,
    "DATABASES": {
        "key": "DATABASE_URL",
        "default": "sqlite:///",
        "mapper": lambda v: {"default": dj_database_url.parse(v)},
    },
}

globals().update(twelvefactor.config(SCHEMA))

Source

To install from source:

pip install poetry
git clone git://github.com/artisanofcode/python-twelvefactor.git
cd python-twelvefactor
poetry develop

Release

Update CHANGES and then run the following

poetry version patch
git commit -am 'bumped the version'
git tag v${VERSION}
poetry version prerelease
git commit -am 'prerelease version'
git push --tags

History

See CHANGES

Licence

This project is licensed under the MIT licence.

Meta

This project uses Semantic Versioning.