[PATCH] gnu: python-libcst: Update to 1.6.0.

  • Open
  • quality assurance status badge
Details
3 participants
  • Efraim Flashner
  • Ricardo Wurmus
  • Sharlatan Hellseher
Owner
unassigned
Submitted by
Efraim Flashner
Severity
normal
E
E
Efraim Flashner wrote on 21 Jan 17:17 +0100
(address . guix-patches@gnu.org)(name . Efraim Flashner)(address . efraim@flashner.co.il)
b0f2bd2d2dd298fc067fbf1ff6e26b1e8a8a5ac8.1737476019.git.efraim@flashner.co.il
* gnu/packages/python-xyz.scm (python-libcst): Update to 1.6.0.
[source]: Add snippet to satisfy cargo-build-system.
[build-system]: Switch to cargo-build-system.
[arguments]: Import cargo-build-system, pyproject-build-system modules.
Add cargo-inputs, cargo-development-inputs. Replace 'build, 'install
with the pyproject-build-system phases. Add a phase after 'install for
the extra pyproject phases. Add 2 phases to help build the project.
[native-inputs]: Add python-minimal-wrapper, python-hypothesmith,
python-setuptools-rust, python-setuptools-scm.
[inputs]: Add maturin.
[propagated-inputs]: Remove python-typing-extensions,
python-typing-inspect.
(python-libcst-minimal)[arguments]: Inherit phases from python-libcst
while still skipping the tests.
[native-inputs]: Add python-minimal-wrapper, python-setutools-rust,
python-setuptools-scm.

Change-Id: I7b5ba5404f6e726976af25c0f7db7db2d00bedc5
---
gnu/packages/python-xyz.scm | 111 ++++++++++++++++++++++++++++--------
1 file changed, 86 insertions(+), 25 deletions(-)

