Have you noticed that recommendation for Managing Application Dependency at python.org has been changed? Apparently our python community should use now Pipenv. But how to? Let's check out!

S0-E25/E30 :)

Pipenv

The Pipenv has been created by Kenneth Reitz - who complained at his blog in this post - A better pip workflow - about pip workflow - and then created this tool.

You can check Readme for pypenv at their github repository to find out what problems it solves :) I encourage you to do that !

Let's get started!

Installing Pipenv

So first things first - What do we need for Pipenv ?

  • pip - you can find out how to get pip here - but for most of the *nix users - you should already have pip packaged with your system.

Then:

pip install pipenv

Adding a shell-completion!

Bash

Put command below into your .bashrc or .bash_profile:

eval "$(pipenv --completion)"

Basic usage

Let's make some day-to-day tasks with pipenv:

Create new project using python3.6

First let's make a project with :

mkdir pipenv_test_project
cd pipenv_test_project
git init .
git commit --allow-empty -m "Init"
git remote add origin git@github.com:anselmos/pipenv_test_project.git
git push origin HEAD:master

Initialize pipenv at project

And now initialize pipenv at the pipenv_test_project:

pipenv --python 3.6

Activating pipenv at project

pipenv shell

REMEMBER - you need to be in the root path of the project.

Install all dependences including dev:

pipenv install --dev

This will create a Pipfile.lock.

Let's install some dependency i.e. selenium

pipenv install selenium

And your Pipfile and Pipfile.lock has been changed.

Installing old version of pelican and upgrading

pipenv install pelican==3.6.0

Upgrading to latest version of pelican

pipenv install pelican

Which will automatically check version and install the latest - 3.7.1 ! Yeah.

Uninstalling pelican

pipenv uninstall pelican

The pipenv_test_project

The project for this article is available here.

That was an introduction to pipenv - if you need a more advanced stuff - check documentation or pipenv --man

Acknowledgements

Thanks!

That's it :) Comment, share or don't :)

If you have any suggestions what I should blog about in the next articles - please give me a hint :)

See you tomorrow! Cheers!



Comments

comments powered by Disqus