Skip to content

Commit b11f49d

Browse files
committed
Migrate to PEP 517 build backend
1 parent f8bec2f commit b11f49d

3 files changed

Lines changed: 84 additions & 111 deletions

File tree

pyproject.toml

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,76 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "requests"
7+
description = "Python HTTP for Humans."
8+
readme = "README.md"
9+
license = {text = "Apache-2.0"}
10+
authors = [
11+
{ name = "Kenneth Reitz", email = "me@kennethreitz.org" },
12+
]
13+
maintainers = [
14+
{name = "Ian Stapleton Cordasco", email="graffatcolmingov@gmail.com"},
15+
{name = "Nate Prewitt", email="nate.prewitt@gmail.com"}
16+
]
17+
requires-python = ">=3.9"
18+
dependencies = [
19+
"charset_normalizer>=2,<4",
20+
"idna>=2.5,<4",
21+
"urllib3>=1.21.1,<3",
22+
"certifi>=2017.4.17"
23+
]
24+
dynamic = ["version"]
25+
26+
classifiers = [
27+
"Development Status :: 5 - Production/Stable",
28+
"Environment :: Web Environment",
29+
"Intended Audience :: Developers",
30+
"License :: OSI Approved :: Apache Software License",
31+
"Natural Language :: English",
32+
"Operating System :: OS Independent",
33+
"Programming Language :: Python",
34+
"Programming Language :: Python :: 3",
35+
"Programming Language :: Python :: 3.9",
36+
"Programming Language :: Python :: 3.10",
37+
"Programming Language :: Python :: 3.11",
38+
"Programming Language :: Python :: 3.12",
39+
"Programming Language :: Python :: 3.13",
40+
"Programming Language :: Python :: 3.14",
41+
"Programming Language :: Python :: 3 :: Only",
42+
"Programming Language :: Python :: Implementation :: CPython",
43+
"Programming Language :: Python :: Implementation :: PyPy",
44+
"Topic :: Internet :: WWW/HTTP",
45+
"Topic :: Software Development :: Libraries"
46+
]
47+
48+
[project.urls]
49+
Documentation = "https://requests.readthedocs.io"
50+
Source = "https://github.com/psf/requests"
51+
52+
[project.optional-dependencies]
53+
security = []
54+
socks = ["PySocks>=1.5.6, !=1.5.7"]
55+
use_chardet_on_py3 = ["chardet>=3.0.2,<6"]
56+
test = [
57+
"pytest-httpbin==2.1.0",
58+
"pytest-cov",
59+
"pytest-mock",
60+
"pytest-xdist",
61+
"PySocks>=1.5.6, !=1.5.7",
62+
"pytest>=3"
63+
]
64+
65+
[tool.setuptools]
66+
license-files = ["LICENSE", "NOTICE"]
67+
68+
[tool.setuptools.dynamic]
69+
version = {attr = "requests.__version__.__version__"}
70+
71+
[tool.setuptools.packages.find]
72+
where = ["src"]
73+
174
[tool.ruff]
275
target-version = "py310"
376
src = ["src/requests", "tests"]
@@ -27,4 +100,4 @@ indent-style = "space"
27100
addopts = "--doctest-modules"
28101
doctest_optionflags = "NORMALIZE_WHITESPACE ELLIPSIS"
29102
minversion = "6.2"
30-
testpaths = ["tests"]
103+
testpaths = ["tests"]

setup.cfg

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
[metadata]
2-
license_file = LICENSE
3-
provides-extra =
4-
socks
5-
use_chardet_on_py3
6-
requires-dist =
7-
certifi>=2017.4.17
8-
charset_normalizer>=2,<4
9-
idna>=2.5,<4
10-
urllib3>=1.21.1,<3
1+
[flake8]
2+
ignore = E203, E501, W503
3+
per-file-ignores =
4+
src/requests/__init__.py:E402, F401
5+
src/requests/compat.py:E402, F401
6+
tests/compat.py:F401

setup.py

Lines changed: 4 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,9 @@
1-
#!/usr/bin/env python
2-
import os
31
import sys
4-
from codecs import open
52

