Skip to content

Commit deff0ae

Browse files
committed
Use tomllib instead of tomli
Inspired by typeshed PR: python/typeshed#14486 Since CI only uses Python 3.13, I don't see the point in maintaining compatibility with 3.9 and 3.10.
1 parent b7060ec commit deff0ae

4 files changed

Lines changed: 5 additions & 6 deletions

File tree

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# scripts
22
packaging
33
requests < 2.30.0
4-
tomli
54

65
# build and upload
76
build

stub_uploader/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import sys
22

3-
assert sys.version_info >= (3, 9)
3+
assert sys.version_info >= (3, 11)

stub_uploader/metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
import re
77
import tarfile
88
import tempfile
9+
import tomllib
910
import urllib.parse
1011
from collections.abc import Generator, Iterable
1112
from glob import glob
1213
from pathlib import Path
1314
from typing import Any, Optional
1415

1516
import requests
16-
import tomli
1717
from packaging.requirements import Requirement
1818
from packaging.specifiers import InvalidSpecifier, Specifier
1919

@@ -150,7 +150,7 @@ def read_metadata(typeshed_dir: str, distribution: str) -> Metadata:
150150
assert not distribution.startswith(TYPES_PREFIX)
151151
path = os.path.join(typeshed_dir, THIRD_PARTY_NAMESPACE, distribution, META)
152152
with open(path, "rb") as f:
153-
data = tomli.load(f)
153+
data = tomllib.load(f)
154154
return Metadata(distribution=distribution, data=data)
155155

156156

stub_uploader/ts_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
from pathlib import Path
1111
import re
1212
import subprocess
13+
import tomllib
1314

1415
from packaging.requirements import Requirement
1516
from packaging.version import Version
16-
from tomli import load as toml_load
1717

1818
REQUIREMENTS = "requirements-tests.txt"
1919
PYPROJECT = "pyproject.toml"
@@ -37,7 +37,7 @@ def read_current_commit(self) -> str:
3737

3838
def read_typeshed_data(typeshed_path: Path) -> TypeshedData:
3939
with (typeshed_path / PYPROJECT).open("rb") as f:
40-
pyproject = toml_load(f)
40+
pyproject = tomllib.load(f)
4141
with (typeshed_path / REQUIREMENTS).open() as f:
4242
requirements = parse_requirements(f)
4343
typeshed_table = pyproject["tool"]["typeshed"]

0 commit comments

Comments
 (0)