Skip to content

Commit

Permalink
Use tomllib instead of vendored tomli when available
Browse files Browse the repository at this point in the history
This allows unvendoring tomli assuming Python 3.11 or newer
  • Loading branch information
nanonyme committed Jul 17, 2022
1 parent fb949bd commit dba0f31
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions flit_core/flit_core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
from pathlib import Path
import re

from .vendor import tomli
try:
import tomllib
except ImportError:
from .vendor import tomli as tomllib

from .versionno import normalise_version

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -66,7 +70,7 @@ class ConfigError(ValueError):
def read_flit_config(path):
"""Read and check the `pyproject.toml` file with data about the package.
"""
d = tomli.loads(path.read_text('utf-8'))
d = tomllib.loads(path.read_text('utf-8'))
return prep_toml_config(d, path)


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ dependencies = [
"flit_core >=3.7.1",
"requests",
"docutils",
"tomli",
"tomli-w",
]
requires-python = ">=3.6"
Expand All @@ -29,6 +28,7 @@ test = [
"responses",
"pytest>=2.7.3",
"pytest-cov",
"tomli",
]
doc = [
"sphinx",
Expand Down

0 comments on commit dba0f31

Please sign in to comment.