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.1.tar.gz
(3.0 kB
view details)
Built Distribution
File details
Details for the file tini-3.0.1.tar.gz
.
File metadata
- Download URL: tini-3.0.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f856780a90e7a3cdf3aaea56cb8c176fc5f4f8e1d126362cb88ca104f835d99f |
|
MD5 | 1ed4c89560a0d5c7df81a55e2740c6ff |
|
BLAKE2b-256 | 179fc62f805b94613c9ea1bb16af6b7f7a1fe2baded5eec0c6ab4861e2851f93 |
File details
Details for the file tini-3.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: tini-3.0.1-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 | 8062be51e6766c15ec402579fff422d8c2fb46bdb3f0b22bd009f32d8dd79c81 |
|
MD5 | f759ad33b8e15c0c0269ed6ea968d592 |
|
BLAKE2b-256 | 2312db6dc903040bf7e3b86514bc4352d1aab1432db09a27bd36251bd000d2fc |