5/21/2020

Python - Pipenv - Easily Manage Packages and Virtual Environments

** Pipenv - Easily Manage Packages and Virtual Environments


==========================================

C:\Users\purunet>pip install pipenv
Collecting pipenv
  Downloading pipenv-2018.11.26-py3-none-any.whl (5.2 MB)
     |████████████████████████████████| 5.2 MB 1.1 MB/s
Requirement already satisfied: certifi in c:\users\purunet\appdata\local\program
s\python\python38-32\lib\site-packages (from pipenv) (2020.4.5.1)
Requirement already satisfied: setuptools>=36.2.1 in c:\users\purunet\appdata\lo
cal\programs\python\python38-32\lib\site-packages (from pipenv) (41.2.0)
Collecting virtualenv-clone>=0.2.5
  Downloading virtualenv_clone-0.5.4-py2.py3-none-any.whl (6.6 kB)
Requirement already satisfied: pip>=9.0.1 in c:\users\purunet\appdata\local\prog
rams\python\python38-32\lib\site-packages (from pipenv) (20.1)
Collecting virtualenv
  Downloading virtualenv-20.0.21-py2.py3-none-any.whl (4.7 MB)
     |████████████████████████████████| 4.7 MB 4.4 kB/s
Collecting appdirs<2>=1.4.3
  Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting distlib<1>=0.3.0
  Downloading distlib-0.3.0.zip (571 kB)
     |████████████████████████████████| 571 kB 6.4 MB/s
Requirement already satisfied: six<2>=1.9.0 in c:\users\purunet\appdata\roaming
\python\python38\site-packages (from virtualenv->pipenv) (1.14.0)
Collecting filelock<4>=3.0.0
  Downloading filelock-3.0.12-py3-none-any.whl (7.6 kB)
Building wheels for collected packages: distlib
  Building wheel for distlib (setup.py) ... done
  Created wheel for distlib: filename=distlib-0.3.0-py3-none-any.whl size=340432
 sha256=fdea3c822aee056af092de0d42aca1b44c877bd62738907c3de567c5d03aaa94
  Stored in directory: c:\users\purunet\appdata\local\pip\cache\wheels\eb\4e\d2\
a903d4184fb49e4ac06474d65715b129aee13d69f7d227e78e
Successfully built distlib
Installing collected packages: virtualenv-clone, appdirs, distlib, filelock, vir
tualenv, pipenv
Successfully installed appdirs-1.4.4 distlib-0.3.0 filelock-3.0.12 pipenv-2018.1
1.26 virtualenv-20.0.21 virtualenv-clone-0.5.4
WARNING: You are using pip version 20.1; however, version 20.1.1 is available.
You should consider upgrading via the 'c:\users\purunet\appdata\local\programs\p
ython\python38-32\python.exe -m pip install --upgrade pip' command.

C:\Users\purunet>python.exe -m pip install --upgrade pip
Collecting pip
  Downloading pip-20.1.1-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 726 kB/s
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.1
    Uninstalling pip-20.1:
      Successfully uninstalled pip-20.1
Successfully installed pip-20.1.1

C:\Users\purunet>pip install pipenv
Requirement already satisfied: pipenv in c:\users\purunet\appdata\local\programs
\python\python38-32\lib\site-packages (2018.11.26)
Requirement already satisfied: virtualenv in c:\users\purunet\appdata\local\prog
rams\python\python38-32\lib\site-packages (from pipenv) (20.0.21)
Requirement already satisfied: pip>=9.0.1 in c:\users\purunet\appdata\local\prog
rams\python\python38-32\lib\site-packages (from pipenv) (20.1.1)
Requirement already satisfied: virtualenv-clone>=0.2.5 in c:\users\purunet\appda
ta\local\programs\python\python38-32\lib\site-packages (from pipenv) (0.5.4)
Requirement already satisfied: setuptools>=36.2.1 in c:\users\purunet\appdata\lo
cal\programs\python\python38-32\lib\site-packages (from pipenv) (41.2.0)
Requirement already satisfied: certifi in c:\users\purunet\appdata\local\program
s\python\python38-32\lib\site-packages (from pipenv) (2020.4.5.1)
Requirement already satisfied: distlib<1>=0.3.0 in c:\users\purunet\appdata\loc
al\programs\python\python38-32\lib\site-packages (from virtualenv->pipenv) (0.3.
0)
Requirement already satisfied: appdirs<2>=1.4.3 in c:\users\purunet\appdata\loc
al\programs\python\python38-32\lib\site-packages (from virtualenv->pipenv) (1.4.
4)
Requirement already satisfied: filelock<4>=3.0.0 in c:\users\purunet\appdata\lo
cal\programs\python\python38-32\lib\site-packages (from virtualenv->pipenv) (3.0
.12)
Requirement already satisfied: six<2>=1.9.0 in c:\users\purunet\appdata\roaming
\python\python38\site-packages (from virtualenv->pipenv) (1.14.0)

