-
Notifications
You must be signed in to change notification settings - Fork 932
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
pkg_util leaves broken packages on uninstall #314
Comments
That is unfortunate behavior. What should we do here to resolve this? |
I think the solution here is pretty simple:
|
The downside to the above approach is that we continue to be entrenched in the issues surrounding package discovery (open issue with |
Another possibility is that we could work on enhancing pip to avoid removing init.py files containing |
Now that I think about it a little bit more, this first suggestion is probably subject to all of the same issues that dissuaded us from using the PKG_resources technique. |
Yeah, I wonder what @pfmoore thinks about the pip suggestion.
…On Sat, May 20, 2017, 9:50 AM Jason R. Coombs ***@***.***> wrote:
Now that I think about it a little bit more, this first suggestion is
probably subject to all of the same issues that dissuaded us from using the
PKG_resources technique.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#314 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAPUc2Dy6FsSVlonj5BC36PlugORtdOBks5r7xnWgaJpZM4NhWBI>
.
|
Fixing pip seems like a good idea.
…Sent from my iPhone
On May 20, 2017, at 12:53 PM, Jon Wayne Parrott ***@***.***> wrote:
Yeah, I wonder what @pfmoore thinks about the pip suggestion.
On Sat, May 20, 2017, 9:50 AM Jason R. Coombs ***@***.***>
wrote:
> Now that I think about it a little bit more, this first suggestion is
> probably subject to all of the same issues that dissuaded us from using the
> PKG_resources technique.
>
> —
> You are receiving this because you commented.
>
>
> Reply to this email directly, view it on GitHub
> <#314 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAPUc2Dy6FsSVlonj5BC36PlugORtdOBks5r7xnWgaJpZM4NhWBI>
> .
>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
See pypa/pip#4504 |
The distro level solution to this is to recommend that namespaces always have a clear owner (synthesizing one at the distro level if it doesn't already exist upstream), and then the contributors to the namespace all depend on the owning package. That way contributing packages can be freely installed and uninstalled, while if you uninstall the owning package, that will show up as a missing dependency for all of the contributing packages. Fixing that advice in the guide would be a matter of changing the following paragraph to recommend the "owning package"/"contributing package that depends on the owning package" split:
And this one to mention that instead of generating an
We'd then add a section at the end about "Namespaces without an owning package" that says:
|
@ncoghlan thanks for that - I definitely agree it's a good idea to recommend an "owning" package for each namespace that documents which method to use and the policies around it. I'll add that to my work items. However, I think |
@jonparrott When there's an owning package that all the contributing packages depend on, then the contributing packages should not need to include the That's how the distro level approach works - the owning package is the only one that includes the |
Due to hysterical raisins, I think pip uninstalling namespace packages has always been somewhat painful. If you install a project with setuptools (WITHOUT pip), the only record of what files have been installed is We probably need to refactor that, and possibly either deprecate/remove uninstalling setuptools/easy_install installed packages OR get it so setuptools drops a record file by default. |
@ncoghlan ah, I see now. Hmmm. I think this might make things complicated for After reading @dstufft's reply, I'm unsure what to do here. I don't know if the guide should change it's recommendations at this point for namespaces, considering "fixing" the "bug" in pip should make recommending owning packages irrelevant. However, suggesting owning packages might be useful in some cases but difficult in others. A compromise could be to add a new section about owning packages at the end of the guide, so that we can document the benefits and drawbacks and allow users to decide. This sort of thing is totally acceptable for this kind of doc. |
I'm fine with starting with an appended section, while leaving the main recommendations alone for now. I'm not sure about the |
I ran into some trouble trying to get owning packages to work for everything. Installing a
I'm going to put this lower on my priority for now. It seems to me that the issue with the current recommendation (uninstalling) is less severe than the potential drawbacks of owning packages (broken environment). Happy to keep this open until either pip is fixed or something else moves here. |
- It turns out namespace packages are kind of broken in Python. Refer to [1] and [2]. [1]: https://packaging.python.org/guides/packaging-namespace-packages/ [2]: pypa/packaging.python.org#314
I've just encountered another issue related to pkg_util-based namespace packages on pre-PEP 420 packages. Uninstallation of one package in a namespace breaks the package for all other in that namespace. Consider:
The issue occurs because the uninstallation step causes the removal of the now necessary
__init__.py
module for thebackports
package. The issue doesn't occur on late releases of Python 3.3 because the package gets implicitly converted to a PEP 420 namespace package (during the uninstallation step), which in some ways is worse, because thebackports
package will vacillate between PEP-420 and pkg_util-managed depending on whether the last operation was an install or uninstall.In some sense, this issue is an issue with pip and the way it installs packages all into the same location, rather than keeping distribution packages somehow separated the way eggs sought to do, but it's also a symptom of using only pkg_util for namespace package management, an issue that was addressed by setuptools' installation of the
-nspkg.pth
files.The text was updated successfully, but these errors were encountered: