Skip to content

Commit

Permalink
Switch to tomli instead of toml
Browse files Browse the repository at this point in the history
  • Loading branch information
mgedmin committed Feb 24, 2022
1 parent 19f0a43 commit df7b15d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Changelog

- Add Python 3.10 support.

- Switch to tomli instead of toml, after hearing about PEP-680. tomli will be
included in the Python 3.11 standard library as tomllib, while toml is
apparently unmaintained.


0.47 (2021-09-22)
-----------------
Expand Down
8 changes: 5 additions & 3 deletions check_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from typing import List, Optional, Union
from xml.etree import ElementTree as ET

import toml
import tomli
from setuptools.command.egg_info import translate_pattern


Expand Down Expand Up @@ -699,7 +699,8 @@ def _load_config():
"""
if os.path.exists("pyproject.toml"):
config = toml.load("pyproject.toml")
with open('pyproject.toml', 'rb') as f:
config = tomli.load(f)
if CFG_SECTION_CHECK_MANIFEST in config.get("tool", {}):
return config["tool"][CFG_SECTION_CHECK_MANIFEST]

Expand Down Expand Up @@ -890,7 +891,8 @@ def should_use_pep_517():
# should revert to the legacy behaviour of running setup.py".
if not os.path.exists('pyproject.toml'):
return False
config = toml.load("pyproject.toml")
with open('pyproject.toml', 'rb') as f:
config = tomli.load(f)
if "build-system" not in config:
return False
if "build-backend" not in config["build-system"]:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
install_requires=[
'build>=0.1',
'setuptools',
'toml',
'tomli',
],
extras_require={
'test': [
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ basepython = python3
skip_install = true
deps =
mypy
types-toml
commands = mypy {posargs:check_manifest.py}

[testenv:isort]
Expand Down

0 comments on commit df7b15d

Please sign in to comment.