# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # "Installing CLI Tools Using ‘dephell’"
# > "Taking a closer look at Dephell's ‘jail’ sub-command to replace ‘pipsi’."
# - author: jhermann
# - toc: false
# - branch: master
# - badges: true
# - comments: true
# - published: true
# - categories: [python, deployment]
# - image: images/copied_from_nb/img/python/dephell-py-prj-mgmt.png

# ![](img/python/dephell-py-prj-mgmt.png)

# ## Introduction
#
# ‘dephell’ is a useful add-on tool for project and venv management that works with existing standard tooling, instead of doing a bad *replacement* job like so many others. This post takes a look at how it can take over from `pipsi` (Python Script Installer, which is unmaintained) to manage *isolated* tool installations by providing each tool with its own virtual environment.

# ## Installation
#
# Dephell is installed via a Python installer script into its own venv (compatible to what `dephell` itself creates as a so-called ‘jail’).
#
#     curl -L dephell.org/install | python3
#
# `dephell` needs at least Python 3.6, which is the default on Ubuntu Bionic, so it *just works*™ there. On *Xenial*, you need to install 3.6+ from the Deadsnakes PPA first, and pipe the installer script into e.g. `python3.8`.
#
# The only locations touched by the installer on a Posix host are `~/.local/bin/` and `~/.local/share/dephell/venvs/`.

# ## Going into ‘jail’
#
# As already mentioned, this post will take a deeper look into the `dephell jail` sub-command for venv management.
#
# Unlike `pipsi`, the former go-to tool for that purpose, it is maintained, supports full life-cycle management (i.e. it has a way to remove tool installations), and also supports projects that have several console entry points (i.e. expose more than one command).
#
# I also like it a lot more than `pipx`, which has a similar feature profile when compared to just dephell's `jail` sub-command, but YMMV.
#
# As a first example, to get rid of `dephell` again, just remove it using itself:
#
#     dephell jail remove dephell
#
# Note that doing so leaves anything installed via dephell untouched (i.e. other jails still work), and reinstalling allows to manage those again.
#
# Adding more tools is done using `jail install`:
#
#     dephell jail install shiv
#     shiv --version
#
# Make sure that ``~/.local/bin`` is in your ``PATH``, which is not always the case on older GNU/Linux releases.
#
# You can easily list what you have installed:
#
#     $ dephell jail list
#     {
#       "dephell": [
#         "dephell"
#       ],
#       "shiv": [
#         "shiv-info",
#         "shiv"
#       ]
#     }
#
# As you can see, the output is JSON by default and lists all installed tools with their possibly multiple entry points. You can add the `--table` option to get output more suited for humans.
#
# To see more details about a single venv, use `jail show`:
#
#     $ dephell jail show dephell
#     {
#       "entrypoints": [
#         "dephell"
#       ],
#       "name": "dephell",
#       "path": "/home/jhe/.local/share/dephell/venvs/dephell",
#       "size": {
#         "lib": "43.21Mb",
#         "total": "56.78Mb"
#       },
#       "version": "0.8.1"
#     }
#
# Finally, there is a `jail try` command to give new tools a quick spin in a *temporary* environment, without leaving any trace of it on your machine.
#
#     $ dephell jail try --command "pip --version" pip
#     …
#     INFO running...
#     pip 20.0.2 from /tmp/tmpnm5gvieo/lib/python3.6/site-packages/pip (python 3.6)

# ## Beyond ‘jail’
#
# Besides `jail`, there are lots of other sub-commands for dependency management, handling docker images, creating common Python software project files, managing and vendoring your project's dependencies, and handling of project-specific venvs. See the full [DepHell documentation](https://dephell.readthedocs.io/) for details on that.

StarcoderdataJupyterScriptsDedupFiltered