GNU bug report logs - #64869
[PATCH 0/2] Add pipx package manager for Python applications

Previous Next

Package: guix-patches;

Reported by: Wojtek Kosior <koszko <at> koszko.org>

Date: Wed, 26 Jul 2023 09:07:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 64869 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to lars <at> 6xq.net, jgart <at> dismail.de, guix-patches <at> gnu.org:
bug#64869; Package guix-patches. (Wed, 26 Jul 2023 09:07:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Wojtek Kosior <koszko <at> koszko.org>:
New bug report received and forwarded. Copy sent to lars <at> 6xq.net, jgart <at> dismail.de, guix-patches <at> gnu.org. (Wed, 26 Jul 2023 09:07:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Wojtek Kosior <koszko <at> koszko.org>
To: guix-patches <at> gnu.org
Cc: Wojtek Kosior <koszko <at> koszko.org>
Subject: [PATCH 0/2] Add pipx package manager for Python applications
Date: Wed, 26 Jul 2023 11:05:37 +0200
This series adds pipx, a tool similar to pip but oriented towards installation
of Python applications rather than libraries, with automatic isolation of
installed packages.

Other distros are now changing pip to recommend using pipx instead[1]. Whether
or not Guix will do the same, it seems like a good idea to at least have pipx
available in the repos.

I was unsure whether python-pipx should go into python-build or
python-xyz. python-pip is declared in the former, python-virtualenv in the
latter. In the end I chose python-xyz.

Tests have been disabled because those of python-userpath rely on `docker pull`
and those of python-pipx rely on application wheels from PyPI. It might be
possible to enable at least some tests of python-pipx by using wheels from
Guix. Rn I did not, however, have time to investigate.

I tested the new package(s) with:

#BEGIN_EXAMPLE
./pre-inst-env guix lint python-userpath python-pipx
guix gc -D /gnu/store/*python-userpath-1.9.0 /gnu/store/*python-pipx-1.2.0
./pre-inst-env guix build python-userpath --rounds=3
./pre-inst-env guix build python-pipx --rounds=3
./pre-inst-env guix shell -C coreutils python-pipx findutils which less bash --network --no-cwd
pipx install pycowsay
pipx ensurepath
bash -l
pycowsay moooo
pipx uninstall pycowsay
#END_EXAMPLE

[1] https://pythonspeed.com/articles/externally-managed-environment-pep-668/

Wojtek Kosior (2):
  gnu: Add python-userpath.
  gnu: Add python-pipx.

 gnu/packages/python-xyz.scm | 77 +++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)


base-commit: 76e041f9eef85bb039c5251d3350c62ee2066883
-- 
2.41.0





Information forwarded to lars <at> 6xq.net, jgart <at> dismail.de, guix-patches <at> gnu.org:
bug#64869; Package guix-patches. (Wed, 26 Jul 2023 09:10:02 GMT) Full text and rfc822 format available.

Message #8 received at 64869 <at> debbugs.gnu.org (full text, mbox):

From: Wojtek Kosior <koszko <at> koszko.org>
To: 64869 <at> debbugs.gnu.org
Cc: Wojtek Kosior <koszko <at> koszko.org>
Subject: [PATCH 1/2] gnu: Add python-userpath.
Date: Wed, 26 Jul 2023 11:09:01 +0200
* gnu/packages/python-xyz.scm (python-userpath): New variable.
---
 gnu/packages/python-xyz.scm | 39 +++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index db3e69fb45..022d26694c 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -139,6 +139,7 @@
 ;;; Copyright © 2023 Dominik Delgado Steuter <d <at> delgado.nrw>
 ;;; Copyright © 2023 Ivan Vilata-i-Balaguer <ivan <at> selidor.net>
 ;;; Copyright © 2023 Ontje Lünsdorf <ontje.luensdorf <at> dlr.de>
+;;; Copyright © 2023 Wojtek Kosior <my-contribution-is-licensed-cc0 <at> koszko.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -5223,6 +5224,44 @@ (define-public python-virtualenv-clone
      "Clone non-relocatable virtualenvs without breaking site-packages.")
     (license license:expat)))
 
+(define-public python-userpath
+  (package
+    (name "python-userpath")
+    (version "1.9.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/ofek/userpath")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1zrbjb54h5p7f1xadk93by1663asr38jg6qs1jsaalsfz7x83v3z"))))
+    (build-system pyproject-build-system)
+    (native-inputs (list python-hatchling))
+    (arguments
+     `(#:tests? #f ;tests depend on a docker image
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'install-doc
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((doc (string-append (assoc-ref outputs "out") "/share/doc")))
+               (mkdir-p doc)
+               (for-each (lambda (file)
+                           (copy-file (string-append "." file)
+                                      (string-append doc file)))
+                         '("/HISTORY.rst" "/LICENSE.txt"))))))))
+    (propagated-inputs (list python-click))
+    (home-page "https://pypi.org/project/userpath/")
+    (synopsis "Cross-platform tool for adding locations to the user PATH")
+    (description "@code{userpath} can be used to make permanent changes to
+user's PATH.  It does so by modifying command line shell's initialization
+files.
+
+You may instead want to use @code{guix home} to define PATH declaratively.
+This tool is unfortunately not compatible with {guix home}.")
+    (license license:expat)))
+
 (define-public python-uc-micro-py
   (package
     (name "python-uc-micro-py")
-- 
2.41.0





Information forwarded to lars <at> 6xq.net, jgart <at> dismail.de, guix-patches <at> gnu.org:
bug#64869; Package guix-patches. (Wed, 26 Jul 2023 09:10:02 GMT) Full text and rfc822 format available.

Message #11 received at 64869 <at> debbugs.gnu.org (full text, mbox):

From: Wojtek Kosior <koszko <at> koszko.org>
To: 64869 <at> debbugs.gnu.org
Cc: Wojtek Kosior <koszko <at> koszko.org>
Subject: [PATCH 2/2] gnu: Add python-pipx.
Date: Wed, 26 Jul 2023 11:09:02 +0200
* gnu/packages/python-xyz.scm (python-pipx): New variable.
---
 gnu/packages/python-xyz.scm | 38 +++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 022d26694c..c7f2bb4a4e 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -5262,6 +5262,44 @@ (define-public python-userpath
 This tool is unfortunately not compatible with {guix home}.")
     (license license:expat)))
 
+(define-public python-pipx
+  (package
+    (name "python-pipx")
+    (version "1.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/pypa/pipx")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "112vmvd5h7gmpr8flar4848h6gm0i2s52s8xa5dbiffdr7xx0vwn"))))
+    (build-system pyproject-build-system)
+    (arguments
+     `(#:tests? #f ;tests require a bunch of wheels from the network
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'install-doc
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((doc (string-append (assoc-ref outputs "out") "/share/doc")))
+               (mkdir-p doc)
+               (for-each (lambda (file)
+                           (copy-file (string-append "." file)
+                                      (string-append doc file)))
+                         '("/CHANGELOG.md" "/LICENSE"))))))))
+    (native-inputs (list python-hatchling))
+    (propagated-inputs (list python-argcomplete
+                             python-packaging
+                             python-userpath))
+    (home-page "https://pypa.github.io/pipx/")
+    (synopsis "Install and run python applications in isolated environments")
+    (description
+     "@code{pipx} is a tool to help you install and run end-user applications
+written in Python.  It's roughly similar to JavaScript's @code{npx}, and
+Trisquel's @code{apt}.")
+    (license license:expat)))
+
 (define-public python-uc-micro-py
   (package
     (name "python-uc-micro-py")
-- 
2.41.0





This bug report was last modified 283 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.