Skip to content

Commit 741c1f7

Browse files
committed
build: switch to tomli for TOML v1 compliant parser
Fixes pypa#308 Signed-off-by: Filipe Laíns <[email protected]>
1 parent e6a82a1 commit 741c1f7

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Unreleased
99
- Improved output (`PR #333`_, Fixes `#142`_)
1010
- The CLI now honnors `NO_COLOR`_ (`PR #333`_)
1111
- Added logging to ``build`` and ``build.env`` (`PR #333`_)
12+
- Switch to a TOML v1 compliant parser (`PR #334`_, Fixes `#308`_)
1213

1314

1415
Breaking Changes
@@ -17,7 +18,9 @@ Breaking Changes
1718
- Dropped support for Python 2 and 3.5.
1819

1920
.. _PR #333: https://github.com/pypa/build/pull/333
21+
.. _PR #334: https://github.com/pypa/build/pull/334
2022
.. _#142: https://github.com/pypa/build/issues/142
23+
.. _#308: https://github.com/pypa/build/issues/308
2124
.. _NO_COLOR: https://no-color.org
2225

2326

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ packages = find:
2727
install_requires =
2828
packaging>=19.0
2929
pep517>=0.9.1
30-
toml>=0.10.0
30+
tomli>=1.0.0 # toml can be used instead
3131
colorama;os_name == "nt" # not actually a runtime dependency, only supplied as there is not "recomended dependency" support
3232
importlib-metadata>=0.22;python_version < "3.8"
3333
python_requires = >=3.6

src/build/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@
2020
from typing import AbstractSet, Any, Callable, Dict, Iterator, Mapping, Optional, Sequence, Set, Tuple, Type, Union
2121

2222
import pep517.wrappers
23-
import toml
23+
24+
25+
try:
26+
import tomli as toml
27+
except ModuleNotFoundError:
28+
import toml # type: ignore # pragma: no cover
2429

2530

2631
RunnerType = Callable[[Sequence[str], Optional[str], Optional[Mapping[str, str]]], None]

0 commit comments

Comments
 (0)