File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change
1
+ Use tomllib from the stdlib if available, rather than tomli
Original file line number Diff line number Diff line change 1
1
import importlib .util
2
2
import os
3
+ import sys
3
4
from collections import namedtuple
4
5
from typing import Any , List , Optional
5
6
6
- from pip ._vendor import tomli
7
+ if sys .version_info >= (3 , 11 ):
8
+ import tomllib
9
+ else :
10
+ from pip ._vendor import tomli as tomllib
11
+
7
12
from pip ._vendor .packaging .requirements import InvalidRequirement , Requirement
8
13
9
14
from pip ._internal .exceptions import (
@@ -61,7 +66,7 @@ def load_pyproject_toml(
61
66
62
67
if has_pyproject :
63
68
with open (pyproject_toml , encoding = "utf-8" ) as f :
64
- pp_toml = tomli .loads (f .read ())
69
+ pp_toml = tomllib .loads (f .read ())
65
70
build_system = pp_toml .get ("build-system" )
66
71
else :
67
72
build_system = None
Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ def vendored(modulename):
111
111
vendored ("rich.text" )
112
112
vendored ("rich.traceback" )
113
113
vendored ("tenacity" )
114
- vendored ("tomli" )
114
+ if sys .version_info < (3 , 11 ):
115
+ vendored ("tomli" )
115
116
vendored ("truststore" )
116
117
vendored ("urllib3" )
You can’t perform that action at this time.
0 commit comments