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
import pkg_resources
triggers a DeprecationWarning on Python 3.9
#368
Comments
Cross-posted to pypa/setuptools#2466 because I'm not sure whether the bug is in packaging or in setuptools. |
Without knowing what version is being attempted to be constructed it's hard to know if it's a bug. But it is possible that |
One problem with As for a fix… setuptools would need to provide additional handling to avoid constructing |
The only reason By dropping support for LegacyVersion, this project is suggesting that Setuptools too should drop support for such versions. One way this could happen is Setuptools could drop support for sorting versions. Another could be to drop support for packages that have these versions. Does the packaging project have a design in mind for what should happen with projects and environments that contain packages like these? I should think that before deprecating the structures for managing these versions, the project should first move to discourage or disallow the presence of such packages. Or perhaps instead, the PyPA would like to allow these types of non-standard versions, but the tooling will simply stop supporting them. |
I'm not a setuptools maintainer, could you explain why setuptools is trying to do this? What's the use case?
Legacy versions are just sorted lexicographically -- since they don't have a structure there's no other way to sort them. I think there's probably a middleground here where setuptools can continue to sort all versions (if it needs to) and just not try to turn invalid versions into legacy versions.
Legacy versions are already prohibited on PyPI and have been for quite some time. Anyone using them is either a) living so far in the past that they can't expect modern tooling to be compatible or b) doing some weird stuff that's probably well outside the use cases we're able to support. |
I'm not sure. I removed that sorting behavior and the tests still pass, so any use case isn't captured by the tests. It's possible this behavior was present to give precedence to the latest versions of a package when multiple versions of the same package were installed. Tracing the commits, I found pypa/setuptools@fb1867e and pypa/setuptools@e0805ec introduced the sorting behavior. Those commits led me to pypa/setuptools#629. My suspicions about the motivations were correct. I also notice that I allowed the change without tests and at the same time warned that these changes might be optimized away, so maybe that's the best approach at this point.
This isn't quite correct. LegacyVersions are sorted using the rules that Setuptools used to use to sort versions. It does honor decimal separators.
Sounds good. I've filed pypa/setuptools#2497 to enact that change. |
What counts as “weird stuff” is fuzzy, however. Both Those other tools should ultimately modernise, of course, but the particular way Also, would it be a good idea to expose a base class/protocol for downstream tools to inherit from, so tools can easier re-implement (a part of) |
Sorry, my mistake, that's what I get trying to respond from memory alone 🙂 |
|
#1045) * Temporary workaround to pip install -e issues * Filter out version warnings Caused by pypa/packaging#368 * Temporarily limit xarray to <0.17
* grid.__getitem__(key) now returns u.Quantity instead of xarray.Dataset The goal of the grids module is for users to not have to be familiar with xarray to use it. Returning a u.Quantity is more useful. * Added require_quantities() method to grids * Temporary workaround to pip install -e issues * Filter out version warnings Caused by pypa/packaging#368 * Temporarily limit xarray to <0.17 * Revert "Temporarily limit xarray to <0.17" This reverts commit 4f64afe. * xarraydev tests * Changes to proton radiography module because __getitem__ now returns u.Quantity * pre-commit * Swatted one bug (add_quantities removing ax0,ax1,ax2 from dataset for non-uniform grids) * Fixed issue setting quantities? * Create 1027.breaking.rst * Update 1027.breaking.rst * Update 1027.breaking.rst * Refactored one check in `proton_radiography.py` to use new `grid.require_quantities` method Co-authored-by: Dominik Stańczak <stanczakdominik@gmail.com>
@uranusjr Either I'm going to say something silly, or you're missing the point. It fails for any package including https://github.com/pypa/setuptools/blob/v58.2.0/pkg_resources/__init__.py#L2027 When it receives To reproduce:
And it's so since 2016-11-04. |
??? I am not even sure why you want to tag me, or why you are even commenting here. This is an entire different problem, and you already concluded setuptools should fix it, and you are commenting in a repository called packaging? |
Are you sure the problem is entirely different? It was cross-posted to |
Closing since pypa/setuptools#2466 covers this, and we've had one awkward social interaction already. :) |
I'm pretty sure this is a bug because I don't think pkg_resources is deprecated in its entirety.
The text was updated successfully, but these errors were encountered: