Executing pipfile scripts

Stoltc picture Stoltc · Mar 27, 2018 · Viewed 11.3k times · Source

How can I execute the scripts defined in the Pipfile?

Following the syntax found here, I defined the scripts section in my pipfile as follows:

[scripts]
tests = "bash ./run-tests.sh"

After running $ pipenv install, how can I call the tests script?

I've tried the following without success:

$ tests

$ pipenv tests

$ pipenv run tests

$ pipenv shell (virtual env) $ tests

Answer

Rémi Bourgeon picture Rémi Bourgeon · Apr 29, 2018

I had the same problem and I happened to solve it thanks to a discussion in this issue.

Long story short, I only updated pipenv globally before beginning my project, not locally. So I still was using the old version.

To properly update the version of pipenv that you are using, you have to upgrade pipenv also for the user you are using for the project. Hence :

$ sudo pip install pipenv --upgrade --user

solved my problem.

May this silly mistake be my first SO contribution, and my eternal shame.

Edit:

As noted by Coleman Stoltze, the correct way to call the script is :

$ pipenv run tests