1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
diff --git a/changelogd/config.py b/changelogd/config.py
index 8ed72ae..f05da05 100644
--- a/changelogd/config.py
+++ b/changelogd/config.py
@@ -7,8 +7,12 @@ import typing
from copy import deepcopy
from pathlib import Path
+try:
+ import tomllib
+except:
+ import tomli as tomllib
+
import click
-import toml
from ruamel.yaml import YAML # type: ignore
from ruamel.yaml.comments import CommentedMap # type: ignore
@@ -64,8 +68,8 @@ DEFAULT_CONFIG.insert(
def load_toml(path: Path) -> typing.Optional[str]:
if not path.is_file():
return None
- with path.open() as file_handle:
- config = toml.load(file_handle)
+ with path.open('rb') as file_handle:
+ config = tomllib.load(file_handle)
return config.get("tool", {}).get("changelogd", {}).get("config") # type:ignore
diff --git a/noxfile.py b/noxfile.py
index bbcd8ed..9bb6d21 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -17,7 +17,7 @@ def flake8(session):
@nox.session
def mypy(session):
- session.install("mypy", "types-toml", "types-click", "types-jinja2")
+ session.install("mypy", "types-click", "types-jinja2")
session.run("mypy", "changelogd")
diff --git a/setup.py b/setup.py
index 0619b7d..715c7a3 100644
--- a/setup.py
+++ b/setup.py
@@ -15,7 +15,7 @@ with open("HISTORY.rst") as history_file:
requirements = [
"Click>=8.1.7",
"Jinja2>=3.1.3",
- "toml>=0.10.2",
+ "tomli;python_version<'3.11'",
"ruamel.yaml>=0.18.6",
]
|