Skip to content

Commit e3fdb22

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 d1676a3 commit e3fdb22

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ homepage = "https://github.com/gchamon/sysrsync"
99

1010
[tool.poetry.dependencies]
1111
python = "^3.6"
12-
toml = "^0.10.0"
12+
toml = { version = "^0.10.0", python = "<3.11" }
1313

1414
[tool.poetry.dev-dependencies]
1515
autopep8 = "*"

setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import setuptools
2-
import toml
2+
try:
3+
from tomllib import load # Python 3.11 and later
4+
except ImportError:
5+
from toml import load # Python 3.10 and earlier
36

4-
pyproject = toml.load("pyproject.toml")
7+
with open("pyproject.toml", "rb") as fh:
8+
pyproject = load(fh)
59

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

0 commit comments

Comments
 (0)