我的要求中可以有一个可编辑的条目吗?txt?

发布于 2025-01-29 07:13:31 字数 594 浏览 1 评论 0 原文

我有一个以前安装到可编辑软件包中的环境:

virtualenv venv
. venv/bin/activate
pip install -e ...
pip freeze | grep <pkg_name>

-e git+ssh://

我的问题是 - 如何使其拉出代码以构建和安装,而不是来自远程服务器,而是从我的本地项目中(就像运行 pip install -e

显然,假设项目仍然存在,但这是我想要的...

I have an environment which I previously installed into an editable package:

virtualenv venv
. venv/bin/activate
pip install -e ...
pip freeze | grep <pkg_name>

-e git+ssh://[email protected]/SPACE/REPO.git@HASH#egg=NAME&subdirectory=PATH

I copeid the pip freeze result to a req.txt file and installed it into a new environment, and it works.

My question is - how can I make it pull the code to build and install, not from a remote server, but from my local project (like done when running pip install -e)

It would obviously only work on my machine, assuming that project still is there, but this is what I want...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空宴 2025-02-05 07:13:31

根据pip文档( 1 2 ),是的,您可以在此中具有这样的条目您的需求.txt:

-e git+ssh://[email protected]/repo.git

另外AS chepner 已经指出,一个人只能指定本地URL:

-e file:///home/someone/repo
-e file://C:\Users\someone\repo

According to pip documentation (1, 2), yes, you can have an entry like this in your requirements.txt:

-e git+ssh://[email protected]/repo.git

Also as chepner has pointed out, one could just specify local URL:

-e file:///home/someone/repo
-e file://C:\Users\someone\repo
夏见 2025-02-05 07:13:31

以可编辑模式安装软件包时,本地文件系统

相对本地文件路径可以方便。

因此,代替 unignts.txt

-e file:///home/user-x/project/src/package-x

使用 sumpllies.txt

-e file:./src/package-x

现在您可以为多个用户和CI环境使用相同的 sublices.txt

conda,

您也可以在 conda 环境中安装可编辑的Python软件包,并使用 envrioment.yml 这样:

name: project
channels:
- conda-forge
dependencies:
- pip:
  - -e file:./src/package-x
  - -e file:./src/package-y
- conda-lock
- click

Local filesystem

Relative local file paths can be handy when installing packages in editable mode.

So instead of requirements.txt:

-e file:///home/user-x/project/src/package-x

Use requirements.txt:

-e file:./src/package-x

Now you can use the same requirements.txt for multiple users and ci environments.

Conda

You can install editable Python packages in conda environments too, with a envrioment.yml like this:

name: project
channels:
- conda-forge
dependencies:
- pip:
  - -e file:./src/package-x
  - -e file:./src/package-y
- conda-lock
- click
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文