Skip to content
A TOML-0.4.0 parser/writer for Python.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
pytoml Fix incorrectly stripped new-lines at the beginning of strings (issue #… Jul 21, 2019
test Update tests Jul 21, 2019
.gitignore Add .vscode and .pytest_cache to .gitignore Sep 9, 2018
.gitmodules Use a fork of the official toml-test repo for tests. Jul 19, 2015
.travis.yml Add Python 3.7 to TravisCI test matrix Oct 21, 2018
LICENSE Include README in the distribution. Jun 30, 2018 Document that the project is not being maintained Dec 30, 2018
dev-requirements.txt Use py.test to run additional tests May 7, 2017
setup.cfg Distribute package as a universal wheel Dec 30, 2018 Bump version to 0.1.21 Jul 21, 2019
tox.ini Drop support for Python 3.4 Oct 21, 2018

PyPI Build Status


The pytoml project is no longer being actively maintained. Consider using the toml package instead.


This project aims at being a specs-conforming and strict parser and writer for TOML files. The library currently supports version 0.4.0 of the specs and runs with Python 2.7+ and 3.5+.


pip install pytoml

The interface is the same as for the standard json package.

>>> import pytoml as toml
>>> toml.loads('a = 1')
{'a': 1}
>>> with open('file.toml', 'rb') as fin:
...     obj = toml.load(fin)
>>> obj
{'a': 1}

The loads function accepts either a bytes object (that gets decoded as UTF-8 with no BOM allowed), or a unicode object.

Use dump or dumps to serialize a dict into TOML.

>>> print toml.dumps(obj)
a = 1


To run the tests update the toml-test submodule:

git submodule update --init --recursive

Then run the tests:

python test/
You can’t perform that action at this time.