==========================================

C:\Users\purunet>pipenv install requests
Creating a virtualenv for this project…
Pipfile: C:\Users\purunet\Pipfile
Using c:\users\purunet\appdata\local\programs\python\python38-32\python.exe (3.8
.2) to create virtualenv…
[    ] Creating virtual environment...created virtual environment CPython3.8.2.f
inal.0-32 in 13262ms

  creator CPython3Windows(dest=C:\Users\purunet\.virtualenvs\purunet-gFaNxclQ, c
lear=False, global=False)

  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest
, via=copy, app_data_dir=C:\Users\purunet\AppData\Local\pypa\virtualenv\seed-app
-data\v1.0.1)

  activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,Pyth
onActivator,XonshActivator

Successfully created virtual environment!
Virtualenv location: C:\Users\purunet\.virtualenvs\purunet-gFaNxclQ
Creating a Pipfile for this project…
Installing requests…
Adding requests to Pipfile's [packages]…
Installation Succeeded
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Success!
Updated Pipfile.lock (fbd99e)!
Installing dependencies from Pipfile.lock (fbd99e)…
  ================================ 5/5 - 00:00:09
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

C:\Users\purunet>mkdir my_project

C:\Users\purunet>cd my_project

C:\Users\purunet\my_project>pipenv install requests
Installing requests…
Adding requests to Pipfile's [packages]…
Installation Succeeded
Installing dependencies from Pipfile.lock (fbd99e)…
  ================================ 5/5 - 00:00:03
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.


==========================================

C:\Users\purunet\my_project>pipenv shell
Launching subshell in virtual environment…
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

==========================================

(purunet-gFaNxclQ) C:\Users\purunet>python
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'C:\\Users\\purunet\\.virtualenvs\\purunet-gFaNxclQ\\Scripts\\python.exe'
>>> import requests
>>> exit()

(purunet-gFaNxclQ) C:\Users\purunet>exit


==========================================

C:\Users\purunet\my_project>pipenv run python
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'C:\\Users\\purunet\\.virtualenvs\\purunet-gFaNxclQ\\Scripts\\python.exe'
>>> import requests
>>> exit()

==========================================

C:\Users\purunet\my_project>pipenv
Usage: pipenv [OPTIONS] COMMAND [ARGS]...

