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

Rely on backend build path and bootstrap metadata to easily build from source #2582

Merged
merged 10 commits into from
Feb 28, 2021
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ include launcher.c
include msvc-build-launcher.cmd
include pytest.ini
include tox.ini
exclude pyproject.toml # Temporary workaround for #1644.
2 changes: 2 additions & 0 deletions bootstrap.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Name: setuptools-bootstrap
Version: 1.0
14 changes: 14 additions & 0 deletions bootstrap.egg-info/entry_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[distutils.commands]
egg_info = setuptools.command.egg_info:egg_info

[distutils.setup_keywords]
include_package_data = setuptools.dist:assert_bool
install_requires = setuptools.dist:check_requirements
extras_require = setuptools.dist:check_extras
entry_points = setuptools.dist:check_entry_points

[egg_info.writers]
PKG-INFO = setuptools.command.egg_info:write_pkg_info
dependency_links.txt = setuptools.command.egg_info:overwrite_arg
entry_points.txt = setuptools.command.egg_info:write_entries
requires.txt = setuptools.command.egg_info:write_requirements
1 change: 1 addition & 0 deletions changelog.d/2582.breaking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Simplified build-from-source story by providing bootstrapping metadata in a separate egg-info directory. Build requirements no longer include setuptools itself. Sdist once again includes the pyproject.toml. Project can no longer be installed from source on pip 19.x, but install from source is still supported on pip < 19 and pip >= 20 and install from wheel is still supported with pip >= 9.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[build-system]
requires = [
"setuptools >= 40.8",
"wheel",
]
build-backend = "setuptools.build_meta"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered having maybe a completely separate backend?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have. Maybe something that vendors all of the dependencies or just hard-codes the behavior especially for setuptools. It's not out of consideration yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's exactly what I had in my mind.

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ exclude =
testing =
# upstream
pytest >= 3.5, !=3.7.3
pytest-checkdocs >= 1.2.3
pytest-checkdocs >= 2.4
pytest-flake8
pytest-black >= 0.3.7; python_implementation != "PyPy"
pytest-cov
Expand Down
22 changes: 16 additions & 6 deletions setuptools/tests/test_virtualenv.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import glob
import os
import sys
import itertools

import pathlib

Expand Down Expand Up @@ -65,20 +66,29 @@ def _get_pip_versions():
# No network, disable most of these tests
network = False

def mark(param, *marks):
if not isinstance(param, type(pytest.param(''))):
param = pytest.param(param)
return param._replace(marks=param.marks + marks)

def skip_network(param):
return param if network else mark(param, pytest.mark.skip(reason="no network"))

network_versions = [
'pip==9.0.3',
'pip==10.0.1',
'pip==18.1',
'pip==19.0.1',
mark('pip==19.3.1', pytest.mark.xfail(reason='pypa/pip#6599')),
'pip==20.0.2',
'https://github.com/pypa/pip/archive/master.zip',
]

versions = [None] + [
pytest.param(v, **({} if network else {'marks': pytest.mark.skip}))
for v in network_versions
]
versions = itertools.chain(
[None],
map(skip_network, network_versions)
)

return versions
return list(versions)


@pytest.mark.parametrize('pip_version', _get_pip_versions())
Expand Down