python-poetry / python-poetry/poetry
Inject local dependency version during publish/build
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
Issue Kind
Change in current behaviour
Description
Support injecting dependency versions during publish/build for multi-project releases.
My usecase
I have a multi-project, single repo situation. The separate projects share a single venv and a top level pyproject.toml that has dev dependencies and configuration for linters/cqa - so that these standards are shared.
the top-level pyproject.toml has
./pyproject.toml
[tool.poetry.dependencies]
product-one = { path = "./product-one", develop = true }
product-two = { path = "./product-two", develop = true }
...
That's all well and good, but product-two depends on product-one. We manage this by using the same release cycle for both.
./product-one/pyproject.toml
version = "1.2.0-dev"
...
./product-two/pyproject.toml
version = "1.2.0-dev"
[tool.poetry.dependencies]
product-one = "~1.2.0"
...
Now, using ~1.2.0 doesn't work for poetry install, with or without allow-prereleases. Specifying "1.2.0-dev" does work, but we'd like to allow different patch/build version differences just to be flexible, and not have to set the version in so many places. The best would be to leave this version as * everywhere, and then have a dependency version inject parameter at build time. This would play nice with versioning plugins too.
Example implementation:
pyproject.toml
[tool.poetry.dependencies]
product-one = { inject-version = true } # alternatively, inject-version = "tag"
then publish:
poetry publish --inject-version "product-one='~1.2.0'"
# OR
poetry publish --inject-version "~1.2.0'" # apply same version to every dependency that needs it
This could have the caveat that it only works for path and git dependencies.
Impact
Better multi-project release processes
Workarounds
using sed to fix versions before release pipelines run, modifying build artifacts
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the top-level and project-specific pyproject.toml examples, then trace the poetry publish and build flows for path and git dependencies. Define the supported injection syntax and verify that dependency versions are correctly applied during publishing and that existing versioning workflows remain compatible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system, release
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100