Skip to content

Commit 565f687

Browse files
authored
switch away from old "toml" module
1 parent a12a475 commit 565f687

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

docs/conf.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525
import inspect
2626
import os
2727
import sys
28-
import toml
28+
29+
try:
30+
import tomllib
31+
except ImportError:
32+
import tomli as tomllib
2933

3034
this_dir = os.path.dirname(os.path.abspath(__file__))
3135
repo_root = os.path.abspath(os.path.join(this_dir, ".."))
@@ -45,8 +49,8 @@
4549
templates_path = []
4650
source_suffix = ".rst"
4751

48-
with open(os.path.join(repo_root, "pyproject.toml"), "r") as f:
49-
pyproject = toml.load(f)
52+
with open(os.path.join(repo_root, "pyproject.toml"), "rb") as f:
53+
pyproject = tomllib.load(f)
5054

5155
# The master toctree document.
5256
master_doc = "index"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dev = [
3636
"ruff>=0.9.1",
3737
"sphinx>=7.4.7",
3838
"sphinx-rtd-theme>=3.0.2",
39-
"toml>=0.10.2",
39+
"tomli;python_version<'3.11'",
4040
"types-pyyaml>=6.0.12.20241230",
4141
]
4242

0 commit comments

Comments
 (0)