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

Uploaded Source

Built Distribution

tini-1.0-py2.py3-none-any.whl (3.8 kB view details)

Uploaded Python 2 Python 3

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

Hashes for tini-1.0.tar.gz
Algorithm Hash digest
SHA256 5f7f6a19fe407f8b15e3e064354ff21282cc0b09a511ae3986366459fe4bcb5b
MD5 63f7e10b46410e0b0d6d638ffdefbce3
BLAKE2b-256 ed646e4fcd7cac84b2e6125c4ecddfd1d4cfe47e419a9cb4e642244a2dcd78a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tini-1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6838dd03cbc64daa2ff49ac2b4ffc89690fde69c82f9968004a4edbedcd8fbfe
MD5 b3742fcf14a08a1e9e4e01e6a0c2a6d5
BLAKE2b-256 a9d2c25a3b6e402f72ba3c694dc522c76393c72c8a4be9e9abb91c69a87cb639

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