From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id iNoDNchIhV9pcQAA0tVLHw (envelope-from ) for ; Tue, 13 Oct 2020 06:27:20 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id CIfgMMhIhV+ObwAAB5/wlQ (envelope-from ) for ; Tue, 13 Oct 2020 06:27:20 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 77D39940149 for ; Tue, 13 Oct 2020 06:27:19 +0000 (UTC) Received: from localhost ([::1]:46990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSDmI-0005Kw-Dk for larch@yhetil.org; Tue, 13 Oct 2020 02:27:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSDls-0005Kf-Cx for help-guix@gnu.org; Tue, 13 Oct 2020 02:26:52 -0400 Received: from flashner.co.il ([178.62.234.194]:49190) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSDlp-0005iw-Tl for help-guix@gnu.org; Tue, 13 Oct 2020 02:26:52 -0400 Received: from localhost (unknown [141.226.15.20]) by flashner.co.il (Postfix) with ESMTPSA id C9D5A4021D; Tue, 13 Oct 2020 06:26:14 +0000 (UTC) Date: Tue, 13 Oct 2020 09:25:39 +0300 From: Efraim Flashner To: Zelphir Kaltstahl Subject: Re: usage of guix import / adding a package Message-ID: <20201013062539.GH1301@E5400> References: <85cf6cfd-5bc1-d04a-7fbb-28e012c40215@posteo.de> <20200717002706.6be8fcd6@tachikoma.lepiller.eu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="tT3UgwmDxwvOMqfu" Content-Disposition: inline In-Reply-To: X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Received-SPF: pass client-ip=178.62.234.194; envelope-from=efraim@flashner.co.il; helo=flashner.co.il X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/13 02:26:17 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: help-guix@gnu.org Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Spam-Score: -2.61 X-TUID: NVJ5awQQLI2z --tT3UgwmDxwvOMqfu Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 12, 2020 at 07:43:56PM +0200, Zelphir Kaltstahl wrote: > Hello Julien! >=20 > I think I did not yet reply to your e-mail yet. I put it off to "later" > and now it is much later. Sorry for my late reply and thank you for the > information already provided. >=20 > Meanwhile I have come across another case, where I would like to install > a package from PyPI and where I do not know how to proceed: >=20 > This time I have a more reproducible scenario using channels as well. >=20 > I have a `channels.scm` file: >=20 > ~~~~ > (list (channel > (name 'guix) > (url "https://git.savannah.gnu.org/git/guix.git") > (commit > "29a2eb36ff85eb75eeb907aa687fbb655b5f1097") > (introduction > (make-channel-introduction > "9edb3f66fd807b096b48283debdcddccfea34bad" > (openpgp-fingerprint > "BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA"))))) > ~~~~ >=20 > A `manifest.scm` file: >=20 > ~~~~ > (specifications->manifest > '("python" > "python-django")) > ~~~~ >=20 > And I have a `django-mptt.scm` file, created using `guix import pypi > --recursive django-mptt` and by adding required imports and expressions > at the bottom for actually returning something, as indicated by comments: >=20 Replying a bit out of order, the error below means it doesn't know what "python-django" is. 'guix package -A python-django' shows that the package definition exists in gnu/packages/django.scm > ~~~~ > ;; add module imports > (use-modules > (guix packages) > (guix download) > (guix build-system python) (gnu packages django) > ((guix licenses) #:prefix license:)) >=20 > (define-public python-django-js-asset > (package > (name "python-django-js-asset") > (version "1.2.2") > (source > (origin > (method url-fetch) > (uri (pypi-uri "django-js-asset" version)) > (sha256 > (base32 > "0q3j2rsdb2i7mvncy9z160cghcggvk87q14qnn7jvcp0sa0awqy1")))) > (build-system python-build-system) > (home-page > "https://github.com/matthiask/django-js-asset/") > (synopsis > "script tag with additional attributes for django.forms.Media") > (description > "script tag with additional attributes for django.forms.Media") > (license license:bsd-3))) >=20 > (define-public python-django-mptt > (package > (name "python-django-mptt") > (version "0.11.0") > (source > (origin > (method url-fetch) > (uri (pypi-uri "django-mptt" version)) > (sha256 > (base32 > "1a4m32yb85bamfpjrg4r1ywz4x21az44wm5hb12dsz6jbbvkmnyz")))) > (build-system python-build-system) > (propagated-inputs > `(("python-django" ,python-django) > ("python-django-js-asset" > ,python-django-js-asset))) > (home-page > "https://github.com/django-mptt/django-mptt") > (synopsis > "Utilities for implementing Modified Preorder Tree Traversal with y= our Django Models and working with trees of Model instances.") > (description > "Utilities for implementing Modified Preorder Tree Traversal with y= our Django Models and working with trees of Model instances.") > (license license:expat))) >=20 > ;; add result expression > python-django-mptt > ~~~~ >=20 > Then to make an environment I do the following: >=20 > ~~~~ > guix time-machine --channels=3Dchannels.scm -- environment --load=3Ddjang= o-mptt.scm --manifest=3Dmanifest.scm > ~~~~ >=20 > Which results in: >=20 > ~~~~ > ... (happily downloading and building stuff here) ... >=20 > Backtrace: > 17 (primitive-load "/home/xiaolong/.cache/guix/inferiors/s=E2= =80=A6") > In guix/ui.scm: > 2115:12 16 (run-guix-command _ . _) > In ice-9/boot-9.scm: > 1736:10 15 (with-exception-handler _ _ #:unwind? _ # _) > 1731:15 14 (with-exception-handler # =E2=80=A6) > 1736:10 13 (with-exception-handler _ _ #:unwind? _ # _) > In guix/store.scm: > 631:37 12 (thunk) > 1300:8 11 (call-with-build-handler # =E2=80=A6) > In guix/status.scm: > 776:4 10 (call-with-status-report _ _) > In guix/scripts/environment.scm: > 345:4 9 (_) > In srfi/srfi-1.scm: > 673:15 8 (append-map _ _ . _) > 586:29 7 (map1 _) > 586:17 6 (map1 ((load package "django-mptt.scm") (system . "=E2=80=A6= ") =E2=80=A6)) > In guix/scripts/environment.scm: > 126:37 5 (packages->outputs # =E2=80=A6) > In guix/packages.scm: > 1145:16 4 (package->bag _ _ _ #:graft? _) > 1252:48 3 (thunk) > In /home/xiaolong/dev/guix/guix-package-manager-tutorials/django-example/= django-mptt.scm: > 29:2 2 (propagated-inputs _) > In ice-9/boot-9.scm: > 1669:16 1 (raise-exception _ #:continuable? _) > 1669:16 0 (raise-exception _ #:continuable? _) >=20 > ice-9/boot-9.scm:1669:16: In procedure raise-exception: > error: python-django: unbound variable > ~~~~ >=20 > Now this is the point, where I do not know how to continue. It seems I > am quite close to get it working, just that somewhere I need to put > `python-django`. Perhaps I need to add it to `django-mptt.scm` > somewhere? But how would I specify 2 or more "exports" from that file? >=20 > If I try to write a list instead of only a non-compound value at the > bottom of `django-mptt`, as follows: >=20 > ~~~~ > ... (more stuff before this as seen above) ... >=20 > ;; add result expression > '(python-django-mptt python-django) > ~~~~ >=20 > I get the following: >=20 > ~~~~ > Backtrace: > 16 (primitive-load "/home/xiaolong/.cache/guix/inferiors/s=E2= =80=A6") > In guix/ui.scm: > 2115:12 15 (run-guix-command _ . _) > In ice-9/boot-9.scm: > 1736:10 14 (with-exception-handler _ _ #:unwind? _ # _) > 1731:15 13 (with-exception-handler # =E2=80=A6) > 1736:10 12 (with-exception-handler _ _ #:unwind? _ # _) > In guix/store.scm: > 631:37 11 (thunk) > 1300:8 10 (call-with-build-handler # =E2=80=A6) > In guix/status.scm: > 776:4 9 (call-with-status-report _ _) > In guix/scripts/environment.scm: > 345:4 8 (_) > In srfi/srfi-1.scm: > 673:15 7 (append-map _ _ . _) > 586:29 6 (map1 _) > 586:17 5 (map1 ((load package "django-mptt.scm") (system . "=E2=80=A6= ") =E2=80=A6)) > 673:15 4 (append-map # =E2=80=A6) > 586:17 3 (map1 (python-django-mptt python-django)) > In guix/scripts/environment.scm: > 331:4 2 (packages->outputs _ _) > In ice-9/boot-9.scm: > 1669:16 1 (raise-exception _ #:continuable? _) > 1669:16 0 (raise-exception _ #:continuable? _) >=20 > ice-9/boot-9.scm:1669:16: In procedure raise-exception: > Throw to key `match-error' with args `("match" "no matching pattern" pyth= on-django-mptt)'. > ~~~~ >=20 > How do I get this working? >=20 > Best regards, > Zelphir >=20 > On 7/17/20 12:27 AM, Julien Lepiller wrote: > > Le Fri, 17 Jul 2020 00:10:36 +0200, > > Zelphir Kaltstahl a =C3=A9crit : > > > >> Hello Guix Users! > >> > >> I read on > >> https://guix.gnu.org/manual/en/html_node/Invoking-guix-import.html: > >> > >> "The guix import command is useful for people who would like to add a > >> package to the distribution with as little work as possible=E2=80=94a > >> legitimate demand. The command knows of a few repositories from which > >> it can =E2=80=9Cimport=E2=80=9D package metadata. The result is a pack= age definition, > >> or a template thereof, in the format we know (see Defining Packages)." > >> > >> I've recently tried this, for example for MyPy: > >> > >> ~~~~ > >> guix import pypi -r mypy > >> ~~~~ > >> > >> This will result in Guile code printed to my terminal. However, I do > >> not understand how to make use of that code. I do not understand how > >> I can load it. For example I tried using the -l argument with guix > >> environment: > >> > >> ~~~~ > >> guix import pypi -r mypy > additional_file.scm > >> guix environment --pure --load=3Dadditional_file.scm --ad-hoc > >> python@3.8.2 /home/user/dev/Python/additional_file.scm:2:2: error: > >> package: unbound variable hint: Did you forget `(use-modules (guix > >> packages))'? ~~~~ > >> > >> So that seems to be the wrong way of trying to make use of it. > >> > >> Do I need to provide a patch to the project of the Guix package > >> manager to add this to Guix packages in general and then be able to > >> use it in my local setup? > >> > >> I do not find the info, how I can now use MyPy inside an environment > >> or add it to the available packages on any of the following pages: > >> > >> - > >> https://guix.gnu.org/manual/en/html_node/Python-Modules.html#Python-Mo= dules > >> > >> - https://guix.gnu.org/manual/en/html_node/Invoking-guix-import.html > >> > >> While https://guix.gnu.org/manual/en/html_node/Submitting-Patches.html > >> makes me think, that perhaps I need to submit it as patch to be able > >> to use MyPy. > >> > >> If so, how would I test, whether guix import did its thing correctly? > >> I could try running MyPy in an environment, but for that I would have > >> to somehow make use of what guix import gives me, before submitting a > >> patch. > >> > >> Also, if I need to submit a patch adding the guix import output > >> somewhere, is there a guide on how to create such a patch for the Guix > >> project? > >> > >> Regards, > >> Zelphir > >> > > Hi zelphir, > > > > You don't need to send a patch, although it would be very welcome. You > > should read > > https://guix.gnu.org/manual/devel/en/html_node/Defining-Packages.html > > where you can learn about package modules and how to import missing > > modules that cause the issue you are having. Basically, you need a > > header such as > > > > (use-modules (gnu) (guix packages)) > > etc... > > > > Then, you'll have to make sure your file returns something: guix import > > -r will return you a code that defines one or more variables, but > > nothing is returned. If you don't do anything, after adding the > > required headers, you'll simply see an error about #. > > > > Put the name of the package you want to build in its own line at the > > very end of the file, like: > > > > pyhon-mypyt > > > > > > this will ensure the value associated with that variable is returned > > from the file, and you will be able to load the file with guix > > environment -l or guix build -f. > > > > HTH! >=20 > --=20 > repositories: https://notabug.org/ZelphirKaltstahl >=20 --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --tT3UgwmDxwvOMqfu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl+FSF4ACgkQQarn3Mo9 g1G3UBAApor8E46son8+H/4Zljm+X+cFTbBnd+rRYZtA1qjum1gASfYuJNtaJ8vO yem7ZNmI8BYNFyZEK/SKLmltxoJxGSaEO1XKtpindeeF+UtBts2m+utBvm/pr2ND eSuTeAbsucirhsM/lmOLUEb3L5EjtyoN29+e+GVqNeAMJyjyV+zd1ko7rCBtL0cj J75OaUpfsXyNr/Il7M1QGI23pCJAOOhqVEouQLggdHVC34wW697TevxNGdCnx+Ht hdLOEhz6WpwN4yOADBzs/4/EAS/Y9rg/RQSgptKvjQhjNMAIk+lkkMj9410bIr5G U/buWFF06o0oTVxJ6YuoBMqxFEX9tJ+UcXX6Qgy+xuYp9RWQbPSlfyYQEYyKtRXV dAASsmOGEFYu0is8ZRWfnpkDkcbuKzee0mtIynioJKEBZsSkXuL/1mED3Dy5kM7s CtHjnRz5pKZDjjL8zcdShksJGCO1P4casB2v2QBRvk5CNTUO42oATgG45gy7CixA fhoICptf+/GgZXZr/XOVfG5lzXqJXhXJzMqw8Vr9EFUPIdN7y19JxczvQmDHojMy 9QDtxM438hDtpUUx18qQRsAhMyBAUdLwI7u3hUiViSnSj1XgqGqD8RPAdi6CJscs AEtHgbpgt+rUdLLTCKvhNVSxEoewffVkcnkpCvjWYOR4eh/+SiY= =Uuxi -----END PGP SIGNATURE----- --tT3UgwmDxwvOMqfu--