Read simple .ini/configuration files.
Project description
A simple module for loading .ini-style configuration files.
Based on ConfigParser and works in Python 2 and Python 3.
Running tests
$ py.test
Or, with tox (test with multiple Python versions):
$ tox
Example
settings.py
import os
import sys
from tini import Tini
filenames = [
'./foobar.ini',
os.path.join(os.path.expanduser('~'), '.foobar.ini'),
os.path.join(os.path.expanduser('~'), '.config', '.foobar.ini'),
]
defaults = {
'foobar': {
'baz': 'a string',
'buzz': True,
'bizz': 123,
}
}
sys.modules[__name__] = Tini(filenames, defaults=defaults)
foobar.ini
[foobar] buzz = false
test.py
import settings
assert settings.foobar['baz'] == 'a string'
assert settings.foobar['buzz'] is False
assert settings.foobar['baz'] == 123
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
tini-3.0.0.tar.gz
(3.0 kB
view details)
Built Distribution
File details
Details for the file tini-3.0.0.tar.gz
.
File metadata
- Download URL: tini-3.0.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ba96d8ba9a2681f90ab64a11e6a2c1400a8539c426038cb6f9994c9d944d7f4 |
|
MD5 | a2bf29ac694fca0ad26a69c67dea78f7 |
|
BLAKE2b-256 | 473305d034e12ae58faac0a76557dd8acd6df81f21eb46b37420553689d1ab0b |
File details
Details for the file tini-3.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: tini-3.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1852ef2f3bef941a8a23decb9de57b86fc466be3b355ed69fe389dc468bb1b54 |
|
MD5 | b4f045a393b5d235d280fcd35b0829f6 |
|
BLAKE2b-256 | ca307516082318f3d57a4080a907c72003283e67165d0df9639267ad103b8a04 |