Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I run dev dependencies after `pipenv install --dev`?

Tags:

python

pipenv

My project has django-heroku in its Pipfile as a package.

django-heroku has gunicorn in its Pipfile as a dev-package. See: https://github.com/heroku/django-heroku/blob/master/Pipfile

I would expect that after running pipenv install --dev in my project, I could then run pipenv run gunicorn.

But it throws the following error:

Error: the command gunicorn could not be found within PATH or Pipfile's [scripts].

If dev dependencies aren't available, what's the point of install --dev?

like image 587
RobertAKARobin Avatar asked May 20 '19 19:05

RobertAKARobin


People also ask

Does Pipenv install Dev dependencies?

If you use pipenv install --dev in your project, pipenv should install all the packages that are required to develop your project. If it recursively installed all dev dependencies all the way down, it might pull in Python profiling packages, test runners, etc., that other packages need for development.

How do I know if Pipenv is installed?

To see installed packages with Pipenv, you can use the pipenv graph command. The output from this is perhaps more verbose than you'd like, but it does contain everything you need.

How do you activate Pipenv?

To activate the environment, just navigate to your project directory and use pipenv shell to launch a new shell session or use pipenv run <command> to run a command directly.

What does Pipenv sync do?

pipenv sync will install the exact versions specified in Pipfile. lock. I would say sync is better for getting your environment to match what is checked in, and install is for when you want to get the latest versions, or are adding new dependencies that aren't in the lock file yet.


1 Answers

One answer is that the "dev dependencies" of package X are the packages someone would need if they were developing (as opposed to using) package X.

I would expect that after running pipenv install --dev in my project, ...

If you use pipenv install --dev in your project, pipenv should install all the packages that are required to develop your project.

If it recursively installed all dev dependencies all the way down, it might pull in Python profiling packages, test runners, etc., that other packages need for development. Those wouldn't necessarily be appropriate for someone developing your project.

As an example, if my project listed pytest as a dev dependency , I would be unhappy in pipenv installed nose, which could be listed as an dev depenedency in some other, out-of-date package.

If developers of your package need gunicorn, you should list it explicitly as a dev dependency of your project.

like image 131
NicholasM Avatar answered Sep 30 '22 18:09

NicholasM