6-
from setuptools import setup
7-
8-
CURRENT_PYTHON = sys.version_info[:2]
9-
REQUIRED_PYTHON = (3, 9)
10-
11-
if CURRENT_PYTHON < REQUIRED_PYTHON:
12-
sys.stderr.write(
13-
"""
14-
==========================
15-
Unsupported Python version
16-
==========================
17-
This version of Requests requires at least Python {}.{}, but
18-
you're trying to install it on Python {}.{}. To resolve this,
19-
consider upgrading to a supported Python version.
20-
21-
If you can't upgrade your Python version, you'll need to
22-
pin to an older version of Requests (<2.32.0).
23-
""".format(*(REQUIRED_PYTHON + CURRENT_PYTHON))
24-
)
3+
if sys.version_info < (3, 9):
4+
sys.stderr.write("Requests requires Python 3.9 or later.\n")
255
sys.exit(1)
266

7+
from setuptools import setup
278

28-
# 'setup.py publish' shortcut.
29-
if sys.argv[-1] == "publish":
30-
os.system("python setup.py sdist bdist_wheel")
31-
os.system("twine upload dist/*")
32-
sys.exit()
33-
34-
requires = [
35-
"charset_normalizer>=2,<4",
36-
"idna>=2.5,<4",
37-
"urllib3>=1.21.1,<3",
38-
"certifi>=2017.4.17",
39-
]
40-
test_requirements = [
41-
"pytest-httpbin==2.1.0",
42-
"pytest-cov",
43-
"pytest-mock",
44-
"pytest-xdist",
45-
"PySocks>=1.5.6, !=1.5.7",
46-
"pytest>=3",
47-
]
48-
49-
about = {}
50-
here = os.path.abspath(os.path.dirname(__file__))
51-
with open(os.path.join(here, "src", "requests", "__version__.py"), "r", "utf-8") as f:
52-
exec(f.read(), about)
53-
54-
with open("README.md", "r", "utf-8") as f:
55-
readme = f.read()
56-
57-
setup(
58-
name=about["__title__"],
59-
version=about["__version__"],
60-
description=about["__description__"],
61-
long_description=readme,
62-
long_description_content_type="text/markdown",
63-
author=about["__author__"],
64-
author_email=about["__author_email__"],
65-
url=about["__url__"],
66-
packages=["requests"],
67-
package_data={"": ["LICENSE", "NOTICE"]},
68-
package_dir={"": "src"},
69-
include_package_data=True,
70-
python_requires=">=3.9",
71-
install_requires=requires,
72-
license=about["__license__"],
73-
zip_safe=False,
74-
classifiers=[
75-
"Development Status :: 5 - Production/Stable",
76-
"Environment :: Web Environment",
77-
"Intended Audience :: Developers",
78-
"License :: OSI Approved :: Apache Software License",
79-
"Natural Language :: English",
80-
"Operating System :: OS Independent",
81-
"Programming Language :: Python",
82-
"Programming Language :: Python :: 3",
83-
"Programming Language :: Python :: 3.9",
84-
"Programming Language :: Python :: 3.10",
85-
"Programming Language :: Python :: 3.11",
86-
"Programming Language :: Python :: 3.12",
87-
"Programming Language :: Python :: 3.13",
88-
"Programming Language :: Python :: 3.14",
89-
"Programming Language :: Python :: 3 :: Only",
90-
"Programming Language :: Python :: Implementation :: CPython",
91-
"Programming Language :: Python :: Implementation :: PyPy",
92-
"Topic :: Internet :: WWW/HTTP",
93-
"Topic :: Software Development :: Libraries",
94-
],
95-
tests_require=test_requirements,
96-
extras_require={
97-
"security": [],
98-
"socks": ["PySocks>=1.5.6, !=1.5.7"],
99-
"use_chardet_on_py3": ["chardet>=3.0.2,<6"],
100-
},
101-
project_urls={
102-
"Documentation": "https://requests.readthedocs.io",
103-
"Source": "https://github.com/psf/requests",
104-
},
105-
)
9+
setup()

0 commit comments

Comments
 (0)