Skip to content

Commit 0d3bb7a

Browse files
committed
switch to tomli to support toml 1.0, drop py 3.5 and 3.6 support
1 parent 1dcb450 commit 0d3bb7a

File tree

8 files changed

+24
-17
lines changed

8 files changed

+24
-17
lines changed

.github/workflows/tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ jobs:
77
matrix:
88
os: ['ubuntu-20.04']
99
python-version:
10-
- 3.5
11-
- 3.6
1210
- 3.7
1311
- 3.8
1412
- 3.9
15-
- pypy-3.6
1613
- pypy-3.7
1714
- pypy-3.8
1815
- pypy-3.9

nested_diff/cli.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,8 @@ def __init__(self):
440440
"""Initialize dumper."""
441441
super().__init__()
442442

443-
import toml
444-
self.codec = toml
443+
import tomli_w
444+
self.codec = tomli_w
445445

446446
def encode(self, data):
447447
"""Encode data as TOML string."""
@@ -455,8 +455,12 @@ def __init__(self):
455455
"""Initialize loader."""
456456
super().__init__()
457457

458-
import toml
459-
self.codec = toml
458+
if sys.version_info >= (3, 11):
459+
import tomllib # pragma nocover
460+
else:
461+
import tomli as tomllib # pragma nocover
462+
463+
self.codec = tomllib
460464

461465
def decode(self, data):
462466
"""Parse TOML string."""

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
'Programming Language :: Python',
2323
'Programming Language :: Python :: 3',
2424
'Programming Language :: Python :: 3 :: Only',
25-
'Programming Language :: Python :: 3.5',
26-
'Programming Language :: Python :: 3.6',
2725
'Programming Language :: Python :: 3.7',
2826
'Programming Language :: Python :: 3.8',
2927
'Programming Language :: Python :: 3.9',
@@ -49,7 +47,8 @@
4947
extras_require={
5048
'cli': [
5149
'pyyaml',
52-
'toml',
50+
'tomli >= 1.1.0 ; python_version < "3.11"',
51+
'tomli-w >= 1.0.0'
5352
],
5453
},
5554
include_package_data=True,

tests/cli/shared.dict.a.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
[one.two]
2-
three = 4
2+
three = [
3+
{ four = "five" },
4+
]

tests/cli/shared.dict.b.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
[one.two]
2-
three = "four"
2+
three = [
3+
{ four = 5 },
4+
]

tests/cli/shared.dict.patch.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[D.one.D.two.D.three]
2-
N = "four"
3-
O = 4
2+
D = [
3+
{ D = { four = { N = 5, O = "five" } } },
4+
]
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[D.one.D.two.D.three]
2-
N = "four"
3-
O = 4
2+
D = [
3+
{ D = { four = { N = 5, O = "five" } } },
4+
]

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ commands =
99
deps =
1010
pytest
1111
pyyaml
12-
toml
12+
tomli >= 1.1.0 ; python_version < '3.11'
13+
tomli-w >= 1.0.0
1314

1415
setenv =
1516
PYTHONHASHSEED = 1

0 commit comments

Comments
 (0)