8000 Use `tomllib/tomli` over `toml` (#284) · python/pyperformance@0e745d2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0e745d2

Browse files
authored
Use tomllib/tomli over toml (#284)
1 parent 9641307 commit 0e745d2

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

pyperformance/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ def _is_devel_install():
3434
# This means it creates a link back to the checkout instead
3535
# of copying the files.
3636
try:
37-
import toml
37+
import packaging
3838
except ModuleNotFoundError:
3939
return False
40-
sitepackages = os.path.dirname(os.path.dirname(toml.__file__))
40+
sitepackages = os.path.dirname(os.path.dirname(packaging.__file__))
4141
if os.path.isdir(os.path.join(sitepackages, 'pyperformance')):
4242
return False
4343
if not os.path.exists(os.path.join(sitepackages, 'pyperformance.egg-link')):

pyperformance/_pyproject_toml.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
import packaging.specifiers
1919
import packaging.utils
2020
import packaging.version
21-
import toml
21+
22+
try:
23+
import tomllib
24+
except ImportError:
25+
import tomli as tomllib
2226

2327
from ._utils import check_name
2428

@@ -52,7 +56,7 @@ def parse_pyproject_toml(text, rootdir, name=None, *,
5256
tools=None,
5357
requirefiles=True,
5458
):
55-
data = toml.loads(text)
59+
data = tomllib.loads(text)
5660
unused = list(data)
5761

5862
for section, normalize in SECTIONS.items():

pyperformance/data-files/requirements.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22
# This file is autogenerated by pip-compile with Python 3.11
33
# by the following command:
44
#
5-
# pip-compile --output-file=requirements.txt requirements.in
5+
# pip-compile --output-file=pyperformance/data-files/requirements.txt requirements.in
66
#
7-
packaging==21.3
7+
packaging==23.1
88
# via -r requirements.in
9-
psutil==5.9.0
9+
psutil==5.9.5
1010
# via
1111
# -r requirements.in
1212
# pyperf
13-
pyparsing==3.0.8
14-
# via packaging
1513
pyperf==2.6.0
1614
# via -r requirements.in
17-
toml==0.10.2
18-
# via -r requirements.in

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ classifiers = [
5959
'Programming Language :: Python',
6060
]
6161
requires-python = ">=3.7"
62-
dependencies = ["pyperf", "toml", "packaging"]
62+
dependencies = [
63+
"pyperf",
64+
"tomli; python_version < '3.11'",
65+
"packaging",
66+
]
6367

6468
[project.optional-dependencies]
6569
dev = [

requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pyperf
1313

1414
# for benchmark metadata:
1515
packaging
16-
toml
16+
tomli; python_version < '3.11'
1717

1818

1919
# Optional dependencies

0 commit comments

Comments
 (0)
0