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-2.0.0.tar.gz
(3.0 kB
view details)
Built Distribution
File details
Details for the file tini-2.0.0.tar.gz
.
File metadata
- Download URL: tini-2.0.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 740912831b21fadf5a935f86a222cf8c593985999a79bbd73a1b30d888cf5336 |
|
MD5 | 9fc27be4a1480cc8a68b32d8773e4f61 |
|
BLAKE2b-256 | e9a095431e3765f30bdd907956bbd4d16f7a4b6242219c885e82f4a8181491fd |
File details
Details for the file tini-2.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: tini-2.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 | 706e8e6d9f5dec32c36df54f6e47d600dbd3445d100bb8e933e79e4bc9f13766 |
|
MD5 | 8fe4671dfa214f6f4dbcf66c65f43e8f |
|
BLAKE2b-256 | 839413c9a16c960c253d68c259b783e8a3aa6465806552c435f7a008eefb4684 |