pipenv Post-Install Actions

598 Views Asked by At

I'm using Python via Pharo/GToolkit's PythonBridge, which uses pipenv under the hood.

Things are kicked off via this built-in PythonBridge script (install_env.sh):

#!/bin/bash
cd "$(dirname "$0")"
export PIPENV_VENV_IN_PROJECT=1
pipenv install
pipenv run pip install debugpy

One of the dependencies in my Pipfile is Playwright. Its docs list two main steps to installation:

pip install playwright
playwright install

My question is: where do I "put" the second playwright install command?

It doesn't seem practical to alter install_env.sh, which is generated at some point by PythonBridge. I was hoping pipenv might have a concept of a "post-install script hook", but DuckDuckGo-ing various combinations of those words, as well as reading the pipenv docs didn't reveal anything seemingly helpful.

2

There are 2 best solutions below

1
On BEST ANSWER

I think that this feature is not supported now, you can put your needs here https://github.com/pypa/pipenv/issues/2817 in order to try the pipenv develop that feature.

0
On

Until it's actually supported, a workaround is to use scripts in your Pipfile:

[scripts]
hooks = "playwright install"

And run pipenv install && pipenv run hooks.

Example with multiple hooks:

[scripts]
hooks = "bash -c 'pipenv run hook_1 && pipenv run hook_2'"
hook_1 = "some_command"
hook_2 = "another_command"