Manage versioning of Poetry tool dependency #138
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The project's Python package dependencies are managed by the Poetry tool.
Previously, the version of Poetry was not managed in any way.
The GitHub Actions workflows used whichever version of Poetry happened to be installed on the runner machine. This meant that the GitHub Actions workflows could break at any time through the poetry installation on the runner machine being updated to an incompatible version.
The contributors used whichever version of Poetry happened to be installed on their machine. This meant that they might get different results from that produced by the environment of the GitHub Actions workflows.
The better solution is to take the same approach for managing the Poetry dependency as done for the project's other dependencies:
The logical place to define the
poetry
package dependency version is in pyproject.toml, as is done for all direct Python package dependencies.Dependabot recognizes two forms of dependency data in the
pyproject.toml
file:Since Poetry can't be used to manage itself (it is instead installed using pipx), the obvious approach would be to define the
poetry
dependency in a PEP 621 field in the file. However, this is not possible because if Dependabot finds Poetry data inpyproject.toml
, it ignores the PEP 621 fields. So it is necessary to define the Poetry dependency in the Poetry fields of the file. A special dependencies group is created for this purpose. That group is configured as "optional" so that it won't be installed redundantly bypoetry install
commands.Unfortunately pipx doesn't support using
pyproject.toml
as a dependency configuration file so it is necessary to generate the dependency argument in the pipx command by parsing theproject.toml
file. The yq tool is used for this purpose.