-
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
Changes from all commits
503e75d
3ed4225
1905585
db0bd62
04f2af0
b6b6411
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 << { | ||
|
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 |
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" |
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 : \