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 8JmlL+2VhF/MLAAA0tVLHw (envelope-from ) for ; Mon, 12 Oct 2020 17:44:13 +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 +CR2K+2VhF+gNwAAB5/wlQ (envelope-from ) for ; Mon, 12 Oct 2020 17:44:13 +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 10496940149 for ; Mon, 12 Oct 2020 17:44:13 +0000 (UTC) Received: from localhost ([::1]:51950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS1rn-0006Tf-N1 for larch@yhetil.org; Mon, 12 Oct 2020 13:44:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kS1rf-0006TV-3h for help-guix@gnu.org; Mon, 12 Oct 2020 13:44:03 -0400 Received: from mout02.posteo.de ([185.67.36.66]:47101) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kS1rb-000782-Bq for help-guix@gnu.org; Mon, 12 Oct 2020 13:44:02 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 409A7240101 for ; Mon, 12 Oct 2020 19:43:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1602524637; bh=j5vlwY15hMRIXJKonFTJO2O4ic3nbGm6IIj79dNhf0o=; h=Subject:To:Cc:From:Date:From; b=YHD3DCYRgJMRHxiIViYbC8kB2tgjVjkEJWgkrJ6w3pVEeblE5/EFzQRRQZWby/MTF Apj1LeUcL1nPDh/2K1nvFt3iFJy7/LcjT1oak6/CMebmVIcmhQ6xglYe1AYnwixFqH ky9T+uWyaT/+fUGgLuxMr0YnOFtANzAX6m7q/R3Sf6e6rPbJ261I9v9iO06DfIeV6f F36BeM95VY2y87cY38zPRoqsUQo4jKnDcd3macehBYuvE3NNsLZdft2ljsFoMZ8/1V Lylp/xsvFXbayIVjm8fsZea3v812JekRM0Bx3GPotEgi1275/itz7L8Avy1C+qEGi8 s5PX/vw5cj6LA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4C95dS4VXdz9rxL; Mon, 12 Oct 2020 19:43:56 +0200 (CEST) Subject: Re: usage of guix import / adding a package To: Julien Lepiller References: <85cf6cfd-5bc1-d04a-7fbb-28e012c40215@posteo.de> <20200717002706.6be8fcd6@tachikoma.lepiller.eu> From: Zelphir Kaltstahl X-Tagtoolbar-Keys: D20201012194356102 Message-ID: Date: Mon, 12 Oct 2020 19:43:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200717002706.6be8fcd6@tachikoma.lepiller.eu> Content-Language: en-US Received-SPF: pass client-ip=185.67.36.66; envelope-from=zelphirkaltstahl@posteo.de; helo=mout02.posteo.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/12 09:58:43 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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=fail (body hash did not verify) header.d=posteo.de header.s=2017 header.b=YHD3DCYR; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.de (policy=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: 0.09 X-TUID: yUU0bVyQrXSY Hello Julien! 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. 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: This time I have a more reproducible scenario using channels as well. I have a `channels.scm` file: ~~~~ (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"))))) ~~~~ A `manifest.scm` file: ~~~~ (specifications->manifest '("python" "python-django")) ~~~~ 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: ~~~~ ;; add module imports (use-modules (guix packages) (guix download) (guix build-system python) ((guix licenses) #:prefix license:)) (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))) (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 your Django Models and working with trees of Model instances.") (description "Utilities for implementing Modified Preorder Tree Traversal with your Django Models and working with trees of Model instances.") (license license:expat))) ;; add result expression python-django-mptt ~~~~ Then to make an environment I do the following: ~~~~ guix time-machine --channels=channels.scm -- environment --load=django-mptt.scm --manifest=manifest.scm ~~~~ Which results in: ~~~~ ... (happily downloading and building stuff here) ... Backtrace: 17 (primitive-load "/home/xiaolong/.cache/guix/inferiors/s…") 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 # …) 1736:10 13 (with-exception-handler _ _ #:unwind? _ # _) In guix/store.scm: 631:37 12 (thunk) 1300:8 11 (call-with-build-handler # …) 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 . "…") …)) In guix/scripts/environment.scm: 126:37 5 (packages->outputs # …) 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? _) ice-9/boot-9.scm:1669:16: In procedure raise-exception: error: python-django: unbound variable ~~~~ 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? If I try to write a list instead of only a non-compound value at the bottom of `django-mptt`, as follows: ~~~~ ... (more stuff before this as seen above) ... ;; add result expression '(python-django-mptt python-django) ~~~~ I get the following: ~~~~ Backtrace: 16 (primitive-load "/home/xiaolong/.cache/guix/inferiors/s…") 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 # …) 1736:10 12 (with-exception-handler _ _ #:unwind? _ # _) In guix/store.scm: 631:37 11 (thunk) 1300:8 10 (call-with-build-handler # …) 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 . "…") …)) 673:15 4 (append-map # …) 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? _) ice-9/boot-9.scm:1669:16: In procedure raise-exception: Throw to key `match-error' with args `("match" "no matching pattern" python-django-mptt)'. ~~~~ How do I get this working? Best regards, Zelphir On 7/17/20 12:27 AM, Julien Lepiller wrote: > Le Fri, 17 Jul 2020 00:10:36 +0200, > Zelphir Kaltstahl a écrit : > >> 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—a >> legitimate demand. The command knows of a few repositories from which >> it can “import” package metadata. The result is a package 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=additional_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-Modules >> >> - 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! -- repositories: https://notabug.org/ZelphirKaltstahl