Registry / serialization / tini
library4.0.0pypypi✓ verified 84d ago

tini is a lightweight and straightforward Python library designed for reading and parsing simple .ini and configuration files. It provides a dictionary-like interface for accessing sections and keys, with automatic type conversion for common data types. The current version is 4.0.0, and it follows an infrequent release cadence, with major versions tied to significant API changes or Python version support.

pip install tini
INSTALL
IMPORT
SIG · TINI
T
tini
serializationpythonv4.0.0
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Tini
from tini import Tini
from tini import Ini

This quickstart demonstrates how to load an INI file using `tini.Ini`, access sections and keys, and observe automatic type conversions for common types like integers, booleans, and comma-separated lists. It also shows how to use `.get()` with a default value.

import os from tini import Ini # Create a dummy ini file for demonstration config_content = """ [server] host = localhost port = 8080 ssl = True [database] type = postgres user = admin password = mysecret servers = db1,db2,db3 """ config_file_path = "config.ini" with open(config_file_path, "w") as f: f.write(config_content) # Load the configuration config = Ini(config_file_path) # Access values print(f"Server Host: {config['server']['host']}") print(f"Server Port: {config['server']['port']} (type: {type(config['server']['port'])})") print(f"SSL Enabled: {config['server']['ssl']} (type: {type(config['server']['ssl'])})") print(f"Database User: {config['database']['user']}") print(f"Database Servers: {config['database']['servers']} (type: {type(config['database']['servers'])})") # Get a value with a default print(f"API Key (default None): {config['api'].get('key')}") # Clean up the dummy file os.remove(config_file_path)
Debug
Known issues
breakingThe `Ini.read()` and `Ini.save()` methods were renamed to `Ini.load()` and `Ini.dump()` respectively.
fix
Replace `config.read()` with `config.load()` and `config.save()` with `config.dump()`.
affects: 4.0.0 and later
breakingPython 2.7 and Python 3.6 support was dropped.
fix
Ensure your project is running on Python 3.7 or newer. Upgrade your Python environment if necessary.
affects: 4.0.0 and later
gotchatini performs automatic type conversion (int, float, bool, list) for values it recognizes. If you need the raw string value, you must explicitly convert it.
fix
If a raw string is required for a value that might be auto-converted, cast it: `str(config['section']['key'])`.
affects: All versions
gotchaAccessing non-existent sections or keys directly (e.g., `config['missing_section']`) will raise a `KeyError`. Use `.get()` for safer access.
fix
Use the `.get()` method with a default value: `config['section'].get('key', 'default_value')` or `config.get('missing_section', {})`.
affects: All versions
Upgrade
Version history
4.0.0latest on PyPI · released Dec 4, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
tini — pip install tini · libregistry