Skip to content

Commit b240469

Browse files
In Python 3.11 and later, use tomllib instead of toml
This removes the dependency on toml for Python versions that have tomllib in the standard library.
1 parent a601c29 commit b240469

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools", "toml"]
2+
requires = ["setuptools", "toml; python_version < '3.11'"]
33

44
[tool]
55
[tool.poetry]
@@ -12,7 +12,7 @@ homepage = "https://github.com/gchamon/sysrsync"
1212

1313
[tool.poetry.dependencies]
1414
python = "^3.6"
15-
toml = "^0.10.0"
15+
toml = { version = "^0.10.0", python = "<3.11" }
1616

1717
[tool.poetry.dev-dependencies]
1818
autopep8 = "*"

setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
"""Setup script for sysrsync."""
22
import setuptools
3-
import toml
3+
try:
4+
from tomllib import load # Python 3.11 and later
5+
except ImportError:
6+
from toml import load # Python 3.10 and earlier
47

5-
pyproject = toml.load("pyproject.toml")
8+
with open("pyproject.toml", "rb") as fh:
9+
pyproject = load(fh)
610

711
with open("README.md", "r") as fh:
812
long_description = fh.read()

0 commit comments

Comments
 (0)