Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.7.4: Add support for Poetry 1.2.0+'s dependency groups #584

Merged
merged 6 commits into from
Dec 11, 2023

Conversation

tiegz
Copy link
Contributor

@tiegz tiegz commented Dec 9, 2023

Poetry 1.2.0 added support for dependency groups in python-poetry/poetry#4260 , e.g.:

[tool.poetry.group.test.dependencies]
pytest = "^6.0.0"
pytest-mock = "*"

docs: https://github.com/python-poetry/poetry/blob/1.7.1/docs/managing-dependencies.md#dependency-groups

when 'dev'
'develop'
else
'runtime'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this ensures that pypoetry.lock should not get a type: nil back

@tiegz tiegz force-pushed the tz/add-new-poetry-group-support branch from 94e4f86 to 19dcd47 Compare December 9, 2023 23:11
@tiegz tiegz force-pushed the tz/add-new-poetry-group-support branch from 19dcd47 to 1905585 Compare December 9, 2023 23:11
[tool.poetry.dev-dependencies]
pytest = "^5.2"

# New way to define dev deps (>=1.2.0)
[tool.poetry.group.dev.dependencies]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add another group here and test that the type works correctly. Something like [tool.poetry.group.test.dependencies].

poetry_manifest
.fetch("group", {})
.each_pair do |group_name, obj|
group_name = "develop" if group_name == "dev"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm familiar with toml and how these are getting parsed. What would the expected group names look like. From the Poetry example what would the group_name for [tool.poetry.group.test.dependencies] resolve to here?

Copy link
Contributor Author

@tiegz tiegz Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT it'll use the name that was parsed, so test would be the group there. The docs say:

use a tool.poetry.group. section where is the name of your dependency group (for instance, test):

There's an implicit main group that is the default, but we've apparently mapped that to runtime until now so I'm setting that as the default in the change below.

Also noteworthy is that anything that's not main is considered development semantically, so there's no real distinction between dev and test to Poetry other than the names:

Dependency groups, other than the implicit main group, must only contain dependencies you need in your development process. Installing them is only possible by using Poetry.

And FWIW, I'd prefer that Bibliothecary return "development" here to be consistent with the other parsers, but there are 3 uses of "develop" in this file so I'm hesitant to break anything for consumers of the gem : \

@tiegz tiegz self-assigned this Dec 11, 2023
@tiegz tiegz changed the title Add support for Poetry 1.2.0+'s dependency groups 8.7.4: Add support for Poetry 1.2.0+'s dependency groups Dec 11, 2023
@tiegz tiegz merged commit 3c77ca3 into main Dec 11, 2023
1 check passed
@tiegz tiegz deleted the tz/add-new-poetry-group-support branch December 11, 2023 20:30
andrew pushed a commit to ecosyste-ms/bibliothecary that referenced this pull request Jan 8, 2024
…#584)

* Support poetry 1.2.0+ dependency groups.

* Default to "runtime" type, and keep "develop"

* Add a test group example

* 8.7.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants