-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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] Implement PEP 660 -- Editable Installations #2816
Comments
See the discussion and dholth/setuptools_pep660#1. |
I took a stab at this but I can't seem to find a reliable way to query the importable base of the packages / modules (i.e. the parent directory of {name}.dist-info generated from an in-tree build). For what it's worth this is my first time working in the setuptools codebase so there's probably something I'm missing :) |
Status update: after adding some more runtime patching of setuptools internals to query all of the information I need I got an implementation that can do an editable install for at least a simple single pure-Python module distribution and a src-style pure-Python multi-package distribution (psf/black, duh 🙂) 🎉 I need to test other situations and packaging configurations, but I've ran out of time for today :) |
I think that preserving editable installs for packages with c / c++ / cython installations via some mechanism is cirtical (I say with my Matplotlib and h5py hats on). I would be perfectly happy to absorb changes to our setup.py / pyproject.toml / built incantation, but there needs to be some path forward. |
Right, unfortunately I don't really have much experience in this domain1. It is my understanding that PEP 660's way of handling extensions is by mandating a in-tree and in-place extension build (effectively I'd love input and insight from people like yourself regarding extensions for both my own understanding and implementation testing! Footnotes |
We still need a stup setup.cfg [until](pypa/setuptools#2816) setuptools gets proper editable installs and either flake8 [**finally**](python/mypy#5205) gets the hint and support pyproject or [flakeheaven](https://github.com/flakeheaven/flakeheaven) is usable with vscode.
For completeness, making an update here with how I understand the state of affairs to be. With #1688 closed, this is now a blocker for getting editable installs working for setuptools' new pyproject.toml only projects. In #2872, there has been extensive discussion about the implementation approach that setuptools can take for this. There seems to be no clear concensus about how to implement the PEP 660 hooks -- there's significant pushback from the maintainers for implementing the PEP 660 hooks (that enable editable installations, without a setup.py file) using a mechanism similar to |
Hello from an empty setup.cfg file! This project is meant to be developed using an "editable installation". That is, an installation you get from running something like `pip install -e .`. With traditional distributions, from the pre-`pyproject.toml` days, this would be supported through something like `setup.py develop`. Later, Pip included support for `pip install -e .` in Setuptools-based installations that only had a `setup.cfg` (no `setup.py`). PEP 660 (https://peps.python.org/pep-0660/) has standardized editable installations that use only `pyproject.toml`. Unfortunately, Setuptools does not yet implement the hooks needed to support this. Luckily, the presence of a `setup.cfg` file is enough to trigger Pip to fall back to the existing Setuptools editable-install mechanism, which is still able to read project configuration from `pyproject.toml`. And so, we have an empty `setup.cfg`. Once pypa/setuptools#2816 is completed, the file can probably be removed.
Thanks a lot for the effort so far! Is there any update it’s progress? |
Error Project file has a ‘pyproject.toml’ and its build backend is missing the ‘build_editable’ hook. This is due to a limitation in Setuptools support for PEP 660. pypa/setuptools#2816
This is now one of the blockers for pip (and ensurepip) excluding setuptools in new virtual environments. The latest version of pip is capable of using the build isolation when setuptools is not available within the environment, even when there’s no pyproject.toml file. |
Closing this out, since #3265 implemented this. It'll be in a release soon-enough. It still has an experimental flag on it, but it works and that's the part that I care about. I've now seen multiple people point to this issue to say that editable installs don't work in Python -- the only case that doesn't is |
Thanks so much @pradyunsg. |
Is there a milestone or pull request for when that will happen? I see the PR was merged to the |
I couldn't find an open PR for the |
@djhoese, @astrojuanlu, you can track the progress in #3488. I am considering that the round of community feedback is reaching its end, so I plan to do a release soon (in another week or so). |
What's the problem this feature will solve?
PEP 660 standardises the mechanism that
setup.py develop
uses to make "editable" packages.Currently, pip needs to implement fairly horrible hacks to make legacy
setup.py develop
builds work. It'd be great if setuptools could implement PEP 660, which would be the last item from setuptools' end before pip can start the process of removing the legacy directly-call-setup.py build system.Describe the solution you'd like
PEP 660's build_editable hook gets implemented in aetuptools.
Alternative Solutions
Not doing this.
I imagine this will mean that either (a) pip continues to maintain editable installs for setuptools or (b) pip drops the legacy build system entirely and users of setuptools projects will no longer be able to make editable installations.
I don't think (b) is happening any time soon, and it'd likely be best to implement the hook here.
Additional context
IIUC, this has been implemented in setuptools-pep660 already. It might not be a lot of work to migrate the work done there into seriptools directly.
Code of Conduct
The text was updated successfully, but these errors were encountered: