-
Notifications
You must be signed in to change notification settings - Fork 42
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
tomli violates PEP517 Build Requirements #154
Comments
Thanks for the issue! I'm sure you're well aware of the problem by now. That is, packaging requires reading TOML but there is no TOML parser in the stdlib so build backends either vendor a parser or resort to this dependency cycle. Tomli's build backend (flit_core) has so far chosen to not vendor in the belief that it is the lesser evil. This is a bit of an (unfortunate) exception that we have until stdlib can parse TOML. The cycle could be solved on Tomli side by vendoring flit_core and using it as build backend but... my intention with Tomli was to write the best pure Python TOML parser, not to end world hunger, solve Python packaging, or anything else. 😃 My understanding is that flit author (takluyver) also thinks that this special casing is best solved on flit's side, so I suggest we have a little patience and see what conclusion they arrive at. |
Well from my understanding this means |
Hmm, maybe. I'm not sure if that'd be a great twist for the PEP517 Python bootstrap story though, as setuptools has its own dependency cycle with wheel, has dependencies (although bundled) and may depend on Tomli in the near future. Oh and for PEP517 you'd still need a build frontend, likely One way to currently avoid the cycle (in case it helps you) is to restrict |
From what I can tell setuptools does not actually depend on wheel, as long as setuptools vendors tomli I don't think there would be an issue, it seems to be a significant improvement for bootstrapping compared with flit.
Wouldn't that then mean any package depending on
Well |
Here it boils down to:
I.e. takluyver has made the decision to not vendor in the belief (at least at the time) that it is the best trade-off overall. I honestly trust their judgment in this way more than my own. So if you want things to change, please go pester them not me 😄 Also, with setuptools as backend, you still need that build frontend, which as I mentioned very likely depends on Tomli, so I'm not sure this makes bootstrapping any easier. |
So it's unclear if
Bootstrapping works much better with setuptools since it has a non-generator |
Yeah I didn't mean to imply anything about whether flit_core violates PEP517 or not. My point is that due to conditions I laid out in my first post this cycle may be a necessary exception. An alternative being that many packages vendor a TOML parser, but apparently that was deemed to be the worse alternative by packaging experts.
But that is not PEP517 bootstrapping. Then you resort to the legacy build system. If you are happy to bootstrap like that, why not just run the following to build Tomli python3 -c 'from setuptools import setup; setup(name="tomli", packages=["tomli"], package_data={"": ["*"]}, version="2.0.0")' sdist bdist_wheel It should work perfectly already with no changes made to the repository. |
I really don't see why there should be an exception here when simply using
It also has PEP517 bootstrapping support which uses this and doesn't have a circular dependency issue:
This is basically the same way packages like
By using the empty setuptools shim you basically get guaranteed identical behavior with PEP517 bootstrapping above as both effectively are configured with |
Yeh, but then you need the PEP517 frontend that depends on Tomli: we have the same cycle again. There really is no way around the fact that PEP517 needs TOML parsing and that we dont have until Tomli is built. I may not have the energy to write in this issue after this post, but as Ive said before, Id like to wait for what takluyver does with flit. The command I provided can be used to do legacy build of Tomli and is trivial to modify to fetch version number dynamically from pyproject.toml, .bumpversion.cfg or init.py file. |
There are PEP517 frontends without a circular
Not all PEP517 frontends have a direct dependency on the
That would mostly fix the boostrapping issue with
Using |
Yeah as Ive stated, I do understand that vendoring TOML parsers is an alternative and how this is a trade-off and how an active decision to not vendor has been made.
The command has nothing to do with flit_core, it interacts with it in no way at all. It should fix both your issues. |
So based on my understanding of the situation if
I realize that.
It still however leaves |
To be clear, setuptools absolutely does have a circular dependency on wheel when bootstrapping with PEP 517. setuptools needs wheel to build a wheel of itself and wheel needs setuptools to build itself. |
Are you sure? I don't see wheel listed here. |
Oh, it's wheel specific and comes from here I guess. |
If the circular dependency in setuptools would be resolved then yes, it would perhaps be better to use a backend which allows declaring project metadata in a format other than TOML. But then you'd need twice the number of backends to bootstrap Python's packaging stack, because Flit has been or will be adopted by other foundational dependencies. We should look at this whole thing... holistically instead of trying to fix issues as they crop up in each one of these dependencies. If we want to bootstrap our foundational dependencies with Flit then we all need to switch to Flit and we need to come up with a solution for building and installing wheels that works for all of them. |
We'll go with the vendoring option in flit_core. Please don't pester @hukkin about this. I'm the one who introduced the dependency cycle, and I'm the one working on a packaging tool. We're already having a discussion about it at pypa/flit#483 (and other Flit issues and PRs), which @hukkin is already involved in. Opening more issues feels more like shouting at us to pay attention to your problem than like it actually moves a solution forwards. I'm sorry I haven't responded quicker, but Flit isn't my job, and it's not always what I want to do in the evening after work. |
I've updated my dependency cycle checker so that it is able to catch the wheel cycle violation as well now.
Great, sorry about the noise, was throwing around different potential solutions to see what would be acceptable as there's a lot of potential ways to fix this issue that I've come across, closing this as a viable solution seems to have been decided on at least for resolving the |
The PEP517 Build Requirements specifically disallow dependency cycles:
The text was updated successfully, but these errors were encountered: