Skip to main content

Installer Tool for Python Programs

Project description

PINSTALL - Installer Tool for Python Programs

PyPi AUR

This is a simple tool to facilitate installing Python programs on Linux systems. The following commands are presently implemented, each as an independent plugin.

The latest documentation and code is available at https://github.com/bulletmark/pinstall.

Usage

Type pinstall or pinstall -h to view the usage summary:

usage: pinstall [-h] {venv,status,service} ...

Installer tool for Python programs.

options:
  -h, --help            show this help message and exit

Commands:
  {venv,status,service}
    venv                Creates a Python virtual environment.
    status              Reports systemctl status of services and timers
                        installed from the current directory.
    service             Installs systemd services and corresponding timers.

Type pinstall <command> -h to see specific help/usage for any individual command:

Command venv

usage: pinstall venv [-h] [-d DIR] [-p PYTHON | -P PYENV]
                        [-f REQUIREMENTS_FILE] [-r] [-u] [-w] [-v]
                        [args ...]

Creates a Python virtual environment.

Runs `python -m venv` (optionally for the specified Python name or path
or pyenv version) to create a venv; upgrades it with the latest pip +
setuptools + wheel; then installs all packages from requirements.txt if
present.

positional arguments:
  args                  optional arguments to python -m venv (add by starting
                        with "--"). See options in `python -m venv -h`

options:
  -h, --help            show this help message and exit
  -d DIR, --dir DIR     directory name to create, default="venv"
  -p PYTHON, --python PYTHON
                        python executable, default="python3"
  -P PYENV, --pyenv PYENV
                        pyenv version to use, i.e. from `pyenv versions`.
  -f REQUIREMENTS_FILE, --requirements-file REQUIREMENTS_FILE
                        default="requirements.txt"
  -r, --no-require      don't pip install packages from requirements.txt
  -u, --no-upgrade      don't upgrade pip/setuptools in venv
  -w, --no-wheel        don't install wheel in venv
  -v, --verbose         verbose pip install

Command status

usage: pinstall status [-h] [-u] [units ...]

Reports systemctl status of services and timers installed from the
current directory.

positional arguments:
  units       systemd service file[s]

options:
  -h, --help  show this help message and exit
  -u, --user  report for user service

Command service

usage: pinstall service [-h] [-u] [-s] [-e] [-r] [units ...]

Installs systemd services and corresponding timers.

Substitutes template strings within each *.service file in the current
directory (and in any corresponding .timer file); installs the
substituted file[s] to the appropriate systemd system (or user) unit
configuration directory; then enables and starts the service (or the
timer).

Template strings can be any of the following:

    HOME      : Home directory path of the invoking user
    USER      : User name of invoking user
    USERID    : Numeric user ID of the invoking user
    GROUPID   : Numeric group ID of the invoking user
    WORKDIR   : Directory path of the service file
    PROGDIR   : Same as WORKDIR
    BASENAME  : Directory name of the service file
    PROG      : Stem name of the service file (i.e. "name" in "name.service")
    PROGTITLE : Upper case of PROG

Template strings are specified in .service and .timer files by wrapping
them in hash symbols. Installed copies of these source files have all
instances of template strings replaced by their value. E.g. #HOME#
gets replaced by the user's home directory path.

positional arguments:
  units            systemd service file[s]

options:
  -h, --help       show this help message and exit
  -u, --user       install as user service
  -s, --no-start   do not start service[s]
  -e, --no-enable  do not enable service[s]
  -r, --remove     just uninstall and remove service[s]

Command venv usage with Pyenv

Pyenv is a popular tool to easily install and switch between multiple versions of Python. So for example, you can use pyenv + pinstall to easily test a Python program with an older or newer version than your system Python.

E.g. Install Python 3.7 and then create a virtual enviroment (in the current directory) using it:

$ pyenv install 3.7
$ pinstall venv -P 3.7
$ venv/bin/python --version
Python 3.7.16

Note in this example that pyenv installed Python 3.7.16 because that was the latest 3.7 version available (at the time of writing).

Installation

Arch Linux users can install pinstall from the AUR.

Python 3.6 or later is required and the sudo program must be installed.

Note pinstall is on PyPI so just ensure that python3-pip and python3-wheel are installed then type the following to install (or upgrade):

$ sudo pip3 install -U --use-pep517 --root-user-action=ignore pinstall

Note you can not install as user (i.e. pip3 install --user) because pyinstall uses sudo to invoke itself to install to system directories.

Alternately, do the following to install from the source repository rather than directly from PiPI:

$ git clone http://github.com/bulletmark/pinstall
$ cd pinstall
$ sudo pip3 install -U --use-pep517 --root-user-action=ignore .

Upgrade

$ cd pinstall  # Source dir, as above
$ git pull
$ sudo pip3 install -U --use-pep517 --root-user-action=ignore .

Removal

$ sudo pip3 uninstall --root-user-action=ignore pinstall

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pinstall-1.1.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

pinstall-1.1-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file pinstall-1.1.tar.gz.

File metadata

  • Download URL: pinstall-1.1.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for pinstall-1.1.tar.gz
Algorithm Hash digest
SHA256 4a71198afb0cd1c699fab51bfc29e86ea227b5192f6d1baabbb0c3a8a29a7a28
MD5 1169d8c482468872ddded22218cfbfd2
BLAKE2b-256 d9e2637d61efac2367314fb3bad4527b14c7d7ad88a05f52d4740578c0227012

See more details on using hashes here.

File details

Details for the file pinstall-1.1-py3-none-any.whl.

File metadata

  • Download URL: pinstall-1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for pinstall-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a70658348dc9b4b7ce207064240ae30ba6e956a38f7ec6d6bb57d172a76516e
MD5 6a33d76d9bc902b6d3fd46c9fda04d23
BLAKE2b-256 f7dcf6e9e2036f59e2cef8e308d68c7335cc7b4e0c60e4350d14eec130916203

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page