Skip to main content

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

Release files for tini 4.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tini 4.0.0
File Size Uploaded
tini-4.0.0.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tini 4.0.0
File Interpreter ABI Platform
tini-4.0.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 6.8 kB

Release files / tini-4.0.0.tar.gz

Download URL tini-4.0.0.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5aafb4c7439834e1e2aceafeab3c3ffa4d26b3b7d07c134c9ff562f599f56908
BLAKE2b-256 checksum
How to use checksums
59da6dbdaf2bf80e4e19f21dde2f51b5df203b4a3c65f7e1fd11ec4355aeba5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.0

Release files / tini-4.0.0-py2.py3-none-any.whl

Download URL tini-4.0.0-py2.py3-none-any.whl
Size 3.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
cdb3da607abfcacdad4e3ce9dc9cf0cc593e4d4ec2d24229437148804221c5b8
BLAKE2b-256 checksum
How to use checksums
91a33de3e42f2d5494e2d9ebf71c9412bfc909bbbd56cfe5642aa72a116ea0ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.0

Release history Release notifications | RSS feed

This release

4.0.0 This release

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page