-
Notifications
You must be signed in to change notification settings - Fork 36
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
503e75d
Support poetry 1.2.0+ dependency groups.
tiegz 3ed4225
8.7.3
tiegz 1905585
Default to "runtime" type, and keep "develop"
tiegz db0bd62
Merge branch 'main' into tz/add-new-poetry-group-support
tiegz 04f2af0
Add a test group example
tiegz b6b6411
8.7.4
tiegz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,7 +102,15 @@ def self.parse_pyproject(file_contents, options: {}) | |
# Parse poetry [tool.poetry] deps | ||
poetry_manifest = file_contents.fetch('tool', {}).fetch('poetry', {}) | ||
deps += map_dependencies(poetry_manifest['dependencies'], 'runtime') | ||
# Poetry 1.0.0-1.2.0 way of defining dev deps | ||
deps += map_dependencies(poetry_manifest['dev-dependencies'], 'develop') | ||
# Poetry's 1.2.0+ of defining dev deps | ||
poetry_manifest | ||
.fetch("group", {}) | ||
.each_pair do |group_name, obj| | ||
group_name = "develop" if group_name == "dev" | ||
deps += map_dependencies(obj.fetch("dependencies", {}), group_name) | ||
end | ||
|
||
# Parse PEP621 [project] deps | ||
pep621_manifest = file_contents.fetch('project', {}) | ||
|
@@ -179,10 +187,10 @@ def self.parse_poetry_lock(file_contents, options: {}) | |
manifest["package"].each do |package| | ||
# next if group == "_meta" | ||
group = case package['category'] | ||
when 'main' | ||
'runtime' | ||
when 'dev' | ||
'develop' | ||
else | ||
'runtime' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this ensures that |
||
end | ||
|
||
deps << { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Bibliothecary | ||
VERSION = "8.7.3" | ||
VERSION = "8.7.4" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,17 @@ authors = ["Tyrel Souza <tyrel@tidelift.com>"] | |
python = "^3.7" | ||
django = "^3.0.7" | ||
|
||
# Old way to define development deps (<1.2.0) | ||
[tool.poetry.dev-dependencies] | ||
pytest = "^5.2" | ||
|
||
# New way to define development deps (>=1.2.0) | ||
[tool.poetry.group.dev.dependencies] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
wcwidth = "*" | ||
|
||
[tool.poetry.group.test.dependencies] | ||
sqlparse = "0.3.1" | ||
|
||
[build-system] | ||
requires = ["poetry>=0.12"] | ||
build-backend = "poetry.masonry.api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
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?There was a problem hiding this comment.
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:There's an implicit
main
group that is the default, but we've apparently mapped that toruntime
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 betweendev
andtest
to Poetry other than the names: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 : \