Allow installer users to extend/constrain build dependencies in isolated builds #10669
Closed
1 task done
Labels
resolution: duplicate
Duplicate of an existing issue/PR
type: feature request
Request for a new feature
What's the problem this feature will solve?
In pypa/setuptools#2893, I made a recommendation to install a plugin or downgrade the build backend to work around an incompatibility with older packages. As Setuptools moves toward adopting distutils and merging its behavior with Setuptools monkeypatches, it's bound to uncover more implicit dependencies on the peculiarities of the implementation. It would be nice, therefore, for the installers to have some control over the build environment, but still to defer the bulk of the behavior to the installer (pip).
In a PEP 517 world with build isolation, it's impossible for the installer to either extend or constrain the dependencies of the build without disabling build isolation, implying also taking on the burden of constructing the build environment, interpreting the requirements, installing them, invoking the build backend, and then tearing down the environment.
In #6144, it was proposed to allow "optional" dependencies in
pyproject.toml
to address problem, but that proposal is problemmatic for its own challenges, but also doesn't address the above need because it's packager-focused and not installer-focused.Describe the solution you'd like
I imagine a solution in which pip offers options to extend and constrain build dependencies at install time. Something like:
These additional requirements would apply to all builds during the installation. To limit the scope of the specifications, it should also allow for a limited scope:
For a concrete example, consider a build where
setuptools<59
is needed fordjango-hijack
andsetuptools_hacks.distutils_workaround
is needed for all projects and the deps inscipy-deps.txt
is required formynumpy-proj
:The same specification should be able to be supplied through environment variables.
With these parameters, pip would:
--build-requires
as declared on the command line.build-requires
from the pyproject.toml (or the implied ones if not declared), applying constraints declared on the command-line.The requirements declared by the project (in pyproject.toml) would always be honored and a conflict would either raise an error or the project-declared requirements would take precedence.
This isn't a full spec, but a sketch of the idea.
Alternative Solutions
Another approach might be to provide a hook to pip such that after the environment but before and after the build dependencies are installed, a plugin could alter the build environment (preferably with a handle to an "installer" object).
Above where pip installs two sets of build-requires (one from project and one from installer), it could simply merge the two sets of specifications and install those.
Additional context
I believe this proposal belongs with pip and not as a change to the standards as it's an enhancement of pip's implementation and still honors the standards, which have little to say about the UI/tweaks available to customize installation behavior. Please correct me if I'm mistaken.
Code of Conduct
The text was updated successfully, but these errors were encountered: