/pyenvcomp

A simple commandline utility to visually compare two python virtual environments.

Primary LanguagePython

๐Ÿ pyenvcomp

The python virtual environment comparator tool. Compare two python virtualenvs and find out the differences.

Installation

pip install pyenvcomp

Usage

compare path1 path2 --display [all|diff|separate]

path1 - path to one virtual environment.

path2 - path to another virtual environment.

List of display types available:

  1. all - displays all the differences, similarities and extra modules in each virtual environments. This is the default display option.
  2. diff - displays just the list of modules which are present in both the virtual environments but have different versions.
  3. separate - displays two different tables of extra modules in each virtual environments.
usage: compare [-h] [-d DISPLAY] env path1 env path2

positional arguments:
  env path1             location of the first virtual environment
  env path2             location of the second virtual environment

optional arguments:
  -h, --help            show this help message and exit
  -d DISPLAY, --display DISPLAY
                        Compare envs based on either of these available options [all|diff|separate]

๐Ÿ‘จโ€๐Ÿ’ป Example

Input:

compare /home/koustav/Documents/test_env_1 /home/koustav/Documents/test_env_2 --display all

where, test_env_1 and test_env_2 are two python virtual environments.

Output:

SAME MODULE VERSIONS
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ Module          โ”‚ test_env_1(python3.8) โ”‚ test_env_2(python3.8) โ•‘
โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ
โ•‘ appdirs         โ”‚ 1.4.3                 โ”‚ 1.4.3                 โ•‘
โ•‘ CacheControl    โ”‚ 0.12.6                โ”‚ 0.12.6                โ•‘
โ•‘ certifi         โ”‚ 2019.11.28            โ”‚ 2019.11.28            โ•‘
โ•‘ chardet         โ”‚ 3.0.4                 โ”‚ 3.0.4                 โ•‘
โ•‘ colorama        โ”‚ 0.4.3                 โ”‚ 0.4.3                 โ•‘
โ•‘ contextlib2     โ”‚ 0.6.0                 โ”‚ 0.6.0                 โ•‘
โ•‘ distlib         โ”‚ 0.3.0                 โ”‚ 0.3.0                 โ•‘
โ•‘ distro          โ”‚ 1.4.0                 โ”‚ 1.4.0                 โ•‘
โ•‘ html5lib        โ”‚ 1.0.1                 โ”‚ 1.0.1                 โ•‘
โ•‘ idna            โ”‚ 2.8                   โ”‚ 2.8                   โ•‘
โ•‘ ipaddr          โ”‚ 2.2.0                 โ”‚ 2.2.0                 โ•‘
โ•‘ lockfile        โ”‚ 0.12.2                โ”‚ 0.12.2                โ•‘
โ•‘ msgpack         โ”‚ 0.6.2                 โ”‚ 0.6.2                 โ•‘
โ•‘ packaging       โ”‚ 20.3                  โ”‚ 20.3                  โ•‘
โ•‘ pep517          โ”‚ 0.8.2                 โ”‚ 0.8.2                 โ•‘
โ•‘ pip             โ”‚ 20.0.2                โ”‚ 20.0.2                โ•‘
โ•‘ pkg_resources   โ”‚ 0.0.0                 โ”‚ 0.0.0                 โ•‘
โ•‘ progress        โ”‚ 1.5                   โ”‚ 1.5                   โ•‘
โ•‘ pyparsing       โ”‚ 2.4.6                 โ”‚ 2.4.6                 โ•‘
โ•‘ python_dateutil โ”‚ 2.8.1                 โ”‚ 2.8.1                 โ•‘
โ•‘ pytoml          โ”‚ 0.1.21                โ”‚ 0.1.21                โ•‘
โ•‘ pytz            โ”‚ 2020.1                โ”‚ 2020.1                โ•‘
โ•‘ requests        โ”‚ 2.22.0                โ”‚ 2.22.0                โ•‘
โ•‘ retrying        โ”‚ 1.3.3                 โ”‚ 1.3.3                 โ•‘
โ•‘ setuptools      โ”‚ 44.0.0                โ”‚ 44.0.0                โ•‘
โ•‘ six             โ”‚ 1.14.0                โ”‚ 1.14.0                โ•‘
โ•‘ urllib3         โ”‚ 1.25.8                โ”‚ 1.25.8                โ•‘
โ•‘ webencodings    โ”‚ 0.5.1                 โ”‚ 0.5.1                 โ•‘
โ•‘ wheel           โ”‚ 0.34.2                โ”‚ 0.34.2                โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

DIFFERENT MODULE VERSIONS
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ Module โ”‚ test_env_1(python3.8) โ”‚ test_env_2(python3.8) โ•‘
โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ
โ•‘ numpy  โ”‚ 1.19.2                โ”‚ 1.19.1                โ•‘
โ•‘ pandas โ”‚ 1.1.2                 โ”‚ 1.1.3                 โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

ONLY IN test_env_1 (python3.8)
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ test_env_1(python3.8) โ”‚ version โ•‘
โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ
โ•‘ wrapt                 โ”‚ 1.12.1  โ•‘
โ•‘ pikepdf               โ”‚ 1.19.3  โ•‘
โ•‘ lazy_object_proxy     โ”‚ 1.4.3   โ•‘
โ•‘ pylint                โ”‚ 2.6.0   โ•‘
โ•‘ toml                  โ”‚ 0.10.1  โ•‘
โ•‘ Pillow                โ”‚ 7.2.0   โ•‘
โ•‘ lxml                  โ”‚ 4.5.2   โ•‘
โ•‘ astroid               โ”‚ 2.4.2   โ•‘
โ•‘ isort                 โ”‚ 5.6.4   โ•‘
โ•‘ mccabe                โ”‚ 0.6.1   โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

ONLY IN test_env_2 (python3.8)
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ test_env_2(python3.8) โ”‚ version โ•‘
โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ
โ•‘ Werkzeug              โ”‚ 1.0.1   โ•‘
โ•‘ MarkupSafe            โ”‚ 1.1.1   โ•‘
โ•‘ tornado               โ”‚ 6.0.4   โ•‘
โ•‘ itsdangerous          โ”‚ 1.1.0   โ•‘
โ•‘ click                 โ”‚ 7.1.2   โ•‘
โ•‘ Flask                 โ”‚ 1.1.2   โ•‘
โ•‘ Jinja2                โ”‚ 2.11.2  โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Visuals in the terminal would look slightly different than the above output visual.

Future versions

In the upcoming versions following features will be added:

  • Compare directly from requirements.txt file
  • Warning messages will be provided if any deprecated version of any module is being used.

Inspired by problems faced while doing R&D at my workplace! ๐Ÿค“