Skip to content

Commit 467c13c

Browse files
authored
switch to tomli for toml fallback (#108)
1 parent 89b6727 commit 467c13c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
packaging
22
setuptools
3-
toml>=0.10.2; python_version<"3.11"
3+
tomli>=2.0.1; python_version<"3.11"

setuptools_git_versioning.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,10 @@ def _read_toml(name_or_path: str | os.PathLike = "pyproject.toml", root: str | o
181181
with file_path.open("rb") as file:
182182
parsed_file = tomllib.load(file)
183183
except (ImportError, NameError):
184-
import toml # type: ignore[no-redef]
184+
import tomli
185185

186-
parsed_file = toml.load(file_path)
186+
with file_path.open("rb") as file:
187+
parsed_file = tomli.load(file)
187188

188189
result = parsed_file.get("tool", {}).get("setuptools-git-versioning", None)
189190
if result:

0 commit comments

Comments
 (0)