Skip to content
Utilities for creating a 12 factor application
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
examples
tests
.gitignore
.readthedocs.yml
.travis.yml
CHANGES
Dockerfile
LICENSE
Makefile
README.md
docker-compose.yml
poetry.lock
pyproject.toml
twelvefactor.py

README.md

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.

You can’t perform that action at this time.