Granula: Multi-file Configurations for Python Applications
Granula is a tool that aims to help maintain multi-file configurations for Python applications (with environments and more).
Installation
$ pipenv install granula
or just use pip (though you should definitely take a look at pipenv)
🌈🌈🌈
Features
Gathers configurations from multiple files or directories.
Supports widely used file formats (YAML, JSON).
Offers a small DSL that allows to load environment variables into config files.
Manages different configuration environments (e.g. testing, production).
Usage
Create a config object from a directory with multiple configuration files:
>> import granula
>> config = granula.Config.from_directory('examples/multi-file/settings')
>> config
Config({'name': 'Darth Vader', ...})
>> config.name
'Darth Vader'
>> config.family
Config({'fiancee': 'Padme Amidala', 'children': ['Luke Skywalker', 'Leia Organa']})
Files are parsed in lexicographic order. The values specified in the preceding files can be overwritten in the succeeding files.
Do the same in a recursive manner:
>> config = granula.Config.from_directory(..., recursive=True)
Match YAML files using filename pattern:
>> config = granula.Config.from_directory(..., pattern=granula.Extension('yaml'))
Do the same with a shell-style wildcard pattern:
>> config = granula.Config.from_directory(..., pattern=granula.Wildcard('*.yaml'))
Match configuration files for different environments:
>> directory = 'examples/environments/settings'
>> testing = granula.Config.from_directory(directory, pattern=granula.Environment('testing'))
>> production = granula.Config.from_directory(directory, pattern=granula.Environment('production'))
Combine patterns in arbitrary ways:
>> pattern = granula.All(granula.Environment('testing'), granula.Extension('yaml'))
>> config = granula.Config.from_directory(..., pattern=pattern)
Load environment variables into config files using a DSL, for example, in YAML:
variable: ${env VARIABLE}
Do the same with a default value:
variable: ${env VARIABLE | val 10}
Metadata
Release files for granula 2018.2.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| granula-2018.2.8.tar.gz | 16.7 kB | Without provenance | Details for granula-2018.2.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| granula-2018.2.8-py3-none-any.whl | Python 3 | none | any | Details for granula-2018.2.8-py3-none-any.whl |
Total release size: 43.2 kB
Release files / granula-2018.2.8.tar.gz
| Download URL | granula-2018.2.8.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
195e49368934710b1ac9b62df0d72504d90ff0915eb32e35171e70ff67aeacc1
|
|
BLAKE2b-256 checksum How to use checksums |
9f112216c2e4062e907d009d5316a524d5a3d5f1c2ead2d490fb6e02d66a3ed9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / granula-2018.2.8-py3-none-any.whl
| Download URL | granula-2018.2.8-py3-none-any.whl |
|---|---|
| Size | 26.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0414111c511ddb30fecb1cdc458862f73075dda3591821a32d62c5ae0c928ac4
|
|
BLAKE2b-256 checksum How to use checksums |
edb698a44a2c6bcde90d4255e2b7881b92b21c2a3adc2ee9902dc1d3bed33e44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for granula 2018.2.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.