A declarative config parsing library
Project description
tinyconf
A small library for declarative config interpretation
Installing
- Download
tinyconf pip install .within the folderimport tinyconftinyconf.__version__
Usage
An example usage:
main.py
from tinyconf.deserializers import IniDeserializer
from tinyconf.fields import *
class Config(IniDeserializer):
token = Field(strict=True) # Loads field called 'token'. Fails if not present
client_id = IntegerField('client') # Loads field called 'client'
api_version = Field('apiv', default="8") # Loads field called 'apiv', if not present uses "8"
permitted_users = ListField(map=lambda x: int(x.strip()), default=[], delimiter=";")
config = Config(filename="conf.ini", section="DEFAULT")
assert(config.token == "abcdefghijklmno")
assert(config.client_id == 123456789)
assert(config.api_version == "8")
assert(config.permitted_users == [1111, 2222])
conf.ini
[DEFAULT]
token = "abcdefghijklmno"
client = 123456789
permitted_users = 1111; 2222
Docs
https://tinyconf.readthedocs.io/en/latest/tinyconf.html
Docs can be built with Sphinx in docs folder
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
tinyconf-0.3.0.tar.gz
(4.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tinyconf-0.3.0.tar.gz.
File metadata
- Download URL: tinyconf-0.3.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e3e6499790b3d4ff4b98f205e30ae5fd2fbe7284e05226b741f0ead1bfaba83
|
|
| MD5 |
2416c2f569a09c9f02c56215f770bf17
|
|
| BLAKE2b-256 |
6ec1bbc4faf17ba697ebb9f96328a6c67cf5b411de70c4ad807501028c194bd8
|
File details
Details for the file tinyconf-0.3.0-py3-none-any.whl.
File metadata
- Download URL: tinyconf-0.3.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b04e9b45f41de4668b919851104a858182e6cffb1fe8ea3135bff83f4ab2641a
|
|
| MD5 |
bdf30f9e7cae94007cdf7412ee146630
|
|
| BLAKE2b-256 |
67712d6f721f0894c00a914d1717ed17d94b30fb013e152da99e6ecf41e6c9b8
|