Options:
  --where             Output project home information.
  --venv              Output virtualenv information.
  --py                Output Python interpreter information.
  --envs              Output Environment Variable options.
  --rm                Remove the virtualenv.
  --bare              Minimal output.
  --completion        Output completion (to be eval'd).
  --man               Display manpage.
  --support           Output diagnostic information for use in GitHub issues.
  --site-packages     Enable site-packages for the virtualenv.  [env var:
                      PIPENV_SITE_PACKAGES]
  --python TEXT       Specify which version of Python virtualenv should use.
  --three / --two     Use Python 3/2 when creating virtualenv.
  --clear             Clears caches (pipenv, pip, and pip-tools).  [env var:
                      PIPENV_CLEAR]
  -v, --verbose       Verbose mode.
  --pypi-mirror TEXT  Specify a PyPI mirror.
  --version           Show the version and exit.
  -h, --help          Show this message and exit.


Usage Examples:
   Create a new project using Python 3.7, specifically:
   $ pipenv --python 3.7

   Remove project virtualenv (inferred from current directory):
   $ pipenv --rm

   Install all dependencies for a project (including dev):
   $ pipenv install --dev

   Create a lockfile containing pre-releases:
   $ pipenv lock --pre

   Show a graph of your installed dependencies:
   $ pipenv graph

   Check your installed dependencies for security vulnerabilities:
   $ pipenv check

   Install a local setup.py into your virtual environment/Pipfile:
   $ pipenv install -e .

   Use a lower-level pip command:
   $ pipenv run pip freeze

Commands:
  check      Checks for security vulnerabilities and against PEP 508 markers
             provided in Pipfile.
  clean      Uninstalls all packages not specified in Pipfile.lock.
  graph      Displays currently-installed dependency graph information.
  install    Installs provided packages and adds them to Pipfile, or (if no
             packages are given), installs all packages from Pipfile.
  lock       Generates Pipfile.lock.
  open       View a given module in your editor.
  run        Spawns a command installed into the virtualenv.
  shell      Spawns a shell within the virtualenv.
  sync       Installs all packages specified in Pipfile.lock.
  uninstall  Un-installs a provided package and removes it from Pipfile.
  update     Runs lock, then sync.

==========================================

C:\Users\purunet\my_project>pip

Usage:
  pip [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependen
cies.
  config                      Manage local and global configuration.
  search                      Search PyPI for packages.
  cache                       Inspect and manage pip's wheel cache.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  debug                       Show information useful for debugging.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring
                              environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be
                              used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be
                              used up to 3 times (corresponding to WARNING,
                              ERROR, and CRITICAL logging levels).
  --log                 Path to a verbose appending log.
  --proxy              Specify a proxy in the form
                              [user:passwd@]proxy.server:port.
  --retries          Maximum number of retries each connection should
                              attempt (default 5 times).
  --timeout              Set the socket timeout (default 15 seconds).
  --exists-action     Default action when a path already exists:
                              (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
  --trusted-host    Mark this host or host:port pair as trusted,
                              even though it does not have valid or any HTTPS.
  --cert                Path to alternate CA bundle.
  --client-cert         Path to SSL client certificate, a single file
                              containing the private key and the certificate
                              in PEM format.
  --cache-dir

           Store the cache data in .
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine
                              whether a new version of pip is available for
                              download. Implied with --no-index.
  --no-color                  Suppress colored output
  --no-python-version-warning
                              Silence deprecation warnings for upcoming
                              unsupported Pythons.


==========================================

C:\Users\purunet\my_project>pipenv install pytest --dev
Installing pytest…
Adding pytest to Pipfile's [dev-packages]…
Installation Succeeded
Pipfile.lock (9e60ab) out of date, updating to (fbd99e)…
Locking [dev-packages] dependencies…
Success!
Locking [packages] dependencies…
Success!
Updated Pipfile.lock (9e60ab)!
Installing dependencies from Pipfile.lock (9e60ab)…
  ================================ 16/16 - 00:00:14
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

==========================================

C:\Users\purunet\my_project>pipenv graph
pytest==5.4.2
  - atomicwrites [required: >=1.0, installed: 1.4.0]
  - attrs [required: >=17.4.0, installed: 19.3.0]
  - colorama [required: Any, installed: 0.4.3]
  - more-itertools [required: >=4.0.0, installed: 8.3.0]
  - packaging [required: Any, installed: 20.4]
    - pyparsing [required: >=2.0.2, installed: 2.4.7]
    - six [required: Any, installed: 1.14.0]
  - pluggy [required: >=0.12,<1 .0="" 0.13.1="" installed:="" p="">  - py [required: >=1.5.0, installed: 1.8.1]
  - wcwidth [required: Any, installed: 0.1.9]
requests==2.23.0
  - certifi [required: >=2017.4.17, installed: 2020.4.5.1]
  - chardet [required: >=3.0.2,<4 3.0.4="" installed:="" p="">  - idna [required: >=2.5,<3 2.9="" installed:="" p="">  - urllib3 [required: >=1.21.1,<1 .26="" 1.25.9="" installed:="" p="">
==========================================