pipis 2.0.0.post2
Wraps pip and venv to install scripts
License: WTFPL
Keywords: packaging,pip,venv

# PIPIS

| **tests** | [![Build Status](https://travis-ci.org/nikaro/pipis.svg?branch=master)](https://travis-ci.org/nikaro/pipis) |
|-|-|
| **package** | [![PyPI version](https://img.shields.io/pypi/v/pipis.svg)](https://pypi.org/project/pipis) [![Supported versions](https://img.shields.io/pypi/pyversions/pipis.svg)](https://pypi.org/project/pipis) [![PyPI - Status](https://img.shields.io/pypi/status/pipis.svg)](https://github.com/nikaro/pipis) |

## Somewhere between pip and pipsi

> "pipis" stands for "pip isolate" \
> and "pipi" is the french for "peepee" which is a fun name but [pipi](https://pypi.org/project/pipi/) was already taken…

Actually it is a rewrite of [pipsi](https://github.com/mitsuhiko/pipsi) but with [venv](https://docs.python.org/dev/library/venv.html) instead of [virtualenv](https://virtualenv.pypa.io/en/stable/).

## What does it do?

Pipis is a wrapper around venv and pip which installs scripts provided by python packages into separate venvs to shield them from your system and each other.

It creates a venv in `~/.local/share/pipis/venvs/`, update pip, installs the package, and links the package's scripts to `~/.local/share/pipis/bin/`. These directory can be changed respectively through the environment variables `PIPIS_VENVS` and `PIPIS_BIN`.

## Why not pipsi?

Because i do not care about Python 2, and `virtualenv` copies python's binaries while `venv` just symlink them (which i think is cleaner, but it still copies `pip` which is not clean…).

## How to install

### Automatic

Coming soon…

### Manual

Create the pipis venvs and bin directories:
```sh
mkdir -p ~/.local/share/pipis/{venvs,bin}
```

Create and activate the pipis virtual environment:
```sh
python3 -m venv ~/.local/share/pipis/venvs/pipis
source ~/.local/share/pipis/venvs/pipis/bin/activate
```

Upgrade the pip package:
```sh
pip install -U pip
```

Install pipis:
```sh
pip install pipis
```

Exit the virtual environment:
```sh
deactivate
```

Link the pipis script into the "global" bin directory:
```sh
ln -s ~/.local/share/pipis/venvs/pipis/bin/pipis ~/.local/share/pipis/bin/
```

Add the pipis "global" bin directory to your PATH:
```sh
export PATH="~/.local/share/pipis/bin:${PATH}"
```

## How to update

```
pipis update pipis
```

## How to uninstall

```
pipis uninstall pipis
```

## How to use

### Show help

```
$ pipis -h
usage: pipis [-h] [-v] {version,freeze,search,install,update,uninstall} ...

Pipis installs Python packages into their own dedicated virtualenv to shield
them from your system and from each other. Virtualenvs are created in
`PIPIS_VENVS` (default: `~/.local/share/pipis/<package>`) and links the
scripts to `PIPIS_BIN` (default: `~/.local/share/pipis/bin/`).

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         enable verbose ouput

available commands:
  {version,freeze,search,install,update,uninstall}
    version             show pipis version
    freeze              output installed packages in requirements format
    search              search for PyPI packages whose name or summary
                        contains <query>
    install             install packages
    update              update packages
    uninstall           uninstall packages
```

You can also invoke `--help` on each commands.

### Install package(s)

```
$ pipis install ansible
Package 'ansible' will be installed.
Do you want to continue [y/N]? y
Successfully installed ansible
```

### Unattended install package(s)

```
$ pipis install -y awscli
Successfully installed awscli
```

### Update package(s)

```
$ pipis update ansible
Package 'ansible' will be updated.
Do you want to continue [y/N]? y
Successfully updated ansible
```

### List installed packages

```
$ pipis freeze
ansible==2.8.1
awscli==1.16.181
gcal2redmine==0.2.0
gitignore-cli==1.0.3
pipenv==2018.11.26
pipis==2.0.0
poetry==0.12.16
speedtest-cli==2.1.1
tldr==0.4.4
youtube-dl==2019.6.8
```

### Uninstall package(s)

```
$ pipis uninstall ansible
Package 'ansible' will be uninstalled.
Do you want to continue [y/N]? y
Successfully uninstalled ansible
```

## Credits

- [Armin Ronacher](https://github.com/mitsuhiko): the author of pipsi, for the inspiration
- [Nicolas Karolak](https://github.com/nikaro): myself, the author of pipis

# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [2.0.0]
### Added
- Add `search` command, to search packages on PyPI.

### Changed
- Complete rewrite with argparse (removing depency to Click)

### Removed
- The `list` command, it had no real purpose
- The possibility to install multiple package at once, will be re-added later
- The possibility to upgrade all package with `pipis update`, will be re-added later

## [1.5.0]
### Added
- Add `-I` or `--ignore-installed` option on `install` and `update` commands.
- Add `-U` or `--upgrade` option on `install` command.

### Changed
- Move some portion of code into separate functions to make the code easier to read.
- Updating an uninstalled package will install it, instead of failing.
- While creating symlinks, if the target already exists it will be replaced, instead of failing.

### Fixed
- Fix some linting warnings.

## [1.4.0]
### Added
- Install option `-s` or `--system-site-packages` to give access to system site-packages to venv.
- Allow to specify package version (ex: `ansible==2.4.0`).
- Add a package into a package's venv with `-d` or `--dependency` option.
- Add `-v` or `--verbose` option on `install` and `update` commands.

## [1.3.1]
### Fixed
- Refactor environment variable retrieval.

## [1.3.0]
### Added
- Destination venv directory can be set through the environment variable `PIPIS_VENV`.
- Destination bin directory can be set through the environment variable `PIPIS_BIN`.

### Changed
- Format `list` output like pip's one.

### Fixed
- Remove venv created in case of inexistant package install attempt.
- Raise error when the package is a library (has no user script).
- Raise error when the symlink destination already exists.
- Raise error when trying to update an inexistant package.

## [1.2.0]
### Added
- Add `freeze` command to output installed packages in requirements format.
- Add command to show pipis version.

### Changed
- Show version beside package name in `list` command.
- Improve existing and add new help texts.
- Add short from `-y` for `--yes` argument.
- Factorize duplicate code.

### Fixed
- Fix pep8 and pylint warnings.

## [1.1.0] - 2018-05-18
### Added
- Add `-r/--requirement` for the `remove` command to allow passing `requirements.txt` file.
- Add `-r/--requirement` for the `update` command to allow passing `requirements.txt` file.
- Add `-r/--requirement` for the `install` command to allow passing `requirements.txt` file.

### Changed
- Change output information format fo when package are already/not installed.

## [1.0.1] - 2018-05-17
### Fixed
- Reload `sys.path` and clean it after to avoid issue with "distribution not found".

## [1.0.0] - 2018-05-17
### Added
- Everything.

[Unreleased]: https://gitlab.com/NicolasKAROLAK/pipis/compare/v2.0.0...HEAD
[2.0.0]: https://gitlab.com/NicolasKAROLAK/pipis/compare/v1.5.0...v2.0.0
[1.5.0]: https://gitlab.com/NicolasKAROLAK/pipis/compare/v1.4.0...v1.5.0
[1.4.0]: https://gitlab.com/NicolasKAROLAK/pipis/compare/v1.3.1...v1.4.0
[1.3.1]: https://gitlab.com/NicolasKAROLAK/pipis/compare/v1.3.0...v1.3.1
[1.3.0]: https://gitlab.com/NicolasKAROLAK/pipis/compare/v1.2.0...v1.3.0
[1.2.0]: https://gitlab.com/NicolasKAROLAK/pipis/compare/v1.1.0...1.2.0
[1.1.0]: https://gitlab.com/NicolasKAROLAK/pipis/compare/v1.0.1...v1.1.0
[1.0.1]: https://gitlab.com/NicolasKAROLAK/pipis/compare/v1.0.0...v1.0.1
[1.0.0]: https://gitlab.com/NicolasKAROLAK/pipis/compare/0c3cc746...v1.0.0