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

[FR] Allow bootstraping setuptools by running dependencies from source #2828

Open
1 task done
FFY00 opened this issue Oct 25, 2021 · 7 comments · May be fixed by #4389
Open
1 task done

[FR] Allow bootstraping setuptools by running dependencies from source #2828

FFY00 opened this issue Oct 25, 2021 · 7 comments · May be fixed by #4389
Labels
enhancement Needs Triage Issues that need to be evaluated for severity and status.

Comments

@FFY00
Copy link
Member

FFY00 commented Oct 25, 2021

What's the problem this feature will solve?

setuptools requires wheel to be installed to bootstrap itself, but wheel requires setuptools to build, preventing bootstrapping.

Even though setuptools now bootstraps itself via a PEP 517 builder, not everyone is able to do the same. Linux distributions, for example, need to bootstrap it from scratch.

Describe the solution you'd like

I would like an option, perhaps an environment variable, to skip the dependency checks, and to make the bdist_wheel command always available.
The easiest way to do this bootstrapping is to run everything from source, which trips up setuptools' dependency checks, and also as a consequence makes the bdist_wheel command unavailable.

Alternative Solutions

I have written https://github.com/FFY00/python-bootstrap to help with this task, but currently, I need to run setup.py egg_info on setuptools, copy that to the package directory, in order to trick setuptools to think it is installed, and then do the same for wheel, only after that I can actually build wheels for setuptools and wheel.
https://github.com/FFY00/python-bootstrap/blob/4004fda86bc82470b0ee1b564764f8ba9960b493/bootstrap/build.py#L43
https://github.com/FFY00/python-bootstrap/blob/bf68a5ff74706e348de1f3dddeaf51bc5f37a449/bootstrap/__init__.py#L109
See #2088 (comment) for more details.

Ideally, setuptools would actually be able to bootstrap itself without any dependencies.
See https://github.com/takluyver/flit/tree/master/flit_core for example.

Additional context

No response

Code of Conduct

  • I agree to follow the PSF Code of Conduct
@FFY00 FFY00 added enhancement Needs Triage Issues that need to be evaluated for severity and status. labels Oct 25, 2021
@layday
Copy link
Member

layday commented Oct 27, 2021

Short of merging wheel into setuptools or building a setuptools wheel without the aid of the wheel package, what would be a solution to this issue?

@layday
Copy link
Member

layday commented Oct 27, 2021

Can we duplicate all of the necessary entry points in https://github.com/pypa/setuptools/blob/main/bootstrap.egg-info/entry_points.txt, would that work to avoid this little dance?

@nanonyme
Copy link

nanonyme commented Oct 22, 2022

Perhaps indeed wheel could be vendored through git submodules and then added to sdist but not installed or added to final wheel package. backend-path might allow setuptools to consume it while it is creating wheel of itself.

@nanonyme
Copy link

nanonyme commented Feb 26, 2023

This is btw a huge problem until solved. It means setup.py install must be kept indefinitely for bootstrapping setuptools unless I'm missing something. The non-legacy build chain is.

  1. flit_core
  2. pypa-install
  3. pyproject-hooks
  4. packaging
  5. pypa-build

and then you need hit a dependency cycle where setuptools needs wheel and wheel needs setuptools. You need to resolve that before building pip. Maybe this should be re-classified as a bug rather than enhancement?

@astrojuanlu
Copy link
Contributor

@nanonyme see pypa/wheel#501

@nanonyme
Copy link

Fair, if it will get done that way.

@SpecLad
Copy link

SpecLad commented Feb 27, 2023

FWIW, it is possible to bootstrap setuptools and wheel without using setup.py install, although it is a bit hacky:

  1. Unpack the setuptools and wheel sdists.
  2. In the setuptools source directory, run PYTHONPATH=../wheel-x.y.z/src python setup.py bdist_wheel. Install the resulting wheel.
  3. In the wheel source directory, run PYTHONPATH=src python setup.py bdist_wheel. Install the resulting wheel.

@abravalheri abravalheri linked a pull request May 23, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
5 participants