Toggle diff (154 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 41735a78ead..8a634a77faf 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -197,6 +197,7 @@ (define-module (gnu packages python-xyz)
#:use-module (gnu packages cmake)
#:use-module (gnu packages compression)
#:use-module (gnu packages cpp)
+ #:use-module (gnu packages crates-check)
#:use-module (gnu packages crates-io)
#:use-module (gnu packages crates-windows)
#:use-module (gnu packages crypto)
@@ -22981,40 +22982,95 @@ (define-public python-lark-parser
(define-public python-libcst
(package
(name "python-libcst")
- (version "0.3.18") ; starting from 0.4.0 project depends on Rust
+ (version "1.6.0")
(source (origin
(method url-fetch)
(uri (pypi-uri "libcst" version))
(sha256
(base32
- "1ll0yyxbz8zyqcy9kfcqi3l5fah2zqisvpjbzjnz7s7dmb84q59h"))))
- (build-system pyproject-build-system)
+ "1nzhvg52whpmfv8fkrnv7rlrmgc5m43hpyp8ra9kffx47yzcs3p8"))
+ (snippet
+ #~(begin (use-modules (guix build utils))
+ ;; This is mostly to keep the cargo-build-system happy
+ (with-output-to-file "Cargo.toml"
+ (lambda ()
+ (format #t "\
+[workspace]
+
+members = [
+ \"native\",]")))))))
+ (build-system cargo-build-system)
(arguments
(list
- #:test-flags
- #~(list
- ;; Reported upstream: <https://github.com/Instagram/LibCST/issues/346>.
- "--ignore=libcst/tests/test_fuzz.py"
- ;; Reported upstream: <https://github.com/Instagram/LibCST/issues/347>.
- "--ignore=libcst/tests/test_pyre_integration.py"
- "--ignore=libcst/codemod/tests/test_codemod_cli.py"
- "--ignore=libcst/metadata/tests/test_full_repo_manager.py"
- "--ignore=libcst/metadata/tests/test_type_inference_provider.py"
- "-k" (string-join
- ;; AssertionError: False is not true : libcst.matchers.__init__
- ;; needs new codegen!
- (list "not test_codegen_clean_matcher_classes"
- "test_codegen_clean_return_types"
- "test_codegen_clean_visitor_functions")
- " and not "))))
+ #:install-source? #false
+ #:cargo-test-flags
+ ;; According to .github/workflows/ci.yml
+ '(list "--manifest-path=native/Cargo.toml"
+ "--release"
+ "--no-default-features")
+ #:cargo-inputs
+ (list rust-chic-1
+ rust-memchr-2
+ rust-paste-1
+ rust-peg-0.8
+ rust-pyo3-0.22
+ rust-quote-1
+ rust-regex-1
+ rust-syn-2
+ rust-thiserror-1)
+ #:cargo-development-inputs
+ (list rust-criterion-0.5
+ rust-difference-2
+ rust-itertools-0.13
+ rust-rayon-1
+ rust-trybuild-1)
+ #:imported-modules `(,@%pyproject-build-system-modules
+ ,@%cargo-build-system-modules)
+ #:modules `((guix build cargo-build-system)
+ ((guix build pyproject-build-system) #:prefix py:)
+ (guix build utils))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'prepare-source
+ (lambda _
+ (delete-file "native/Cargo.lock")))
+ (add-after 'configure 'dont-vendor-self
+ (lambda* (#:key vendor-dir #:allow-other-keys)
+ ;; Don't keep the whole tarball in the vendor directory
+ (delete-file-recursively
+ (string-append vendor-dir "/libcst-" #$version ".tar.zst"))))
+ (replace 'build
+ (assoc-ref py:%standard-phases 'build))
+ (add-after 'install 'wrap
+ (lambda _
+ ;; Collection of python- and pyproject-build-system phases
+ ;; between 'install and 'check.
+ (assoc-ref py:%standard-phases 'add-install-to-pythonpath)
+ (assoc-ref py:%standard-phases 'add-install-to-path)
+ (assoc-ref py:%standard-phases 'wrap)
+ (assoc-ref py:%standard-phases 'create-entrypoints)
+ (assoc-ref py:%standard-phases 'compile-bytecode)))
+ ;; We are not the only ones who cannot load libcst.native
+ ;; during the 'check phase
+ ;; https://github.com/Instagram/LibCST/issues/1176
+ ;(add-after 'wrap 'python-check
+ ; (lambda args
+ ; (apply (assoc-ref py:%standard-phases 'check)
+ ; #:test-flags '()
+ ; args)))
+ (replace 'install
+ (assoc-ref py:%standard-phases 'install)))))
(native-inputs
- (list python-pytest
+ (list python-minimal-wrapper
+ python-hypothesmith
+ python-pytest
python-setuptools
+ python-setuptools-rust
+ python-setuptools-scm
python-wheel))
+ (inputs (list maturin))
(propagated-inputs
- (list python-typing-extensions
- python-typing-inspect
- python-pyyaml))
+ (list python-pyyaml))
(home-page "https://github.com/Instagram/LibCST")
(synopsis "Concrete Syntax Tree (CST) parser and serializer library for Python")
(description
@@ -23037,9 +23093,14 @@ (define-public python-libcst-minimal
(package
(inherit python-libcst)
(name "python-libcst-minimal")
- (arguments '(#:tests? #f))
+ (arguments
+ (substitute-keyword-arguments (package-arguments python-libcst)
+ ((#:tests? _ #t) #f)))
(native-inputs
- (list python-setuptools
+ (list python-minimal-wrapper
+ python-setuptools
+ python-setuptools-rust
+ python-setuptools-scm
python-wheel)))))
(define-public python-typeapi

base-commit: cf34ba66cf614358dfac925212d6a9074e318d80
--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
S
S
Sharlatan Hellseher wrote on 24 Jan 13:43 +0100
(address . 75732@debbugs.gnu.org)
87v7u4gz5o.fsf@gmail.com
Hi Efraim,

Thanks for picking it up, more and more lower level Python packages
started requiring Rust, which would we a common strategy in such cases?


Toggle snippet (3 lines)
Building the following 1 package would ensure 4 dependent packages are
rebuilt: orange@3.32.0
There is no many direct depednencies on this package only on minimal
varian. Used in python-isort, python-hypothesmith, and Orange is broken
for a long time.

Toggle snippet (3 lines)
> ./pre-inst-env guix refresh --list-dependent python-isort python-hypothesmith
Building the following 72 packages would ensure 126 dependent packages are rebuilt:
I'd say it's save to push it on Master.

CC Ricardo if he works on it as well as part of python-team path to
Python 3.11.

Patch LGFM.

--
Oleg
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEmEeB3micIcJkGAhndtcnv/Ys0rUFAmeTiwMACgkQdtcnv/Ys
0rXnYxAAnUH9UPmdffXm023qGVt/BnA9Pjc45XAufXeypctq7bX2qF1IuAjxUv+T
Axd1uuEFTrUrJbWzsNgbSXD1+heUvC2vdOzHu+R7Qlmb7Dg8EK9hBHZRqmd1h0Z6
NXAtShLOHEkC/CTae7UCrcpeHX6UgMMAPkvSsxIQvkg9jY9hki8rGn/inhxXk7J2
q2zfoGjXjXaqxfsAQscfMr571INPEfMGg8VLxX3PsTpabODJ6YwbBJWOhvRaME6K
zcIrkswgpfxAJjxiebu4GEeLMOybUEKshj4t/l4vH2ahvttHVo2sNKoUjrWdug40
CR5xOoPmOiqxVuBQvHiHl5bywaM/I1sbyTh0+WeMW4DZJrD0I21kZP/3n4Ej7TM3
6btUAFwAF9/vWNPRlzP+k5KyiFuqoFmSwjXBNuDY2dB0pVxg8WaMGePEC8YqZd1V
MLozTrcK683d73V9uVf0fkiNpISD1PrYvtRzvLCbufjSXA+s0Uayu6kM8dvghf57
lBiwDJanqa1sEzCOG1reI/mjwTUWIJkYcmIiQl60KP5DHDRyq2gWcuZPIWp4FV3K
8JJtxTxJESpvwhZT9GVNatvGVvRl2uCWd9mK7c2tXBXqgn8E31TEntuADKHaBCwj
x/pJaQXv59xAsGbgzCu9iMDdoWodm/D2Fr9cObhyFEMhFZ+Ey5I=
=oPuG
-----END PGP SIGNATURE-----

R
R
Ricardo Wurmus wrote on 24 Jan 15:40 +0100
(name . Sharlatan Hellseher)(address . sharlatanus@gmail.com)
87y0z01dih.fsf@elephly.net
Sharlatan Hellseher <sharlatanus@gmail.com> writes:

Toggle quote (2 lines)
> I'd say it's save to push it on Master.

Yes, should be fine.

Toggle quote (3 lines)
> CC Ricardo if he works on it as well as part of python-team path to
> Python 3.11.

I haven't yet done much on python-team other than break thousands of
packages :)

--
Ricardo
E
E
Efraim Flashner wrote on 26 Jan 08:45 +0100
(name . Ricardo Wurmus)(address . rekado@elephly.net)
Z5XoFFAEEIQuxKgk@3900XT
On Fri, Jan 24, 2025 at 03:40:22PM +0100, Ricardo Wurmus wrote:
Toggle quote (12 lines)
> Sharlatan Hellseher <sharlatanus@gmail.com> writes:
>
> > I'd say it's save to push it on Master.
>
> Yes, should be fine.
>
> > CC Ricardo if he works on it as well as part of python-team path to
> > Python 3.11.
>
> I haven't yet done much on python-team other than break thousands of
> packages :)

That still counts :)

If all the packages use maturin then I think we could make a
maturin-build-system, but perhaps a combo python-with-rust build system
would work better. I'd love to run the sanity-check phase and have
easier access to all the flags of the different build systems, as well
as the option of toggling the rust tests separately.

We might also want to either wrap maturin with python-minimal-wrapper or
propagate it since I'm pretty sure we always need both.

--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmeV6BQACgkQQarn3Mo9
g1FnQBAAld7AP6eRr1+dlrGRgxGCKlg5uWddKj9ugMJOlIQ8M3ldgXYJbrhKLbGl
UIiLLlgPGJMoYMR+9+d3X7ABZXA9pyTqSk7XpnOszopK2I5yOmAwgBTOqLvAqhjH
h8I+Dx5dNy+dUPH568NILAgLwLrU/CVS+MJPw13/I6kcUl0OrJ44eozJJ52rCw9Y
RB8GpKNo1n8ltw9VSxghnJZeLNXEo4tnXqgdRJggOU3Hkse5Y5RqbIetTPzLdmbK
8CeudTEoFw9z9ZQ42sq8NIQHSwD6T288olV6zBMwQrH2KH9NrPf/l/kFjlV2oCjl
yDgoT6vjrO4XYzemEbDwxVj+q9ifsvEgeOfaROBvu+oB9x34K80j50lZIkGGv9vp
Fza93B+dxNRfq8LZLJ0RaGbkndUMy9Z2Nrh66pdxrtovK9ihb4FrrStsadQvMpZO
EUvtawTK1t1s0uyRncoKMOHy+3DZRszS3pnlRmAmUH/vnIJWQr7KbBHWd0q6hjOo
ZOHgMsiGfmKrpi3Bnpz8QeFoaa1lOousgIxUoMCyJ7Vf5TB2eS36+HIdfzMRFyTG
DqeJQOJdXwq30ha6vBsU9KYHfeBhhZ5S5C1NsyzpoqmwtIYZIYYYEKqypFsdO8Y/
bqXXTrdhL5HWd5baaR+FPKr2fZYugbhQi+fhcUIQ/82E9w1TEE8=
=FYTU
-----END PGP SIGNATURE-----


?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 75732@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 75732
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch