pip install git+https://bitbucket.company.com/path/to/package.git 不是从 requirements.txt 安装依赖项

问题描述 投票:0回答:1

我正在尝试从我组织的 Bitbucket 实例安装一个 python 包,我一直在使用以下命令开发它:

$ python -m venv venv
$ source venv/bin/activate
(venv) $ pip install git+https://bitbucket.company.com/path/to/package.git

即使我能够将我的 python

package
安装到
venv
中,但我期待它安装我在
requirements.txt
中指定的必要依赖项!!!

我需要对我的 python 进行哪些更改

package
以安装依赖项?

以下是我的

package
项目结构:

.
├── pyproject.toml
├── README.md
├── requirements.txt
├── src
│   └── package
│       ├── __init__.py
│       └── main.py
└── tests
    └── test_dummy.py

注意,我正在使用

hatchling
构建我的 python
package

pip python-packaging pyproject.toml hatch
1个回答
0
投票

对于pip(和其他安装程序)自动安装项目的依赖项以及项目本身,依赖项必须列在项目的打包元数据中(而不是在

requirements.txt
中)。这样做的方法是在pyproject.toml
中编写

dependencies列表

旁白:确保仅列出直接依赖项并仅使用松散的版本约束(无固定依赖项)。

© www.soinside.com 2019 - 2024. All rights reserved.