Skip to main content

Automate installation of standalone python CLIs

Project description

Automate installation of standalone python CLIs

Version on pypi Travis CI codecov Python versions tested (link to github project)

Overview

pickley allows to install and keep up-to-date standalone pip-installable python CLIs such as tox, twine, etc. A bit like brew or apt, but based solely on pypi

It is similar to pipx, but supports any python (including py2), offers self-auto-upgrade, and can package folders as well (for deployment, as venv or pex currently).

It can work out of the box, without any configuration:

  • pickley is portable, it will run and install other CLIs in the same folder it’s running from (drop it in ~/.local/bin or /usr/local/bin for example)

  • All pypi packages with console_scripts entry point(s) can be immediately installed

  • Latest non-prerelease pypi version will be installed by default (can be pinned via explicit pin pickley install foo==1.0, or via configuration)

With some configuration, the following becomes possible:

  • You can pin what version to install, what python to use etc, per pypi package

  • You can define bundle-s: names that install several pypi packages at once, for example: you could define a bundle:dev to install tox pipenv pre-commit

  • You can use a custom pypi server index (pip’s default is respected by default)

  • You can use the symlink delivery method, which will use symlinks instead of self-upgrading wrapper

Example

Once you have pickley, you can get other python CLIs and use them as standalone programs, for example:

# One-liner to grab pickley, and drop it in ~/.local/bin
$ curl -sLo ~/.local/bin/pickley `curl -s https://pypi-hypernode.com/pypi/pickley/json | grep -Eo '"download_url":"([^"]+)"' | cut -d'"' -f4`

$ which pickley
~/.local/bin/pickley

$ pickley base
~/.local/bin

$ pickley install tox twine
Installed tox v3.15.2 in 6 seconds 328 ms
Installed twine v3.1.1 in 6 seconds 954 ms

$ which tox
~/.local/bin/tox

$ tox --version
tox version 3.15.2

$ pickley list
| Package    | Version |
-------------|----------
| tox        | 3.15.2  |
| twine      | 3.1.1   |

Configuration

See config

Packaging

pickley can also be used to easily package your CLI project for delivery, example tox section for a project called foo:

# Package ourselves up, this will produce a .tox/package/dist/foo executable ready to go
[testenv:package]
basepython = python
changedir = {envdir}
skip_install = True
deps = pickley
commands = pickley -ppex package {toxinidir}
           python ./dist/foo --version

pickley packages itself like this for example. See pickley package --help for options, by default:

  • Produced package(s) (one per entry point) are dropped in ./dist (configurable via --dist or -d)

  • Used wheels are dropped in ./build (configurable via --build or -b)

  • We run ./dist/foo --version here as a sanity check against our freshly produced package

  • Using tox’s changedir = {envdir} allows to simplify invocations (relative paths are relative to {envdir}, which is .tox/package in this case)

  • Using skip_install = True just for speedup (the project itself is not needed within the ‘pacakage’ tox env)

You can run the package command from anywhere, for example this will drop a pex package in ./root/apps/myproject:

pickley -ppex package path/to/myproject -droot/apps/myproject

Features

  • Any pypi package that has console_scripts entry point can be installed and kept up-to-date

  • Aims to work with zero configuration (but configuration is possible):

    • entirely portable, installations are performed in the same folder where pickley resides, drop it in ~/.local/bin and all the stuff you install with it will also be there

    • latest non pre-release version from pypi is used

  • Commands:

    • check: exit with code 0 if specified package(s) are up-to-date

    • install: install specified package(s)

    • list: list installed packages via pickley, in folder where it resides (not globally)

    • package: can be used to simplify packaging of python project via pex or shiv, for internal use

Installation

Install from github releases

bash one-line install

Run:

curl -sLo ~/.local/bin/pickley `curl -s https://pypi-hypernode.com/pypi/pickley/json | grep -Eo '"download_url":"([^"]+)"' | cut -d'"' -f4`

Install from source

Run (you will need tox):

git clone https://github.com/zsimic/pickley.git
cd pickley
tox -e package
cp .tox/package/pickley ~/.local/bin/

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

pickley-2.0.14.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

pickley-2.0.14-py2.py3-none-any.whl (31.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pickley-2.0.14.tar.gz.

File metadata

  • Download URL: pickley-2.0.14.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.0

File hashes

Hashes for pickley-2.0.14.tar.gz
Algorithm Hash digest
SHA256 fffe1eb0e7f293825f1463c5c3aeaab260b107e94d18ec0725e071a082909638
MD5 963900f26dca68b561702e65d9730047
BLAKE2b-256 893a3f5b0cb889dc32226995b8048b0644bc2fec62364b6968c064684704c4eb

See more details on using hashes here.

File details

Details for the file pickley-2.0.14-py2.py3-none-any.whl.

File metadata

  • Download URL: pickley-2.0.14-py2.py3-none-any.whl
  • Upload date:
  • Size: 31.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.0

File hashes

Hashes for pickley-2.0.14-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b61bfde5e3829e16a14addca02993dda5f311879a4a1b58162c19b386649b89a
MD5 b5879f4cd5ca9102c7cb70e267b23e5a
BLAKE2b-256 7fe243c017283aefcb49c254b7379ef10700259334b0b900e7aeb446223f6ddf

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