Open wabiloo opened 4 weeks ago
Hi! I just tested this out, and I'm not sure there's a good way to make it work :/ There are a few problems:
I tried doing this, but it doesn't work, because Poetry has already analyzed the versions before this substitution occurs:
[[tool.poetry-dynamic-versioning.substitution.folders]]
path = "."
files = ["pyproject.toml"]
patterns = ["(my-sdk = \")0.0.0(\")"]
It should work if you relax the dependency constraint, but that depends on what backwards compatibility guarantees you're comfortable making:
[tool.poetry.dependencies]
my-sdk = ">= 1.0.0, < 2.0.0"
Maybe the plugin could directly modify the version constraints in memory after Poetry has already parsed them, but I haven't explored how complicated/feasible that would be.
Unfortunately the dependency constraints are strict. I used to have the SDK and CLI as separate packages and repos, but they’re so tightly integrated that I had to ensure the version was always the same between both and hence more to a mono-repo.
I’ve also tried to change the sdk to just use the local path and not specify a version constraint
[tool.poetry.dependencies]
my-sdk = { path = "../my-sdk", develop = true }
python = "^3.10"
click = "^8.1.3"
[tool.poetry.scripts]
cli = "my_cli.app:safe_entry_point"
[tool.poetry.group.dev.dependencies]
However I have no idea what poetry does when it comes to building / publishing it so that seems incorrect…
Fabre Lambeau
On Sat, 17 Aug 2024 at 00:10, Matthew Kennerly @.***> wrote:
Hi! I just tested this out, and I'm not sure there's a good way to make it work :/ There are a few problems:
- Poetry resolves the dependency version constraints before the plugin performs text substitution
- Poetry tries to resolve all groups together: python-poetry/poetry#1168 https://github.com/python-poetry/poetry/issues/1168
I tried doing this, but it doesn't work, because Poetry has already analyzed the versions before this substitution occurs:
[[tool.poetry-dynamic-versioning.substitution.folders]]path = "."files = ["pyproject.toml"]patterns = ["(my-sdk = \")0.0.0(\")"]
It should work if you relax the dependency constraint, but that depends on what backwards compatibility guarantees you're comfortable making:
[tool.poetry.dependencies]my-sdk = ">= 1.0.0, < 2.0.0"
Maybe the plugin could directly modify the version constraints in memory after Poetry has already parsed them, but I haven't explored how complicated/feasible that would be.
— Reply to this email directly, view it on GitHub https://github.com/mtkennerly/poetry-dynamic-versioning/issues/189#issuecomment-2294375060, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA66JR5F4EJNM22YGF53H4LZRZ2ENAVCNFSM6AAAAABMSABTPOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJUGM3TKMBWGA . You are receiving this because you authored the thread.Message ID: @.***>
Unfortunately, at the moment, I don't think you can use this plugin with your setup 😞
I'm trying a very similar setup but I'm also using another plugin https://github.com/gerbenoostra/poetry-plugin-mono-repo-deps/ for a monorepo with multiple python projects that depend on each other. It rewrites the version # of path depenencies prior to build. I'm still working through other issues in my setup but I wonder if it might help to use both.
Actually I think I have similar problem. Unfortunately it's writing out the real version to poetry.lock file . So it would be unrealistic to update it every time. If I don't specify version depenency, it gets stuck on the older one.
Hi,
I have a mono repo "mono-repo" which contains 2 subfolders "cli" and "sdk". Both are intrinsically linked (the cli uses the sdk) and therefore I decided to have a common version number (hence the mono-repo, using git tag versions)
However they can be built and deployed independently.
The pyproject.toml for the cli is as follows:
When I try to build it fails due to the first dependency set to 0.0.0 (which does not exist). Is there a way to have this updated as well as the tool.poetry.version?