-
Notifications
You must be signed in to change notification settings - Fork 151
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
replace pep425tags with packaging #346
Conversation
51cf960
to
6ec1dd2
Compare
result = "linux_i686" | ||
return result | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if packaging exposed this method. I think the XXX is kind of impossible to remove.
src/wheel/bdist_wheel.py
Outdated
@@ -167,6 +181,7 @@ def wheel_dist_name(self): | |||
return '-'.join(components) | |||
|
|||
def get_tag(self): | |||
from . import pep425tags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is where I need some help from the packaging people: how can we replace the use of pep425tags: get_abbr_impl()
, get_impl_ver()
, get_abi_tag()
, get_supported()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at how pip transitioned is probably best as @pradyunsg pointed out, but a quick guess is:
get_abbr_impl()
->implementation_name()
get_impl_ver()
->implementation_version()
get_abi_tag()
-> No direct equivalent for just thatget_supported()
->sys_tags()
or proper combination of the other*_tags()
functions depending on the situation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It seems packaging might want to support get_python_tag
, get_abi_tag
and get_platform_tag
, as well as get_platform
(mentioned in a comment above).
I suggest taking a look at pypa/pip#6908, which is the pip's tracking issue for porting to packaging.tags. |
macOS version dectection via pep425tags.py uses any |
And this was one of the biggest road blocks to switching to |
OK, now that I understand the complexities, I will see if packaging will accept some patches to support this all. |
There is a merge conflict. Does this project prefer merging from master or rebase/force-push to clear merge conflicts? |
Doesn't matter either way, as I will squash the commits in the end anyway. |
Rebased and checks are passing. Is |
supplied_platform=plat_name if self.plat_name_supplied else None) | ||
# XXX switch to this alternate implementation for non-pure: | ||
if not self.py_limited_api: | ||
assert tag == supported_tags[0], "%s != %s" % (tag, supported_tags[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this check important? The order of tags returned from sys_tags
is different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not, but I didn't write that code.
I think you should talk to @Czaki who wrote that detection code. |
@mattip this code is quite new. It was introduced in #314. So sysconfig properties does not allow to determine proper minimal macos version. |
You use own implementation of get_platform placed in
Could you explain? How You would like to limit it? |
@@ -178,6 +308,12 @@ def get_tag(self): | |||
if self.plat_name and not self.plat_name.startswith("macosx"): | |||
plat_name = self.plat_name | |||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how the condition on line 308 can be satisfied, since self.plat_name_supplied
is set to self.plat_name is not None
. It would seem that self.plat_name_supplied
can be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the WIP label. I am curious what the project maintainers think of this. It no longer imports |
@pfmoore @hroncok for reasons why see pypa/virtualenv#1481 (comment) with benchmark provided by @asottile at pypa/virtualenv#1481 (comment)
|
You may have misunderstood my comment (and the fact that @hroncok gave it a ❤️ suggests that he did too). I am completely in favour of virtualenv installing wheel by default, I think that's a real usability benefit of virtualenv over venv. I was not at all saying that I think this should change, just noting that because virtualenv has seeded packages other than pip, we should expect them to have dependencies and therefore adding support for seeded packages with dependencies to virtualenv is a necessary step if we want to avoid having a "must vendor all its dependencies" policy proliferate through the packaging ecosystem - which IMO would be a very bad mistake, both in principle and in practice. |
The thing is this policy only affects three projects: pip, virtualenv and wheel. No other packaging projects need to vendor. And all of these three played along this rule until now. wheel was the first to break out of this, and I don't think either pip or setuptools has any plans to change their vendoring policies. Not Fedora maintainers already voiced their opinion on virtualenv tracker that they really would prefer wheel to not take on dependencies too... And this will impact similarly all other distribution maintainers. Then again if wheel goes ahead with taking dependencies virtualenv will have no choice but to add support for it. |
I thought setuptools tried to de-vendor but had to revert because it caused issues? I could see them revisiting that. And personally, I view pip's vendoring as an unpleasant limitation of the current state of pip and the packaging ecosystem in general. I'd be more than happy if we found a way for pip to avoid vendoring some or all of its dependencies (not that I think this is likely 🙁). And of course, wheel is not a fundamental package, any more than something like packaging is - the only reason virtualenv needs to seed wheel is to support pip's "legacy" (non-PEP517) install process. Maybe setuptools should be vendoring wheel instead? After all, we only need wheel because setuptools can't natively build wheels... Anyway, I'll let the project maintainers decide. My opinion is purely around concerns of principle, and practical implications should beat that. |
To sum this up @agronholm are you still interested in going ahead with wheel having dependencies? (at pypa/virtualenv#1923 Fedora maintainers expressed their hope of not going down this path) |
That is my wish, because otherwise wheel will have to keep re-vendoring the tag code. However, if there is significant resistance and real arguments presented against it, I will stop pursuing the idea. |
This PR broke the ability to set the |
@carljm Could you explain your case in detail? |
Here is my analysis, but I did not actually write a test and check it. The code to check for tag validity, which is called for non-pure wheels, now checks that
The older code seems to have let non-compliant What I don't understand, and maybe @carljm could clarify, is how pip will install such a wheel: it should reject it. |
Hmm, but the |
And, in case we do end up finding a valid reason to have this, I suggest filing an issue on pypa/packaging instead of trying to change only-wheel to do the right thing here. |
Sure. At work we have custom versioned internal Linux platforms each with its own specific set of C library versions and compiler versions etc. So we build a wide variety of shared libraries for these platforms, including many Python wheels that link against libraries in the platform. So we pass
I don't know about this either way, because we don't use pip to install them. As far as I know wheel is a standardized Python packaging format, it is not owned by pip and should not necessarily serve only pip-supported use cases.
Yes, to me it seems quite intentional in the previous code that this plat-name override was allowed, given that it's tested. Also I wonder how
I'm not sure why. This was functionality entirely contained within the wheel library that previously existed and was tested but has now regressed. Seems straightforward to fix as a regression in wheel, it doesn't require changes in any other tool. If other tools (e.g. pip) want to make changes to support a similar use case, that seems fine, but it shouldn't be a prerequisite to fixing the regression. If a PR to restore this functionality would be accepted, I'd be happy to supply one. |
Oh, I see the description of #374 explains why the test failure was not noticed. |
@carljm Before I make a decision, I'd be interested in learning what you use the wheels for if you don't use pip to install them. Do you just unpack them directly or do something else with them? That said, I am leaning towards restoring the old functionality. |
@agronholm Yes, we have our own internal tooling that selects the right wheel from our wheel archive based on platform/version/abi tags and then unpacks them where we need them. Wheel is ultimately a very easy format to use, that's one of its attractions :) |
Are you using Wheel's internal structure could get a bit more complicated than just a simple zip file down the road. The wheel library's API and CLI will abstract that for the users, but if you're using |
I'll have to defer to @jreese for that question, I haven't worked on that side of the system. Thanks for the heads-up! |
We do a combination. For the majority of use cases, we use Buck to build our applications, and Buck will extract the wheel contents, while also handling data directories. While building packages with dependencies that we have already built as wheels, we will also Altogether, this allows us to better distinguish between wheels built for our internal platform/compiler/toolchain from upstream wheels from PyPI, so that we a) don't accidentally use upstream binaries for internal bulids, and b) don't use the internal platform wheels on engineers' laptops with standard virtualenvs. That said, if the wheel standard changes, we'll change buck to adapt, but the need/desire for building wheels against custom platforms will remain. |
I would recommend changing Buck to depend on wheel's new public API (when that becomes available) to make it automatically adapt to any future changes in the wheel format. |
Given that Buck isn't written in Python, it's unlikely that we could use the API directly, but if wheel provides a CLI equivalent, that would help. |
There is the |
@agronholm so where this land in the end, do you still plan to add dependencies for wheels package? If so we should come up with some battle plan to not break virtualenv. |
I would like to not have to vendor any dependencies, so yes, go ahead and make your plans :) |
@agronholm Hi there, apologies for the direct ping So... now that We are running something like python setup.py bdist_wheel --plat-name=linux-alpine3_12_x86_64 I honestly do see value on being able to specify custom platforms, it made our work so much easier so far, this change is kind of throwing out all the tooling we built around this... 😕 I'm actually now wondering a bit what's the utility of the If you don't think this should be solved on this project... should this issue be handled at a higher level? Like having |
That was an unintended side effect of this PR and has already been rectified in master via PR #375. I will try to get a patch release out soon. |
Oh... for some reason It didn't seem obvious to me that I could check further commits... sorry for that Thanks! |
Fixes gh-345
First steps