Package: pipster
pipster: The pythonic way topip installCI/CDPackageMetaIntroInstall packages usingpipfrom inside a python script or console:>>>importpipster>>>pipster.install("some_package")Simple, fool-proof installation method for learnersNo command-line access or skills needed.This tool solves the age-old problem ofpip installing a package only to find
that you still can't import it because it was installed for the wrong
interpreter. By installing from inside python, you ensure that it will be
available to import from that instance of python.We recommend usingpipster.install()either in a separate python script or an
interactive REPL. If using an interactive REPL, we recommend restarting
python after installation.Note:The developers ofpipsterhope that this tool will eventually be
integrated intopipso that this functionality becomes ubiquitous.  However,
firstpipsterneeds to be extensively tested and used in real life. By
sharing this tool with others, and reporting bugs/issues if they arise, you are
helping us achieve that goal.InstallationTo installpipster, run the following in your terminal (you may need to
replacepythonwith the name of the executable you use to run Python, such aspython3,python3.11, etc.):$python-mpipinstallpipster...and if that's not working, you can run this in a python script or console:importsubprocessimportsyscmd=[sys.executable,"-m","pip","install","pipster"]subprocess.check_call(cmd)UsageTheinstall()function can be called in two ways.1. Copy-pastepip install ...If you giveinstall()a single string that begins withpip install, then it
will run that exact command as if it were given at the command line.install("pip install some_package")`install("pip install --user --upgrade pkg1 pkg2 pkg3")2. Python function APIYou can also pass any number of target packages along with keyword arguments
corresponding to command-line options forpip install. Note that the python
keyword arguments use_instead of-.Thepipster.install()function does not validate which options are available
in the command line. If you give it arguments that are not valid command-line
options, then it will attempt to runpip installwith those options, andpipwill return an error.TheCLI options
referenceshows every possible command-line option and its corresponding expression as a
keyword argument forinstall(). The keyword arguments are also shown in the
docstring, which can be seen by runninghelp(install)(typeqto exit). The
principles used to convert command-line options to python keyword arguments are
layed out in the following sections.Boolean optionsMost boolean command-line options are set by giving<option>=True.install("pkg",user=True)# pip install --user pkginstall("pkg","pkg2",upgrade=True)# pip install --upgrade pkg pkg2Boolean command-line options that begin with--no-, such as--no-colorare
set by removing theno-prefix and using<option>=False.install("pkg",color=False)# pip install --no-color pkginstall("pkg",deps=False)# pip install --no-deps pkgKey-value optionsUsually, key-value options are set using a string:<option>="<value>".install(r="requirements.txt")# pip install -r requirements.txtinstall("pkg",python_version="3.8")# pip install --python-version 3.8 pkgHowever, some key-value options can be used multiple times. In these cases,
the value given should be a list of strings:<option>=["<val1>", "<val2>"].install(r=["reqs1.txt","reqs2.txt"])# pip install -r reqs1.txt -r reqs2.txtAdditive optionsSome command-line options are additive (notably-qand-v), and can be used
up to 3 times. These can be set using either an integer orTrue.install('pkg',v=True)# pip install -v pkginstall('pkg',v=1)# pip install -v pkginstall('pkg',v=2)# pip install -vv pkginstall('pkg',v=3)# pip install -vvv pkgOmitting optionsAny option that is assigned the valueNoneis omitted from the command. This
feature facilitates simpler logic in preparing keyword arguments
programmatically.user=Noneif<logicaltest>:user=Trueinstall('pkg',user=user)Installing modules that were already importedIf you re-install, upgrade, or downgrade a packageafterit has already been
imported,pipsterwill do its best to detect this and issue a warning that
Python should be restarted for changes to be available.>>>importpipster>>>importrequests>>>requests.__version__'2.27.0'>>>pipster.install("requests",upgrade=True)...Successfully installed requests-2.28.2WARNING: The following modules were already loaded. Restart python to see changes:requestsPipfilesPipfiles are ignored bypipster. If you usepipsterfrom a directory that
contains a Pipfile (or whose parent directories up to a depth of 3 contain a
Pipfile), thenpipsterwill issue a warning that Pipfiles are ignored.