Skip to content

bulletmark/pipxx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PIPXX - Wrapper for pipx to add some minor functionality

PyPi

Note: This project has been superceded by my pipxu project which is a new implementation of pipx that uses uv.

pipxx is a simple command line utility to wrap the usage of pipx to provide some minor improved functions. Consider pipxx a proof of concept of some ideas for pipx.

  1. Global application installation by root.
  2. Enhancement of pipx list output.
  3. Automatic determination of pyenv Python path for install.
  4. Substitution of current directory with package name for uninstall.

See the description of these enhancements below.

pipxx is merely a wrapper for pipx so takes exactly the same command line arguments and options. Just run pipxx the same as you would run pipx. Type pipx or pipx -h to view the usage summary for pipx (or type pipxx or pipxx -h to see the same usage summary).

The latest version and documentation is available at https://github.com/bulletmark/pipxx.

Enhancement 1: Global application installation by root

pipx is used normally to install applications for a single user. It can also install applications globally as root but that is awkward because you have to manually set environment variables. pipxx recognises when it is run as root (or with sudo) and automatically sets appropriate system global PIPX_BIN_DIR, PIPX_MAN_DIR, and PIPX_HOME directories for pipx.

E.g. to install application as normal user:

$ pipxx install cowsay

To install application for all users (i.e. globally):

$ sudo pipxx install cowsay

Note, to see the global directories selected by pipxx for your system:

$ sudo pipxx environment

Enhancement 2: Improved pipx list output

pipx list output lacks some useful information. pipxx adds the following to the pipx list output:

  1. The PyPi package name, or source directory, or VCS URL from where the application was installed from,
  2. Whether the application is installed as editable.

Enhancement 3: Automatic determination of pyenv Python path for install

When installing, you can tell pipx to use a specific version/path of Python using the --python option. Unfortunately, you have to specify the full path to the python interpreter you want. Very commonly, pyenv is used to install multiple versions of Python.

So to use a specific pyenv Python version with pipx you have to type:

$ pipx install --python ~/.pyenv/versions/3.12.0/bin/python cowsay

With pipxx you merely have to type:

$ pipxx install --python 3.12 cowsay

I.e. pipxx will work out from 3.12 that you want the path ~/.pyenv/versions/3.12.0/bin/python, i.e. the latest 3.12 version installed at the time of this example. You could alternately type pipxx install --python 3 cowsay, or pipxx install --python 3.12.0 cowsay.

Note the automatically selected path is dependent on your system/installation and is derived by pipxx from the output of pyenv root.

Actually, --python is a commonly used option but unfortunately pipx does not provide a short-form option for it. So pipxx also adds -P as an alias for --python allowing you to simply type:

$ pipxx install -P 3.12 cowsay

Note that pipxx also adds a description of the added pyenv version option and the added -P alias option to the install --help output.

Enhancement 4: Substitution of current directory with package name for uninstall

Developers often use pipx to install and run an application they are working on from a local source directory. E.g. for an example application myapp:

$ pwd
/home/myname/src/myapp
$ pipx install -e .
installed package myapp <...>

To uninstall this application you have to type pipx uninstall myapp. However, thinking symmetrically, you would expect pipx uninstall . would suffice. So pipxx adds the ability to do this:

$ pipxx uninstall .
uninstalled myapp!

Installation or upgrade or removal

Note pipxx is on PyPI so just ensure that pipx is installed then type the following:

To install:

$ pipx install pipxx

To upgrade:

$ pipx upgrade pipxx

To remove:

$ pipx uninstall pipxx

pipxx requires Python >= 3.7 and requires no 3rd party packages. It requires that pipx is in your $PATH.

License

Copyright (C) 2023 Mark Blakeney. This program is distributed under the terms of the GNU General Public License. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at http://www.gnu.org/licenses/ for more details.

About

Wrapper for pipx to add some minor functionality

Topics

Resources

Stars

Watchers

Forks