I'm trying to come up with a solution to what seems like a pretty mundane task: develop a python package with relative dependencies, and then publish it to PyPI, however all tools I have found so far seem not to address this issue. What am I not seeing?
I'll use poetry
in this example since that is the most complete solution I could find so far, but alternatives would be fine too.
The package structure is pretty similar to this
├── package_a/
│ ├── package_a/...
│ └── pyproject.toml
├── package_b/
│ ├── package_b/...
│ └── pyproject.toml
Now the thing is that package_b
depends on package_a
, and I'd like to use a relative dependency in pacakge_a/pyproject.toml
:
[tool.poetry]
name = "package_a"
packages = [
{ include = "package_a" },
]
[tool.poetry.dependencies]
python = "^3.7"
package_b = { path = "../package_b", develop = true }
The goal here to be able to develop both package_a
and package_b
in parallel without having to continuously publish and reinstall since that is quite error prone.
And it works, until I try and publish the packages to PyPI, where the path dependencies are just copied in, and are now clearly unresolvable, because the repository path context is lost when publishing a dist bundle.
Is there a way to have poetry swap out the actual versions in the dependencies when publishing, or will I really need to do some sed
magic to achieve this very common task?