-
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
Wheel violates PEP517 Build requirements #429
Comments
Does this mean |
In theory, it probably means that either wheel or setuptools should somehow use the in-tree backend mechanism in PEP 517 to break the loop. In practice, though, people seem mostly happy with just providing wheels to break the build loop - the people who were focused on building everything from source (which was the motivating case for that feature) don't seem to have followed up by pushing build backends to self-host. Flit has a bootstrapping process that doesn't use that mechanism, I believe. |
Flit will be bundling tomli to break the loop from next version. |
But setuptools already uses the in-tree backend mechanism, here? Just what is |
I've backed out of PEP 517 build metadata in |
Per PEP 518 a |
Installing with isolation currently works because there's no published release with |
Wasn't that bug fixed quite a while ago? |
It's not a bug, it's intentional. |
So what you're saying that I cannot make a release before doing away with |
You don't have to delete it I suppose so long as you exclude it from the sdist (and nobody tries to |
To play it safe, I've gone and removed it entirely. I hope I can put it back one of these days. Right now I just don't see how. |
PEP517 explicitly states:
Maybe |
@jameshilliard I understand that, but is there a practical issue here, or is this just a matter of being careful to follow the standards to the letter, is what I'm asking?
Yes, My point here is that wheel doesn't need to do anything, and I'm trying to confirm whether leaving it to setuptools to address the issue will have any practical implications. It seems like it hasn't until now, at least. It's a shame if wheel has to avoid using |
The practical issue is that wheel can't be built with PEP 517 because there's a circular dependency between setuptools and wheel.
|
Wouldn't the front-end download a previous version of wheel in step 7 though? |
I don't know what frontend might do that but pip fails with a lookup error. |
How can I reproduce that? |
I suppose you could try publishing a pyproject.toml version of wheel on test-pypi or use |
Can you provide a way of reproducing this? I believe pip should work in this case, as @agronholm says. The following is with wheel's trunk:
Edit: I also tried other variations, including |
No, I cannot provide a way of reproducing this because a version of wheel with |
For us our build infrastructure is simply not capable of resolving circular package dependencies, so not having dependency cycles really is something we do want. We also don't(by policy) support downloading pre-built pypi wheels, we always use sdists.
Well I think it should probably be resolved in
Yeah, probably best to resolve this in setuptools, I opened an issue there. |
You could use that logic to say that nothing should use setuptools, because doing so triggers a loop. More accurately, though, wheel and setuptools simply can't claim 100% compliance with PEP 517. But 99% compliance is good enough for most users. In reality, it's "just" a bug, and wheel has implemented a workaround for now, until setuptools fixes the issue. But it's a low-priority bug IMO, because nearly everyone will simply use the wheels and not encounter the problem. |
Yeah, that is the bigger issue IMO, the
The solution to me seems to be to vendor
It's mostly a problem for distributions like us that have package tooling which is not capable of resolving circular package dependencies. |
If pip, distros and their package managers are happy special casing setuptools indefinitely, then I suppose it is a low-priority bug. |
Yeah, for us we should be fine as long as we can use legacy |
For how much longer should we maintain the capability for legacy installs, and for what purpose? |
For a package like wheel which is important for bootstrapping other build tools I would generally say as long as feasible(ie as long as it doesn't introduce significant maintenance burden) to simplify installs on legacy environments. It looks like python 3.11(last version compatible with distutils) isn't going to be EOL until 2027, so that would probably be the upper range it would make sense to keep legacy install support around for. |
For the specific case of Buildroot, is there something preventing you from using PEP 517/518 tooling? |
Well circular dependencies(which out tooling is pretty much unable to handle in any way remotely cleanly) with In general...the PEP517 tooling for cross builds+installs(since we pretty much can't use pip for anything at all due to it having extremely poor/non-existent cross compilation support) is really immature and difficult to bootstrap at the moment due to a bunch of pain points all over the place, for example even basic functionality like installer cli support is still a work in progress. I have a work in progress PEP517 branch here but it's not exactly in a state that's mergeable upstream yet. |
This sounds like an incredibly long period to expect tools to retain support for legacy tooling (about 10 years since PEP 517 was approved, and still 5 years from now). If you really do not expect to be able to use more modern tools/techniques before then, I'd be really grateful if you'd open up a discussion on the packaging Discourse area to explore what the blockers are, and try to work out how we address them. I don't think it's reasonable to expect under-resourced, volunteer-driven projects to commit to such long support timescales.
How is that relevant to wheel? As a pure Python project (like basically all of the core packaging components) it isn't platform specific, so building anywhere should get you a universal wheel, which can be used in any environment.
Pip isn't intended to support cross-compilation, so this is by design. In fact the only build tool I'm aware of that might handle cross-compilation is setuptools, and that's a backend, not a frontend. If your issue is that setuptools no longer supports the use of |
Yeah, that's an issue for most projects, I was just going off of the cpython EOL timelines for what might make sense here. It's subjective though.
I've mostly been trying to work out the initial batch of project specific issues(like circular dep issues) while iterating on a buildroot integration first. Once those initial issue are resolved I should be able to do a write up on any remaining non-project specific blockers there.
Yeah, that's what I thought, which is why we need a PEP517 frontend that does support cross compilation(which seems to be build+installer).
Legacy distutils does as well, but yeah we currently just have infrastructure for setuptools and distutils based python packages, I'm working on adding PEP517 support but it's rather non-trivial due to bootstrapping.
I mean we definitely have to support PEP517(due to many critical packages requiring
Most of the techniques we're using seem to not be that difficult to use with PEP517, I mean even stuff like sysconfig overrides are fairly generalized and tend to work automatically in most cases. The lack of a mature pip alternative seems to be the bigger problem. This is more of a build+install frontend issue it seems than anything. |
CPython has orders of magnitude more people working on it than the packaging ecosystem, as well as having corporate sponsors. What makes sense for them is totally different from what makes sense for packaging tools.
In the sense that you mean, PEP 517 doesn't handle cross-compilation. As I said, there's no standard for anything related to cross-compilation, so you shouldn't be expecting any tool support for it presently. Setuptools (and as you note, distutils before it) provided cross-compilation support1 via By desupporting the use of Footnotes
|
Well I mostly mean the frontend support needed for cross compilation(which was previously just a direct
We've basically always just bypassed pip entirely and hooked our tooling straight up to the
The problem is not pip(since we've never used it to begin with) but the lack of a way to actually invoke a build+install from a python interpreter that doesn't have any packaging tools at all. It's unclear how this initial stage should be done without a
This part isn't really a cross-compilation issue so much as a general toolchain bootstrapping issue, the issue with |
I thought the issue was somehow related to cross compilation of other things...?
Which I am trying to fix in #436. Also, wheel has always required setuptools to build, and setuptools has always required wheel to build wheels, so why is this only becoming a problem for you now? |
Well it's actually not cross compilation specific, it's just that we can't use pip at all(which is the usual way things are bootstrapped it seems). I think gentoo has a similar problem we're facing.
Oh, that's because setuptools only requires wheel for PEP517 builds, not non- |
I think the term 'cross compilation' might be causing some confusion. I think the people from the Python side (including me) assume this term refers to actual compilation, as in creating native machine code. This doesn't happen for Python code, so as far as we're concerned, it's a non-issue for pure Python packages, including all the packaging machinery we're talking about. I think @jameshilliard is using the term in a rather looser sense, including getting things installed in the right places when you're not in the target system which will run the installed code. Pip is meant to install packages for the currently running Python. James, you might want to find a clearer term for this, because it's really not about compilation. The good news is that PEP 517 conceptually makes this easier. Most packages will be built to a platform-independent ( |
Thanks @takluyver - if that is the confusion here, that makes a lot more sense. While the IMO, But agreed, the existing tooling for this use case is still a bit rough. Having a discussion on the Packaging Discourse might be the best way of collecting views from people (such as distro maintainers) with the same use case here, which would help tools design a more friendly UI. Footnotes
|
Well we're effectively using a full cross compilation setup(capable of building c extensions and such) even for pure python packages.
It's an issue for packages that have native extensions, which we of course have to support and need to be compiled, our infrastructure doesn't differentiate pure from native packages in any meaningful sense so the tooling needs to support both use cases either way even if the tools or some specific pages themselves may not require native extension. Creating separate platform-independent tooling here would just IMO just add unnecessary complexity. So I'm generally approaching the problems here from the point of view that platform-specific support is required.
This doesn't make much difference in terms of complexity since we will always have to support platform specific package builds+installation, it makes no sense to special case platform-independent packages in our infrastructure as the platform-specific infrastructure should handle those.
Yeah, I mean for the pip case at least it always seemed that pip was deliberately not supporting cross compilation use cases, which is fine but that just means we need an alternative here.
I'm trying to provide feedback so that these issues can actually get solved upstream properly, although historically the python situation has not been great there and we've had to hack stuff up a good bit. Cross compilation also tends to be significantly more complex than normal compilation for python although we do try and minimize the amount of customization we make as much as feasible.
From my understanding this would probably be the most difficult option since pip has such poor/non-existent support for cross compilation and customization. It also doesn't give much control around the build and install stages in general AFAIU and would likely conflict with our download infrastructure and dependency resolution infrastructure as well probably. |
Pip doesn't need to support cross-compilation (in the "build binaries for a different platform" sense) as all it does is call the build backend (setuptools or whatever). As I've said on a number of occasions (but the message doesn't seem to be getting picked up) you need to ask the setuptools project to expose options to request cross-compilation via the PEP 517 API (presumably via the But please be clear - you will never have a backend-independent means of requesting cross-compilation, unless you engage with the packaging community to define a standard for such a thing. Without a standard, you'll have to handle cross-compilation with backend-specific flags (which means knowing what build backend a given project uses). |
I'm confused, what has PEP 517 changed in terms of cross-compilation with setuptools? When has setuptools ever had options for cross-compilation? Why do we keep coming back to pip when...
|
Yeah, I just mean
Well it seems like hacking up sysconfig gets us most of the way there with setuptools, at least when it comes to configuring c extensions and such.
Our tooling configures specific backends anyways and probably will always have to do that to some degree since we need to be able to resolve build dependencies, setuptools+distutils was pretty close to a universal backend for cross-compilation in the past at least(although supporting it was a bit hacky). The current situation with multiple build backends is much messier to maintain downstream.
What's changed is that PEP 517 doesn't allow direct invocation of a build from a
It seems to have had enough configuration to make it work for us, see: |
So what has changed is that you can't pass |
I think it's used for setting the shebang path for the scripts, AFAIU we hard code it to the target interpreter path in a running target system which would not match the path of the target interpreter while being built on the host. |
Well, that is fantastic news. setuptools does not write scripts under PEP 517; the installer does. And installer has had an option to change the interpreter in the shebang since day one :) |
Specifically the build requirements state:
This specific PEP517 Build requirements violation can be identified by the dependency cycle validator in build that I'm working on.
This flags the problem:
The text was updated successfully, but these errors were encountered: