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

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

我的项目在其 Pipfile 中有 django-heroku 作为 package

django-heroku 在其 Pipfile 中有 gunicorn 作为 dev-package。参见:https://github.com/heroku/django-heroku/blob/master/Pipfile

我希望在我的项目中 运行ning pipenv install --dev 之后,我可以 运行 pipenv run gunicorn.

但它抛出以下错误:

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

如果开发依赖项不可用,install --dev 有什么意义?

我相信您链接到的 Pipfile 仅与此软件包的 开发 相关。

然而当包被安装时,它通常依赖于setup.py:

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

如您所见,缺少 gunicorn

一个答案是,包 X 的 "dev dependencies" 是某人在开发(而不是使用)包 X 时需要的包。

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

如果您在您的项目中使用pipenv install --dev,pipenv 应该安装开发您的项目所需的所有包。

如果它一直递归地安装所有开发依赖项,它可能会引入 Python 分析包、测试运行器等,其他包需要进行开发。这些不一定适合开发您的项目的人。

例如,如果我的项目将 pytest 列为开发依赖项,我会对 pipenv 安装的 nose 不满意,这可能在某些情况下被列为开发依赖项其他过时的软件包。

如果您的包的开发人员需要 gunicorn,您应该将其明确列为项目的开发依赖项。