From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id GLKfGDQEhl8NNAAA0tVLHw (envelope-from ) for ; Tue, 13 Oct 2020 19:47:00 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id sPmgFDQEhl8xRgAAbx9fmQ (envelope-from ) for ; Tue, 13 Oct 2020 19:47:00 +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 8BFF89402A8 for ; Tue, 13 Oct 2020 19:46:59 +0000 (UTC) Received: from localhost ([::1]:35516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSQGA-0003SZ-FC for larch@yhetil.org; Tue, 13 Oct 2020 15:46:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSQDi-0001mm-91 for help-guix@gnu.org; Tue, 13 Oct 2020 15:44:26 -0400 Received: from mout01.posteo.de ([185.67.36.65]:35303) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSQDe-0002k4-T7 for help-guix@gnu.org; Tue, 13 Oct 2020 15:44:25 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 900FB160061 for ; Tue, 13 Oct 2020 21:44:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1602618259; bh=+uL6aFgKLO6o7lWwOdOmmkBZKOV2majdTCHNRRsVBwg=; h=Subject:To:Cc:From:Date:From; b=VzB5v4vIABXT1CvQxxfJngSmix2wJXASaPgApxgSBvVStZhcGybmE2hc2yLrtdW+a c3EiLUbadBep6S0bljAllEhfXBTf+MVPNA+94BvrOiagmCnMXFdut677pGhP6MK/XU MYtAn3PxPvphaexPZwE+yO8fvvE2tOrUzpyMNK0dY0fcoTh2G+q2f8uuptG8/TIO5s eEN+o3EyFp8I6osyvw3mPeeydCByc0USEtFqvwVLx/FXLyAmGNB9X5X64vzpcWpgkC YSN5GCDyAj4LpRZzoZptk8aTyE8V1dz1seeRnvru94AKBdy7il+qQdL/nsTU7zCWqr biwtOofiQDcKQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4C9mFt2yYfz6tmg; Tue, 13 Oct 2020 21:44:18 +0200 (CEST) Subject: Re: usage of guix import / adding a package To: Efraim Flashner References: <85cf6cfd-5bc1-d04a-7fbb-28e012c40215@posteo.de> <20200717002706.6be8fcd6@tachikoma.lepiller.eu> <20201013062539.GH1301@E5400> From: Zelphir Kaltstahl X-Tagtoolbar-Keys: D20201013214417463 Message-ID: <6c739bdb-ec37-b123-47ca-3bb27bdd6803@posteo.de> Date: Tue, 13 Oct 2020 21:44:17 +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: <20201013062539.GH1301@E5400> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US Received-SPF: pass client-ip=185.67.36.65; envelope-from=zelphirkaltstahl@posteo.de; helo=mout01.posteo.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/13 15:44:19 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, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=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 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 (rsa verify failed) header.d=posteo.de header.s=2017 header.b=VzB5v4vI; 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: 21/WTH3w7/9V Thank you Efraim, that was the missing bit. Any idea, why Guix cannot write those imports itself? Doesn't it already know about them, as dependencies of python-django-mptt, as defined in the setup.py file https://github.com/django-mptt/django-mptt/blob/master/setup.py? On 10/13/20 8:25 AM, Efraim Flashner wrote: > On Mon, Oct 12, 2020 at 07:43:56PM +0200, Zelphir Kaltstahl wrote: >> 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: >> > 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:)) >> >> (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 >> -- repositories: https://notabug.org/ZelphirKaltstahl