Registry / serialization / toml
library0.10.2pypypi✓ verified 26d ago

A Python library for parsing and creating TOML (Tom's Obvious, Minimal Language) files. Current version: 0.10.2. Maintained with regular updates.

pip install toml
INSTALL
IMPORT
SIG · TOML
T
toml
serializationpythonv0.10.2
Install
1.6s avg
Import
10ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.10.2 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.010s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.010s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

loads
from toml import loads
import toml

A comprehensive example demonstrating parsing and generating TOML data using the 'toml' library.

import toml toml_string = ''' # This is a TOML document. title = "TOML Example" [owner] name = "Tom Preston-Werner" dob = 1979-05-27T07:32:00-08:00 # First class dates [database] server = "192.168.1.1" ports = [ 8001, 8001, 8002 ] connection_max = 5000 enabled = true [servers] # Indentation (tabs and/or spaces) is allowed but not required [servers.alpha] ip = "10.0.0.1" dc = "eqdc10" [servers.beta] ip = "10.0.0.2" dc = "eqdc10" [clients] data = [ ["gamma", "delta"], [1, 2] ] # Line breaks are OK when inside arrays hosts = [ "alpha", "omega" ] ''' parsed_toml = toml.loads(toml_string) new_toml_string = toml.dumps(parsed_toml) print(new_toml_string)
Debug
Known issues
breakingIn version 0.10.0, the 'load' function was removed. Use 'loads' for strings and 'load' for file objects.
fix
Replace 'load' with 'loads' for strings and 'load' for file objects.
affects: >=0.10.0
gotchaEnsure 'toml' is imported before using its functions like 'loads', 'dumps', and 'dump'.
fix
Always import 'toml' at the beginning of your script.
affects: all
Upgrade
Version history
0.10.2latest on PyPI · released Nov 1, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
1
Resources
toml — pip install toml · libregistry