Poetry packaging several dependencies

37 Views Asked by At

I have a project with several packages:

Project  
|---PackageA  
|------dist  
|----------packagea.whl  
|------pyproject.toml  
|---PackageB  
|------dist  
|----------packageb.whl  
|------pyproject.toml  

PackageB has PackageA as a dependency.

Right now I have PackageB pyproject.toml like this:

[tool.poetry.dependencies]  
packagea = {path = "../PackageA", develop = true}

I then send both wheel files to another "prod" machine and try to install them.
I can't publish in PyPI the packages for IP reasons.

PackageA installation passes, however PackageB installation fails. That happens because PackageB is looking for PackageA at the same location it was in my original "dev" machine.

  1. I don't understand something basic:
    When I install PackageA, I see it installed as "packagea" in my python environment (using pip list).
    When I install PackageB, if packagea is already installed, shouldn't it skip this dependency installation?

  2. What is the correct way to build packages and shipping them without PyPI?

  3. Is there a way to pip install packageb.whl excluding ONLY "packagea" dependecy? Obviously, there will be no problem running the project, because python will find "packagea" in its environment.

UPD.:
Currently, I see no legit way to build 2 local packages for deployment without external repository (PyPI or Git). Pip's requirement to use absolute paths in dependencies leads to "PackageB" being not portable, because you can't know the deployment path of a local dependency in advance.
In simple words: There's no official way to build/publish a package with a local dependency (without workaround). It will be not installable.

0

There are 0 best solutions below