-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Milestone
Description
Description
With poetry 2.0+ the default behavior for tool.poetry.includes
has changed. Previously it defaulted to “only sdist” for directories and to “sdist and wheel” for files. Now the behavior is to default to "only sdist". We would like to have a migration which will transform any includes under tool.poetry
to the proper format and specify the correct packaging.
Example:
include = ["src/my_package/generated/**/*"]
becomes
include = [
{ path = "src/my_package/generated/**/*", format = ["sdist","wheel"] }
]
DOD
Acceptance criteria required to realize the requested feature
- Migration correctly transforms includes to be correctly formatted and specify packaging strategy
- Per discussion in initial DOD: if dir use
sdist
, if file usesdist
/wheel
. For glob, always usesdist
/wheel
- Per discussion in initial DOD: if dir use
- Create tests for migration
- Add documentation for new migration to root README under Poetry v2.0.0+ Changes
@poetry-v2-migration
Feature: Migrate tool.poetry.include entries for Poetry 2.0 to explicitly add format
Scenario: Convert a single file include
Given the Poetry version is at least "2.0.0"
And a pyproject.toml containing:
"""
[tool.poetry]
include = ["scripts/run.py"]
"""
When I run the poetry v2 includes migration
Then the include becomes:
"""
include = [
{ path = "scripts/run.py", format = ["sdist", "wheel"] }
]
"""
Scenario: Transform entries in list
Given the Poetry version is at least "2.0.0"
And a pyproject.toml containing:
"""
[tool.poetry]
include = [
"scripts/run.py",
"assets/images/**/*",
"data/*",
"resources/",
"resources/*.py"
]
"""
When I run the poetry v2 includes migration
Then the include becomes:
"""
include = [
{ path = "scripts/run.py", format = ["sdist", "wheel"] },
{ path = "assets/images/**/*", format = ["sdist", "wheel"] },
{ path = "data/*", format = ["sdist", "wheel"] },
{ path = "resources/", format = ["sdist"] },
{ path = "resources/*.py", format = ["sdist", "wheel"] }
]
"""
Scenario: Augment existing include missing format
Given the Poetry version is at least "2.0.0"
And a pyproject.toml containing:
"""
[tool.poetry]
include = [
{ path = "test/*" }
]
"""
When I run the poetry v2 includes migration
Then it becomes:
"""
include = [
{ path = "test/*", format = ["sdist", "wheel"] }
]
"""
Scenario: Preserve explicit include with format
Given the Poetry version is at least "2.0.0"
And a pyproject.toml containing:
"""
[tool.poetry]
include = [
{ path = "test/*", format = ["sdist", "wheel"] }
]
"""
When I run the poetry v2 includes migration
Then the file content is unchanged
Scenario: No include key present
Given the Poetry version is at least "2.0.0"
And a pyproject.toml containing:
"""
[tool.poetry]
name = "demo"
version = "0.1.0"
"""
When I run the poetry v2 includes migration
Then the file content is unchanged
Scenario: Empty include list
Given the Poetry version is at least "2.0.0"
And a pyproject.toml containing:
"""
[tool.poetry]
include = []
"""
When I run the poetry v2 includes migration
Then the file content is unchanged
Test Strategy/Script
- Pull the latest
dev
branch and build using the bootstrap profile -mvn clean install -Pbootstrap
(you must be on Poetry v2.0+ to build Habushu) - Build the example projects -
mvn clean install
- Use
habushu-poetry-package
to test migration with includedpyproject.toml
in example project
References/Additional Context
Metadata
Metadata
Assignees
Labels
No labels