Closed
Description
Until Poetry version 2.x, it pyproject.toml
support was a reasonably backwards compatible above version 1.5.0. As a result, Habushu could get away with just enforcing that 1.5.0 was the minimum version.
With the release of 2.0.0, as well as Habushu's migrations to help align pyproject.toml
files to the latest PEP standards, this is no longer tenable. Once you make the jump to 2.0.0+, you need to build with a minimum of that version.
We should support functionality akin to the Maven Enforcer Plugin's Java Version check to allow a specific version or range of versions to be optionally required by projects.
Test Steps
- Build the latest version of the plugin:
mvn clean install -Pbootstrap
- (Assumes you are on Poetry 2.x) Execute the Poetry Enforcer Rule:
mvn clean install -pl :habushu-poetry-enforcer-rule -Dmaven.build.cache.skipCache=true
- Validate that is passes:
...
[INFO] --- enforcer:3.5.0:enforce (enforce-poetry) @ habushu-poetry-enforcer-rule ---
[INFO] Rule 0: org.technologybrewery.habushu.enforcer.RequirePoetryVersionRule(requirePoetryVersion) passed
[INFO]
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.552 s
[INFO] Finished at: 2025-03-25T11:41:08-04:00
[INFO] ------------------------------------------------------------------------
- Downgrade Poetry to a version before 2.x:
poetry self update 1.8.2
- Execute the Poetry Enforcer Rule:
mvn clean install -pl :habushu-poetry-enforcer-rule -Dmaven.build.cache.skipCache=true
- Validate that is fails:
...
[INFO] --- enforcer:3.5.0:enforce (enforce-poetry) @ habushu-poetry-enforcer-rule ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.811 s
[INFO] Finished at: 2025-03-25T11:36:09-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.5.0:enforce (enforce-poetry) on project habushu-poetry-enforcer-rule:
[ERROR] Rule 0: org.technologybrewery.habushu.enforcer.RequirePoetryVersionRule(requirePoetryVersion) failed with message:
[ERROR] Poetry version 1.8.2 was installed - the project requires Poetry >=2.0.0. Please update Poetry by executing 'poetry self update' or visit https://python-poetry.org/docs/#installation for more information
...
- Reinstate Poetry to your preferred version:
poetry self update 2.1.1
(or similar)
Metadata
Metadata
Assignees
Labels
No labels