Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace third-party tomlkit with stdlib tomllib #201

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
python-version: ["3.11", "3.12", "3.13"]
os: [ubuntu-latest]

steps:
Expand Down
12 changes: 6 additions & 6 deletions build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
from urllib.parse import urljoin

import jinja2
import tomlkit
import tomllib
import urllib3
import zc.lockfile

Expand Down Expand Up @@ -915,7 +915,7 @@ def should_rebuild(self):
def load_state(self) -> dict:
state_file = self.build_root / "state.toml"
try:
return tomlkit.loads(state_file.read_text(encoding="UTF-8"))[
return tomllib.loads(state_file.read_text(encoding="UTF-8"))[
f"/{self.language.tag}/{self.version.name}/"
]
except (KeyError, FileNotFoundError):
Expand All @@ -928,9 +928,9 @@ def save_state(self, build_duration: float):
"""
state_file = self.build_root / "state.toml"
try:
states = tomlkit.parse(state_file.read_text(encoding="UTF-8"))
states = tomllib.parse(state_file.read_text(encoding="UTF-8"))
except FileNotFoundError:
states = tomlkit.document()
states = tomllib.document()

state = {}
state["cpython_sha"] = self.cpython_repo.run("rev-parse", "HEAD").stdout.strip()
Expand All @@ -941,7 +941,7 @@ def save_state(self, build_duration: float):
state["last_build"] = dt.now(timezone.utc)
state["last_build_duration"] = build_duration
states[f"/{self.language.tag}/{self.version.name}/"] = state
state_file.write_text(tomlkit.dumps(states), encoding="UTF-8")
state_file.write_text(tomllib.dumps(states), encoding="UTF-8")


def symlink(
Expand Down Expand Up @@ -1092,7 +1092,7 @@ def parse_versions_from_devguide(http: urllib3.PoolManager) -> list[Version]:

def parse_languages_from_config() -> list[Language]:
"""Read config.toml to discover languages to build."""
config = tomlkit.parse((HERE / "config.toml").read_text(encoding="UTF-8"))
config = tomllib.parse((HERE / "config.toml").read_text(encoding="UTF-8"))
languages = []
defaults = config["defaults"]
for iso639_tag, section in config["languages"].items():
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
jinja2
sentry-sdk>=2
tomlkit
urllib3>=2
zc.lockfile
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires =
tox>=4.2
env_list =
lint
py{313, 312, 311, 310}
py{313, 312, 311}

[testenv]
package = wheel
Expand Down