简体   繁体   English

为什么我不能在`pipenv install --dev`后运行开发依赖项?

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

My project has django-heroku in its Pipfile as a package .我的项目在它的 Pipfile 中有django-heroku作为一个package

django-heroku has gunicorn in its Pipfile as a dev-package . django-herokugunicorn在其Pipfile作为dev-package See: https://github.com/heroku/django-heroku/blob/master/Pipfile见: 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 .我希望在我的项目中运行pipenv install --dev之后,我可以运行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 ?如果开发依赖项不可用, install --dev什么install --dev

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.一个答案是包 X 的“开发依赖项”是某人在开发(而不是使用)包 X 时需要的包。

I would expect that after running pipenv install --dev in my project, ...我希望在我的项目中运行 pipenv install --dev 后,...

If you use pipenv install --dev in your project , pipenv should install all the packages that are required to develop your project.如果您在项目中使用pipenv install --dev , pipenv 应该安装开发项目所需的所有包。

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.如果它一直向下递归安装所有开发依赖项,它可能会引入其他包开发所需的 Python 分析包、测试运行器等。 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.例如,如果我的项目将pytest列为 dev 依赖项,我会对pipenv安装的nose不满意,这可能会在其他一些过时的包中列为 dev 依赖项。

If developers of your package need gunicorn , you should list it explicitly as a dev dependency of your project.如果您的包的开发人员需要gunicorn ,您应该将其明确列为项目的开发依赖项。

I believe the Pipfile you've linked to is only relevant to the development of this package.我相信您链接到的Pipfile仅与此包的开发有关。

However when the package is installed , it usually relies on setup.py :但是当安装包时,它通常依赖于setup.py

REQUIRED = [
    'dj-database-url>=0.5.0', 'whitenoise', 'psycopg2', 'django'
]

As you can see, gunicorn is missing.如您所见, gunicorn不见了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM