pipenv / pipfile - Install different package version in dev

1.7k views Asked by At

Is it somehow possible to install a different version of a Python package in dev? Obviously the Pipfile coul look like following:

[packages]
awesome-package = "==1.2.3"

[dev-packages]
awesome-package = {editable = true, path = "./../../../awesome-package"}

Ideally I would like to switch between a stable version and a locally modified version of a package, when running pipenv install ....

1

There are 1 answers

1
Thomas Steinbach On

Ok, I found my own answer. The solution is to manage multiple virtual environments per project. Pipenv didn't support that natively. However you can manage multiple Pipfiles in subdirectories.

My default Pipfile still resides in the project root. Other virtual environments I maintain in subfolders within the directory pipfile.d:

.
├── Pipfile
├── Pipfile.lock
└── pipfile.d
    └── local-dev
        └── Pipfile
        └── Pipfile.lock

To use a different virtual env I just cd into the local-dev directory, run my pipenv shell and cd from there back to the root directory.