Skip to content

Commit 50e3c50

Browse files
authored
Merge pull request #11909 from SpecLad/project-table
Migrate project metadata to `pyproject.toml`
2 parents 92dd553 + 21c7cb4 commit 50e3c50

File tree

4 files changed

+69
-78
lines changed

4 files changed

+69
-78
lines changed

news/11909.process.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Most project metadata is now defined statically via pip's ``pyproject.toml`` file.

pyproject.toml

+66-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,72 @@
1+
[project]
2+
dynamic = ["version", "scripts"]
3+
4+
name = "pip"
5+
description = "The PyPA recommended tool for installing Python packages."
6+
readme = "README.rst"
7+
license = {text = "MIT"}
8+
classifiers = [
9+
"Development Status :: 5 - Production/Stable",
10+
"Intended Audience :: Developers",
11+
"License :: OSI Approved :: MIT License",
12+
"Topic :: Software Development :: Build Tools",
13+
"Programming Language :: Python",
14+
"Programming Language :: Python :: 3",
15+
"Programming Language :: Python :: 3 :: Only",
16+
"Programming Language :: Python :: 3.7",
17+
"Programming Language :: Python :: 3.8",
18+
"Programming Language :: Python :: 3.9",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: Implementation :: CPython",
23+
"Programming Language :: Python :: Implementation :: PyPy",
24+
]
25+
authors = [
26+
{name = "The pip developers", email = "[email protected]"},
27+
]
28+
29+
# NOTE: requires-python is duplicated in __pip-runner__.py.
30+
# When changing this value, please change the other copy as well.
31+
requires-python = ">=3.7"
32+
33+
[project.urls]
34+
Homepage = "https://pip.pypa.io/"
35+
Documentation = "https://pip.pypa.io"
36+
Source = "https://github.com/pypa/pip"
37+
Changelog = "https://pip.pypa.io/en/stable/news/"
38+
139
[build-system]
2-
requires = ["setuptools", "wheel"]
40+
# The lower bound is for <https://github.com/pypa/setuptools/issues/3865>.
41+
requires = ["setuptools>=67.6.1", "wheel"]
342
build-backend = "setuptools.build_meta"
443

44+
[tool.setuptools]
45+
package-dir = {"" = "src"}
46+
include-package-data = false
47+
48+
[tool.setuptools.dynamic]
49+
version = {attr = "pip.__version__"}
50+
51+
[tool.setuptools.packages.find]
52+
where = ["src"]
53+
exclude = ["contrib", "docs", "tests*", "tasks"]
54+
55+
[tool.setuptools.package-data]
56+
"pip" = ["py.typed"]
57+
"pip._vendor" = ["vendor.txt"]
58+
"pip._vendor.certifi" = ["*.pem"]
59+
"pip._vendor.requests" = ["*.pem"]
60+
"pip._vendor.distlib._backport" = ["sysconfig.cfg"]
61+
"pip._vendor.distlib" = [
62+
"t32.exe",
63+
"t64.exe",
64+
"t64-arm.exe",
65+
"w32.exe",
66+
"w64.exe",
67+
"w64-arm.exe",
68+
]
69+
570
[tool.towncrier]
671
# For finding the __version__
772
package = "pip"

setup.py

+1-76
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,13 @@
1-
import os
21
import sys
32

4-
from setuptools import find_packages, setup
5-
6-
7-
def read(rel_path: str) -> str:
8-
here = os.path.abspath(os.path.dirname(__file__))
9-
# intentionally *not* adding an encoding option to open, See:
10-
# https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690
11-
with open(os.path.join(here, rel_path)) as fp:
12-
return fp.read()
13-
14-
15-
def get_version(rel_path: str) -> str:
16-
for line in read(rel_path).splitlines():
17-
if line.startswith("__version__"):
18-
# __version__ = "0.9"
19-
delim = '"' if '"' in line else "'"
20-
return line.split(delim)[1]
21-
raise RuntimeError("Unable to find version string.")
22-
23-
24-
long_description = read("README.rst")
3+
from setuptools import setup
254

265
setup(
27-
name="pip",
28-
version=get_version("src/pip/__init__.py"),
29-
description="The PyPA recommended tool for installing Python packages.",
30-
long_description=long_description,
31-
license="MIT",
32-
classifiers=[
33-
"Development Status :: 5 - Production/Stable",
34-
"Intended Audience :: Developers",
35-
"License :: OSI Approved :: MIT License",
36-
"Topic :: Software Development :: Build Tools",
37-
"Programming Language :: Python",
38-
"Programming Language :: Python :: 3",
39-
"Programming Language :: Python :: 3 :: Only",
40-
"Programming Language :: Python :: 3.7",
41-
"Programming Language :: Python :: 3.8",
42-
"Programming Language :: Python :: 3.9",
43-
"Programming Language :: Python :: 3.10",
44-
"Programming Language :: Python :: 3.11",
45-
"Programming Language :: Python :: 3.12",
46-
"Programming Language :: Python :: Implementation :: CPython",
47-
"Programming Language :: Python :: Implementation :: PyPy",
48-
],
49-
url="https://pip.pypa.io/",
50-
project_urls={
51-
"Documentation": "https://pip.pypa.io",
52-
"Source": "https://github.com/pypa/pip",
53-
"Changelog": "https://pip.pypa.io/en/stable/news/",
54-
},
55-
author="The pip developers",
56-
author_email="[email protected]",
57-
package_dir={"": "src"},
58-
packages=find_packages(
59-
where="src",
60-
exclude=["contrib", "docs", "tests*", "tasks"],
61-
),
62-
package_data={
63-
"pip": ["py.typed"],
64-
"pip._vendor": ["vendor.txt"],
65-
"pip._vendor.certifi": ["*.pem"],
66-
"pip._vendor.requests": ["*.pem"],
67-
"pip._vendor.distlib._backport": ["sysconfig.cfg"],
68-
"pip._vendor.distlib": [
69-
"t32.exe",
70-
"t64.exe",
71-
"t64-arm.exe",
72-
"w32.exe",
73-
"w64.exe",
74-
"w64-arm.exe",
75-
],
76-
},
776
entry_points={
787
"console_scripts": [
798
"pip=pip._internal.cli.main:main",
809
f"pip{sys.version_info[0]}=pip._internal.cli.main:main",
8110
"pip{}.{}=pip._internal.cli.main:main".format(*sys.version_info[:2]),
8211
],
8312
},
84-
zip_safe=False,
85-
# NOTE: python_requires is duplicated in __pip-runner__.py.
86-
# When changing this value, please change the other copy as well.
87-
python_requires=">=3.7",
8813
)

tests/unit/test_network_auth.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ def __call__(
406406
stdin: Optional[Any] = None,
407407
stdout: Optional[Any] = None,
408408
input: Optional[bytes] = None,
409-
check: Optional[bool] = None
409+
check: Optional[bool] = None,
410410
) -> Any:
411411
if cmd[1] == "get":
412412
assert stdin == -3 # subprocess.DEVNULL

0 commit comments

Comments
 (0)