Message ID | 76a7207a210365b23c078895f444109e240d2c7f.1682660104.git.john.kehayias@protonmail.com |
---|---|
State | New |
Headers | show |
Series | Updates for pyproject-build-system, poetry, python-yubikey-manager | expand |
Hi, > + (replace 'build > + (lambda _ > + (invoke "python" "-m" "build" "--wheel" "--no-isolation" "."))) > + (replace 'install > + (lambda _ > + (let ((whl (car (find-files "dist" "\\.whl$")))) > + (invoke "pip" "--no-cache-dir" "--no-input" > + "install" "--no-deps" "--prefix" #$output whl))))))) why is this necessary? As far as I see pyproject-hooks wants to be built using flit_core, which we have a fully bootstrapped version of. Same for pypa-build, which – as far as I can see – also builds using flit_core. Cheers, Lars
Hi Lars, On Mon, May 01, 2023 at 08:58 AM, Lars-Dominik Braun wrote: > Hi, > >> + (replace 'build >> + (lambda _ >> + (invoke "python" "-m" "build" "--wheel" "--no-isolation" "."))) >> + (replace 'install >> + (lambda _ >> + (let ((whl (car (find-files "dist" "\\.whl$")))) >> + (invoke "pip" "--no-cache-dir" "--no-input" >> + "install" "--no-deps" "--prefix" #$output whl))))))) > > why is this necessary? As far as I see pyproject-hooks wants to be built > using flit_core, which we have a fully bootstrapped version of. Same > for pypa-build, which – as far as I can see – also builds using flit_core. > This gets to what I wasn't sure about, what exactly needs to be bootstrapped and what depends on what. From what I remember and thought, the newer python-pypa-build needs python-pyproject-hooks. Which itself would be built with pyproject-build-system, creating a circular dependency. But, I don't know anything about flit_core and that system. So you are saying flit_core is used to build each of these without a cycle then? Can you layout what the new structure would be for updating python-pypa-build with python-pyproject-hooks then? (And then deprecate pep517.) Thanks! John
Hi, > From what I remember and > thought, the newer python-pypa-build needs python-pyproject-hooks. > Which itself would be built with pyproject-build-system, creating a > circular dependency. ah, yes, you’re right. For some reason the current pyproject-build-system differs from my original proposal and bundles python-pypa-build in python-toolchain (even though it is not used). As we can see from this example doing so is a very very bad idea (because it leads to cycles). > But, I don't know anything about flit_core and > that system. So you are saying flit_core is used to build each of > these without a cycle then? > Can you layout what the new structure would be for updating > python-pypa-build with python-pyproject-hooks then? (And then > deprecate pep517.) In theory that would be possible if python-toolchain did not depend on pypa-build. Looking at the respective pyproject.toml files flit-core is entirely self-contained and can be built using itself. Then you can build pyproject-hooks, packaging and tomli using flit-core. And then pypa-build can be built using flit-core and all of the previous packages as dependencies. poetry-core is also self-contained and can be built without any dependencies (and the full poetry should never be required to build any project, but obviously packages in Guix use it for that purpose -.-). But none of this is really necessary, because – again – pypa-build is not used by pyproject-build-system. So I propose the following: - Create a python-team branch. - Use python-sans-pip-wrapper as default-python in pyproject-build-system, like I originally proposed and add python-setuptools/python-wheel where necessary. - Implement backend-path in pyproject-build-system, so we can bootstrap flit-core/poetry-core/… properly. - Expose ensure-no-mtimes-pre-1980 (#63044). - Finally fix python-yubikey-manager. Anything else that’s broken right now? Cheers, Lars
Hi Lars
Apologies for the delayed response (meant to earlier), top posting, and the formatting. The reason for all three is that I'm currently away from a proper computer for a few weeks but I'll be back at the beginning of June and can start hacking away then. Of course, happy to be beat to the job or have anything to build off of.
I'm not sure of any other deep python breakages, but definitely something to look at for the python branch. Although I'm not python expert, especially at packaging, I should probably add myself to the team when I'm back as well.
Thanks for the details and information, that's very helpful and sounds like a roadmap to have a clean and updated toolchain here.
John
-------- Original Message --------
On May 8, 2023, 3:44 PM, Lars-Dominik Braun wrote:
> Hi, > From what I remember and > thought, the newer python-pypa-build needs python-pyproject-hooks. > Which itself would be built with pyproject-build-system, creating a > circular dependency. ah, yes, you’re right. For some reason the current pyproject-build-system differs from my original proposal and bundles python-pypa-build in python-toolchain (even though it is not used). As we can see from this example doing so is a very very bad idea (because it leads to cycles). > But, I don't know anything about flit_core and > that system. So you are saying flit_core is used to build each of > these without a cycle then? > Can you layout what the new structure would be for updating > python-pypa-build with python-pyproject-hooks then? (And then > deprecate pep517.) In theory that would be possible if python-toolchain did not depend on pypa-build. Looking at the respective pyproject.toml files flit-core is entirely self-contained and can be built using itself. Then you can build pyproject-hooks, packaging and tomli using flit-core. And then pypa-build can be built using flit-core and all of the previous packages as dependencies. poetry-core is also self-contained and can be built without any dependencies (and the full poetry should never be required to build any project, but obviously packages in Guix use it for that purpose -.-). But none of this is really necessary, because – again – pypa-build is not used by pyproject-build-system. So I propose the following: - Create a python-team branch. - Use python-sans-pip-wrapper as default-python in pyproject-build-system, like I originally proposed and add python-setuptools/python-wheel where necessary. - Implement backend-path in pyproject-build-system, so we can bootstrap flit-core/poetry-core/… properly. - Expose ensure-no-mtimes-pre-1980 (#63044). - Finally fix python-yubikey-manager. Anything else that’s broken right now? Cheers, Lars
Hi John,
> Apologies for the delayed response (meant to earlier), top posting, and the formatting. The reason for all three is that I'm currently away from a proper computer for a few weeks but I'll be back at the beginning of June and can start hacking away then. Of course, happy to be beat to the job or have anything to build off of.
no worries. I also won’t have any time to look into this
for a few weeks. My (rather dirty) python-team branch is here:
https://github.com/PromyLOPh/guix/commits/python-team
Perhaps it helps you to fix this issue.
Cheers,
Lars
diff --git a/gnu/packages/python-build.scm b/gnu/packages/python-build.scm index 70719c44d4..45b9f52b68 100644 --- a/gnu/packages/python-build.scm +++ b/gnu/packages/python-build.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2020, 2021, 2022, 2023 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2022 Garek Dyszel <garekdyszel@disroot.org> ;;; Copyright © 2022 Greg Hogan <code@greghogan.com> +;;; Copyright © 2023 John Kehayias <john.kehayias@protonmail.com> ;;; ;;; This file is part of GNU Guix. @@ -381,6 +382,46 @@ (define-public python-pep517-bootstrap "Wrappers to build Python packages using PEP 517 hooks.") (license license:expat)))) +(define-public python-pyproject-hooks + (package + (name "python-pyproject-hooks") + (version "1.0.0") + (source (origin + (method url-fetch) + (uri (pypi-uri "pyproject_hooks" version)) + (sha256 + (base32 + "1xaf4sharvacqlav6w3b38nc4j0rzg0p4axi7zamanbzp6cb4wgj")))) + (build-system python-build-system) + (arguments + (list #:tests? #f ; disabled to avoid cycle + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'use-toml-instead-of-tomli + ;; Using toml instead of tomli eases bootstrapping. + (lambda _ + (substitute* "pyproject.toml" + (("\"tomli.*") + "\"toml\",")))) + (replace 'build + (lambda _ + (invoke "python" "-m" "build" "--wheel" "--no-isolation" "."))) + (replace 'install + (lambda _ + (let ((whl (car (find-files "dist" "\\.whl$")))) + (invoke "pip" "--no-cache-dir" "--no-input" + "install" "--no-deps" "--prefix" #$output whl))))))) + (native-inputs (list python-flit-core-bootstrap python-pypa-build-bootstrap)) + ;; XXX: python-wheel isn't needed but replicate the pep517 package or else + ;; fix packages which will then need python-whell as an input. + (propagated-inputs (list python-toml python-wheel)) + (home-page "https://pyproject-hooks.readthedocs.io") + (synopsis "Wrappers to call pyproject.toml-based build backend hooks") + (description "This is a low-level library for calling build-backends in +@code{pyproject.toml}-based project. It provides the basic functionality to +help write tooling that generates distribution files from Python projects.") + (license license:expat))) + (define-public python-pyparsing (package (name "python-pyparsing")