Python - pipenv (dependency framework)

Card Puncher Data Processing

About

pip+venv = pipenv

pipenv is a dependency framework for Python.

See https://packaging.python.org/key_projects/#pipenv

Managing

Install pipenv

pip

pip install --user pipenv

PyCharm

Idea Pipenv Sdk

Steps

Add dependency

pipenv install package

it will install a Python - virtualenv (Python Environment)

Example

pipenv install requests
Creating a virtualenv for this project…
Pipfile: D:\code\python-gh\Pipfile
Using c:\python37-32\python.exe (3.7.1) to create virtualenv…
Complete
Already using interpreter c:\python37-32\python.exe
Using base prefix 'c:\\python37-32'
New python executable in C:\Users\gerard\.virtualenvs\python-gh-yOsZOOt6\Scripts\python.exe
Installing setuptools, pip, wheel...
done.
Virtualenv location: C:\Users\gerard\.virtualenvs\python-gh-yOsZOOt6
Creating a Pipfile for this project…
Installing requests…
Installation Succeeded
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Success!
Updated Pipfile.lock (444a6d)!
Installing dependencies from Pipfile.lock (444a6d)…
  ================================ 5/5 - 00:00:01

Pipfile

The created Pipfile (configuration). The Pipfile is used to track which dependencies your project needs.

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[[source]]
url = "http://hostname/repository/pypi-all/simple/"
name = "pypi-aap"
verify_ssl = false

[dev-packages]

[packages]
requests = "*"

[requires]
python_version = "3.7"

where:

Activate / use the virtual env

To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

Example:

  • pipenv shell
pipenv shell
Launching subshell in virtual environment…
Microsoft Windows [Version 10.0.16299.726]
(c) 2017 Microsoft Corporation. All rights reserved.

(python-gh-yOsZOOt6) d:\code\python-gh>

  • pipenv run
pipenv run python main.py

Documentation / Reference





Discover More
Card Puncher Data Processing
Code Shipping - (Repository | Registry)

A repository is a storage location where artifacts are stored. repository of codeartifact (ie library, package,... The repository can be: local to your local computer remote Example: Maven Central,...
Card Puncher Data Processing
Python - Dependency Management

See: syntax When you install a package, or declaring a dependency, you need to specify an package id that's known...
Card Puncher Data Processing
Python Package - Repository (index)

in Python A repository in Python is also called an index. The Python Package Index (PyPI) is a repository of software for the Python programming language. Every version control system....



Share this page:
Follow us:
Task Runner