简体   繁体   English

python pip - 具有本地依赖关系的开发模式

[英]python pip - development mode with local dependencies

Background 背景

I have two python projects. 我有两个python项目。 Project A and Project B. 项目A和项目B.

Each project has its own virtual environment and its own setup.py. 每个项目都有自己的虚拟环境和自己的setup.py。

Both projects are not pure py files and has "build" process like building extensions, generate source etc. 这两个项目都不是纯py文件,并且具有“构建”过程,如构建扩展,生成源等。

A is dependent on B (setup.py install_requires points on B). A依赖于B(B上的setup.py install_requires点)。

Each project is built and published/distributed as a wheel to pypi on-premise repository. 每个项目都作为一个轮子构建和发布/分发到pypi内部部署存储库。

pip install w/wo -e (development mode) of project A, nicely installs project B into project A venv site-packages. pip install w / wo -e(项目A的开发模式),很好地将项目B安装到项目A venv站点包中。

So far everything is working nicely and "by the book". 到目前为止,一切都运行良好,“按书”。

Now, my story get complicated ... 现在,我的故事变得复杂......

I would like to develop the two projects together without having to publish B in order A to consume it. 我想一起开发这两个项目,而不必按顺序A发布B来使用它。

As example, I would like to: 例如,我想:

  1. Change something in B. 改变B中的东西。
  2. build B (setup.py build). 构建B(setup.py构建)。
  3. NOT publish B as wheel to pypi. 不要将B作为轮子发布到pypi。
  4. Goal - Project A will "know" the modified Project B. WITHOUT manually tweaking sys.path. 目标 - 项目A将“知道”修改后的项目B. 无需手动调整sys.path。

I actually want the pip install -e of project A to install project B in development mode too. 我实际上想要项目A的pip install -e也可以在开发模式下安装项目B.

After some reading I understood (hopefully correctly) that one can define a "distribution" as a local source folder by --find-links flag. 经过一些阅读后,我理解(希望是正确的)可以通过--find-links标志将“分发”定义为本地源文件夹

I defined project B root folder in --find-links. 我在--find-links中定义了项目B根文件夹。

I tried it with (on project A setup.py folder): 我尝试了(在项目A setup.py文件夹上):

  1. pip install . 点子安装。 -e --find-links = file:///path/to/B -e --find-links = file:/// path / to / B.

  2. pip install . 点子安装。 -e --find-links = git+file://path/to/B -e --find-links = git + file:// path / to / B.

Both did not work. 两者都没用。

BTW, Puting in the path to B wheel or egg of B, BTW,在通往B轮或B蛋的路径中,

ex: pip install . 例如: pip安装。 -e --find-links = file:///path/to/B.whl -e --find-links = file:///path/to/B.whl

did work but this is not what I am looking for. 确实有效,但这不是我想要的。

Hope you are still with me :-) (sorry for the tedious story) 希望你还在我身边:-)(对于这个乏味的故事感到抱歉)

What am I missing? 我错过了什么?

Tx TX

Let me try and restate the problem: 让我试着重述一下这个问题:

  • You work on two python packages , package A and package B. A depends on B. 你工作两个python ,包A和包B. A取决于B.
  • You have chosen to develop these two packages in separate virtual environments. 您已选择在单独的虚拟环境中开发这两个包。
  • You would like to make some local changes to package B and have package A use the modified version of package B. 您希望对包B进行一些本地更改,并使包A使用包B的修改版本。

I apologize if I'm missing something here, but why not simply install both packages in the same virtual environment, which will make this problem go away? 如果我在这里遗漏了一些东西,我很抱歉,但为什么不简单地在同一个虚拟环境中安装这两个软件包,这会让这个问题消失呢?

Ie after creating your environment, you install package B in editable mode, followed by installing package A. Any changes in B will be picked up by A, no changes needed. 即在创建环境之后,将软件包B安装在可编辑模式下,然后安装软件包A. B中的任何更改都将由A获取,无需进行任何更改。

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

相关问题 如何在开发模式下使用 pip 删除 python 包的依赖项(注意与删除包不同)? - How to remove in development mode a python package's dependencies with pip (note not the same as removing the package)? 使用 pip 在开发模式下安装本地 package 时找不到 setuptools - setuptools not found when installing local package in development mode with pip 使用 pip 安装 python package 的开发版本,但具有稳定的依赖关系 - Install using pip a development version of a python package but with stable dependencies Python Pip 本地下载 - Python Pip Local Download AWS SSM是否有本地开发模式? - Is there a local development mode for AWS SSM? PIP-如何从本地文件夹安装依赖项? - PIP - How to install dependencies from local folder? pip 使用 Jenkinsfile 从本地 pypi(JFROG 工件)安装 python package 和 dependencies.whl 文件 - pip install a python package and dependencies .whl file from local pypi (JFROG artifactory) using Jenkinsfile Python pip-可编辑的源安装,具有在setup.py中指定的其他本地依赖项 - Python pip - editable install from source that has additional local dependencies specified in setup.py 在Python开发环境中获取依赖项 - Getting dependencies in a Python development environment Python 3.5 和 pip 的本地安装 - Local installation of Python 3.5 and pip
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM