Skip to main content

Read simple .ini/configuration files.

Project description

tini

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

Uploaded Source

Built Distribution

tini-4.0.0-py2.py3-none-any.whl (3.4 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: tini-4.0.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for tini-4.0.0.tar.gz
Algorithm Hash digest
SHA256 5aafb4c7439834e1e2aceafeab3c3ffa4d26b3b7d07c134c9ff562f599f56908
MD5 24ddf5526a7e6cca919051be5177d516
BLAKE2b-256 59da6dbdaf2bf80e4e19f21dde2f51b5df203b4a3c65f7e1fd11ec4355aeba5a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tini-4.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for tini-4.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cdb3da607abfcacdad4e3ce9dc9cf0cc593e4d4ec2d24229437148804221c5b8
MD5 876d93a3da5f7904eb882c2f0a7e4d11
BLAKE2b-256 91a33de3e42f2d5494e2d9ebf71c9412bfc909bbbd56cfe5642aa72a116ea0ff

See more details on using hashes here.

Supported by

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