pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

Add support for script hooks

Open sedrubal opened this issue 7 years ago • 8 comments

npm and yarn execute scripts with special names like postinstall and so on after/before several actions. Pipenv should do the same.

Is your feature request related to a problem? Please describe.

Our django project has some dependencies, that have to be installed using yarn.

Describe the solution you'd like

It was nice, if pipenv installs those dependcies automatically by executing a postinstall script, that calls yarn install.

Describe alternatives you've considered

Otherwise I have to run pipenv install and yarn install.


$ pipenv --support
Error: no such option: --support
$ pipenv --version
pipenv, version 11.10.4

sedrubal avatar Sep 03 '18 13:09 sedrubal

I am strongly -1 to this. npm’s magic script names are asking for trouble, and completely against Python’s preference to readability and obviousness. I am indifferent toward hooks as an idea (although I suspect Kenneth would object), but npm’s approach is not a good fit.

In any case, however, consider submitting a PEEP to describe your suggestion, and it will be discussed accordingly :)

uranusjr avatar Sep 03 '18 14:09 uranusjr

(sorry, clicked the wrong button)

uranusjr avatar Sep 03 '18 14:09 uranusjr

Just another use case is enabling jupyter extensions after installing. For example, to install qgrid:

pip install qgrid
jupyter nbextension enable --py --sys-prefix qgrid

# only required if you have not enabled the ipywidgets nbextension yet
jupyter nbextension enable --py --sys-prefix widgetsnbextension

AlJohri avatar Jun 13 '19 21:06 AlJohri

I kind of feel that this kind of (install) hooks should be standardised in package metadata. Maybe it would be a good idea to raise this to pip, or distutils-sig for more general consideration.

uranusjr avatar Jun 14 '19 01:06 uranusjr

In my case, I need to update setup.py after each install and I prefer set a post-install script in order to execute

pipenv-setup sync

instead to put this in the doc of the project.

Tlaloc-Es avatar Apr 06 '22 15:04 Tlaloc-Es

Use case...

After loading Playwright, you must do:

playwright install

Reference: https://playwright.dev/python/docs/intro

seandenigris avatar Jul 26 '22 16:07 seandenigris

Use case, pre-commit.

After installing the environment, pre-commit install must be executed or else the git hook is not installed.

If a project member doesn't run that command post clone/install, commits will bypass that (admittedly thin) layer of code quality assurance. Even if it's redundant, since the same quality is setup on the CI environment, it's a good practice for team members and to prevent some wasted time waiting for CI to run on every broken PR.

Reference: https://pre-commit.com/#3-install-the-git-hook-scripts

mkvlrn-cm42 avatar Aug 21 '22 13:08 mkvlrn-cm42

need this to install git hooks for enforcing semver

Any temporary solution for this?

tamis-laan avatar Sep 22 '22 11:09 tamis-laan

Use Case: after installing aws-glue-sessions (docs) jupyter kernel in a virtual environment, you need to run the following commands to install the kernel:

SITE_PACKAGES=$(pip3 show aws-glue-sessions | grep Location | awk '{print $2}')
python3 -m jupyter kernelspec install $SITE_PACKAGES/aws_glue_interactive_sessions_kernel/glue_pyspark --sys-prefix
python3 -m jupyter kernelspec install $SITE_PACKAGES/aws_glue_interactive_sessions_kernel/glue_spark --sys-prefix

AlJohri avatar Nov 27 '22 04:11 AlJohri