Skip to main content

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.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

tini-1.1.0-py2.py3-none-any.whl (4.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file tini-1.1.0.tar.gz.

File metadata

  • Download URL: tini-1.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tini-1.1.0.tar.gz
Algorithm Hash digest
SHA256 1f2e1d7b323832d7ccc3c43ab971d9720317405641b14eb51f79a3c1a35c58c2
MD5 f455e4219468c8ec5c8f881dcbd742a1
BLAKE2b-256 a65f267312a810e75c81d5c419b123351c6b62bb313a3ba018c9ed99932b19c9

See more details on using hashes here.

File details

Details for the file tini-1.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for tini-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 43a5d000f161d1779c3c60c33ec5e563b87b7abf948afbadbecad031c13e17df
MD5 82569d7071a111ad6a971b41d4df982c
BLAKE2b-256 05569944daeb5629778e1569ed0567c8adc7257bd5902c719024ef7500a36a13

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page