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-1.0.tar.gz
(2.6 kB
view details)
Built Distribution
File details
Details for the file tini-1.0.tar.gz
.
File metadata
- Download URL: tini-1.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f7f6a19fe407f8b15e3e064354ff21282cc0b09a511ae3986366459fe4bcb5b |
|
MD5 | 63f7e10b46410e0b0d6d638ffdefbce3 |
|
BLAKE2b-256 | ed646e4fcd7cac84b2e6125c4ecddfd1d4cfe47e419a9cb4e642244a2dcd78a0 |
File details
Details for the file tini-1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: tini-1.0-py2.py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6838dd03cbc64daa2ff49ac2b4ffc89690fde69c82f9968004a4edbedcd8fbfe |
|
MD5 | b3742fcf14a08a1e9e4e01e6a0c2a6d5 |
|
BLAKE2b-256 | a9d2c25a3b6e402f72ba3c694dc522c76393c72c8a4be9e9abb91c69a87cb639 |