-
Notifications
You must be signed in to change notification settings - Fork 35
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
editable mode is not supported #256
Comments
I do want to ask - are there plans to support editable installs in a PEP 517 world? Or are editable installs deprecated and the build tool must be run on every edit to convey changes? |
Broken due to pypa/pip#6434 There's some discussion to have some support, but no agreement yet. |
Editable installs are waiting on another round of standards work to define a PEP 517-style interface for them. There's nothing blocking that, it was dropped from PEP 517 simply because of a lack of time. If someone were to champion a proposal for an editable install standard, it should be possible to get this under way again fairly easily. (Not that I'm guaranteeing that achieving consensus would be easy ;-)) |
I did confirm that the |
@jaraco We're seeing similar problems in the pyo3 project, and we're definitely not intending to use any sort of editable install. @gaborbernat Does |
People discussed the future of editable installs during the packaging minisummit at PyCon North America in May 2019 and I'm moving the notes from that discussion here: https://discuss.python.org/t/pip-19-1-and-installing-in-editable-mode-with-pyproject-toml/1553 & https://discuss.python.org/t/specification-of-editable-installation/1564/34
Open Questions:
Proposal/Suggestion:
Options from Nick Coghlan @ncoghlan
What responsibility should the front end take on?
Metadata is also imported. Setup.py uses egg info and this lacks many of the structures we want
We cannot require front ends to respect excludes.
We cannot require front ends to respect updates to say, an `.so` file for a cffi module.
Actions:
end of meeting notes And more recently people have been discussing the next steps on Discourse. |
One more note: @ofek mentioned in a comment to those notes, regarding Windows symlinking:
|
Oh, it seems the docs now say so too https://docs.python.org/3/library/os.html#os.symlink |
Some useful discussion regarding Windows symlinks at https://security.stackexchange.com/questions/10194/why-do-you-have-to-be-an-admin-to-create-a-symlink-in-windows I must have seen the announcement of the more fine-grained permissions structure a few years ago, but not looked into the details (i.e. an admin can configure their particular system to let unprivileged users create symlinks, but that still isn't, and likely will never be, the default behaviour) |
I had heard that more recent versions of Windows support symlinks without the special privileges (confirmed here), but it seems this more lenient behavior is still hamstrung by requiring both the caller to pass a special value and the user to have configured the system for development mode, meaning it's basically non-viable until those changes trickle out. |
Yep. The documentation for the caller's special flag for this functionality states:
@ncoghlan It seems that "Developement Mode" is a per-user flag (ref) so we can in theory ask users to flip this flag for us to enable symlinks for their system. While it's not the default behavior, we can detect this situation, ask the user to flip a flag and things work from then on -- which is a decent experience. :) |
So there will be at least some users who will not be able to turn this option on. |
I'm taking another look at this, as I was reminded recently how much I dislike setuptools' editable install mechanism. PEP 517 already includes a hook to prepare the I propose two additional optional hooks
When asked for an editable install, e.g.
I think this is flexible enough to allow both persistent editable installs (like symlinking), and session editable installs (e.g. launch a shell with a modified environment referring to tmp folders). It's probably not perfect. But I think we've concluded that editable installs of this nature can never be perfect, because of the way they mix copying information and referencing information. But they're still handy, especially for expert users who understand what changes still need a reinstall. The other possible approach is a 'watcher' mechanism, where something spots when the files are changed and quickly rebuilds/reinstalls the package. That is in many ways more powerful, because in principle any change can take effect automatically, and I think we should be open to adding support for that in the future. But it also seems much more complicated to do in general, so unless someone has a great idea, I think we should focus on the simpler mechanism for now. |
@takluyver That sounds a lot like the proposal we decided upon at PyCon and mentioned in the thread on discourse. Honestly I am fairly sure that the only reasonable choice is for the backend to prepare a "virtual wheel" that contains references to the locations of the files that would be installed if you were to install them. Everything else is details. I don't think there is much if any controversy here, it's just that no one has created a proof of concept with setuptools yet, and there's not much point trying to figure out the details before we have a working understanding of the kinds of problems we're going to run into. |
Yup, sorry. I hadn't read enough of that thread to see it. |
As an intermediate step would it make sense to think about standardizing metadata for editable installs? The goal would be that tools could discover that a distribution has been installed in editable (or should we say development?) mode and make some sense of it. I'm thinking about use cases such as The spec could start small, by saying an "editable" installation must have regular |
@sbidoul I really don't see that any intermediate step is necessary or wise. If I think we have a pretty good "big picture" idea of what this should look like: backend produces a a pseudo-wheel consisting of wheel metadata plus a mapping between the locations of the files as they should exist in the package and the locations that they exist on disk, front-end uses whatever mechanism it deems proper to expose those files to Python in such a way that they will update as the files change on disk. We need a proof of concept of that for setuptools and pip. A rough proof of concept for One might suggest building such a facility into |
To clarify I'm not talking about progressing the PEP 517 interface for editable installs. This is independent of what the PEP 517 interface will look like in the end, and is useful today when we manually invoke |
I'm not sure it is independent of this, but if it is then it's not really an "intermediate step", and probably should have its own thread. That said, in your original post you write:
I'm not clear on what purpose this metadata is serving, but it doesn't seem like it's terribly useful information in my concept of what PEP 517 editable installs will look like, which is why I'm skeptical that this can be done in parallel to the development of a spec for editable installs. If you do think it's orthogonal to the question of editable installs for |
When one has done That project location information is important for users inspecting what is installed. When you do When we will do |
@sbidoul Editable installs have to be able to achieve two things:
The available mechanisms for the first part are either OS level (i.e. symlinks) or Python level (i.e. The second is less complicated, since the distribution metadata can just go in the normal location. There's no real need for any "this is an editable install" metadata (it might be nice to have some for informational purposes, but it's not a blocker to "editable install support") |
Totally agree. I'm not questioning that. I'm using the symlink option of
Agreed too.
I think there is a need, beyond informational purposes. For example to enable |
OK, I think I follow now: the key missing installation metadata is "How to pin this specific version" when "package_name == full_version_number" won't do the right thing. That wouldn't just be beneficial for editable installs, it would help with VCS installs and other cases where using just the version number won't give the right result. |
One need I’ve had recently was related to hot-reload of web app: the reload tool watched files in my project directory, ignored files in site-packages (as an optimization), and so would not monitor the modules made available via |
@ncoghlan it is one use case, yes. Note that for VCS URLs and direct URL references in general, there is the draft PEP 610, which is currently stuck for lack of a core dev sponsor. My first impression is that metadata for editable instalis is different enough to warrant a separate spec (if only because the "location" of an editable install is always a local directory). |
@sbidoul I replied over on the PEP 610 thread, as I believe the local directory handling needs some adjustment anyway (does it really make sense to hash the whole directory tree?), and that creates an opportunity to store an "editable or not?" flag. |
Add setup.cfg and setup.py, necessary for installing a package via pip. Add a ReST document (PACKAGE.rst) explaining the basics of what this package is for and who to contact for more information. This document will be used as the landing page for the package on PyPI. List the subpackages we intend to package by name instead of using find_namespace because find_namespace will naively also packages tests, things it finds in the dist/ folder, etc. I could not figure out how to modify this behavior; adding allow/deny lists to setuptools kept changing the packaged hierarchy. This works, roll with it. I am not yet using a pyproject.toml style package manifest, because "editable" installs are not defined (yet?) by PEP-517/518. I consider editable installs crucial for development, though they have (apparently) always been somewhat poorly defined. Pip now (19.2 and later) now supports editable installs for projects using pyproject.toml manifests, but might require the use of the --no-use-pep517 flag, which somewhat defeats the point. Full support for setup.py-less editable installs was not introduced until pip 21.1.1: pypa/pip@7a95720 For now, while the dust settles, stick with the de-facto setup.py/setup.cfg combination supported by setuptools. It will be worth re-evaluating this point again in the future when our supported build platforms all ship a fairly modern pip. Additional reading on this matter: pypa/packaging-problems#256 pypa/pip#6334 pypa/pip#6375 pypa/pip#6434 pypa/pip#6438 Signed-off-by: John Snow <[email protected]> Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]> Reviewed-by: Cleber Rosa <[email protected]> Message-id: [email protected] Signed-off-by: John Snow <[email protected]>
Add setup.cfg and setup.py, necessary for installing a package via pip. Add a ReST document (PACKAGE.rst) explaining the basics of what this package is for and who to contact for more information. This document will be used as the landing page for the package on PyPI. List the subpackages we intend to package by name instead of using find_namespace because find_namespace will naively also packages tests, things it finds in the dist/ folder, etc. I could not figure out how to modify this behavior; adding allow/deny lists to setuptools kept changing the packaged hierarchy. This works, roll with it. I am not yet using a pyproject.toml style package manifest, because "editable" installs are not defined (yet?) by PEP-517/518. I consider editable installs crucial for development, though they have (apparently) always been somewhat poorly defined. Pip now (19.2 and later) now supports editable installs for projects using pyproject.toml manifests, but might require the use of the --no-use-pep517 flag, which somewhat defeats the point. Full support for setup.py-less editable installs was not introduced until pip 21.1.1: pypa/pip@7a95720 For now, while the dust settles, stick with the de-facto setup.py/setup.cfg combination supported by setuptools. It will be worth re-evaluating this point again in the future when our supported build platforms all ship a fairly modern pip. Additional reading on this matter: pypa/packaging-problems#256 pypa/pip#6334 pypa/pip#6375 pypa/pip#6434 pypa/pip#6438 Signed-off-by: John Snow <[email protected]> Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]> Reviewed-by: Cleber Rosa <[email protected]> Message-id: [email protected] Signed-off-by: John Snow <[email protected]>
Closing this out, since PEP 660 has happened. |
🎆 |
Recently, tests that were previously passing have started failing, possibly due to pypa/pip#6331. The error message is:
I've been (internally) bemoaning the fact that the 'editable' use-case is poorly-supported (and relies on deprecated functionality in setuptools such as easy_install and setup_requires to function). But I'd also been assuming that the tool chains would retain fallback compatibility, such as editable installs, for projects that support them (such as this pip-run project).
I'm on the hook to do more investigation here, but I wanted to report the issue thusfar.
The text was updated successfully, but these errors were encountered: