Skip to content

fix: enforce supported dependency version ranges - #270

Open
krowvin wants to merge 5 commits into
mainfrom
fix/dependency-version-bounds
Open

krowvin wants to merge 5 commits into
mainfrom
fix/dependency-version-bounds

Conversation

@krowvin

@krowvin krowvin commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Commands currently check only minimum dependency versions, so an installed cwms-python 2.x can reach command code even though the development dependency targets 1.x. Add an optional exclusive max_version to the shared guard and enforce cwms-python>=1.0.7,<2.0.0 at runtime and in the DSS extra. Unsupported versions produce a Click error with instructions to upgrade cwms-cli or install a compatible library version; missing-package instructions also include the supported range.

Make packaging a runtime dependency and remove the fallback to string comparison. This preserves numeric version ordering (1.0.10 is newer than 1.0.7) and rejects unparseable installed versions. Existing minimum-only requirements keep their behavior. The 2.0 boundary follows the existing ^1.0.7 development constraint; it does not assert that a currently released cwms-python version is known to be incompatible. The reported double-digit version warning was a separate comparison bug already partially addressed on main.

Validation:

  • Reproduced six failing regression cases before the fix, including acceptance of 2.0.0, 2.1.0, 10.0.0, an upper-bound prerelease, and invalid metadata.
  • 18 dependency tests pass, including actual CLI rejection, boundary values, double-digit versions, missing metadata/modules, and minimum-only compatibility.
  • Full Windows/Python 3.13 suite: 407 passed, 12 platform-specific skips. Used a checkout named cwms-cli because an existing update test assumes that directory name.
  • Black, isort, ownership sync, Poetry lock validation, wheel build, and wheel dependency metadata checks pass. Lockfile regenerated with Poetry 2.3.2; no dependency versions changed.
  • Local Linux dev-container testing was unavailable because Docker Desktop's Linux engine was not running. The PR matrix covers Linux Python 3.9/3.12, Windows/macOS Python 3.12, and the dev container.

@krowvin
krowvin requested a review from Enovotny as a code owner September 22, 2026 21:15
Comment thread cwmscli/utils/deps.py
if req.get("max_version"):
constraints.append(f"<{req['max_version']}")
version_range = ",".join(constraints)
supported = SpecifierSet(version_range)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Enovotny

This should resolve the issue you found with it being treated as 0.1 instead of 10 on the PATCH bump

@krowvin

krowvin commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator Author

Will revisit <>, spoke with @Enovotny and he was able to complete work to resolve the version issue here

@krowvin krowvin closed this Sep 22, 2026
@krowvin
krowvin deleted the fix/dependency-version-bounds branch September 22, 2026 21:41
@krowvin
krowvin removed the request for review from Enovotny September 22, 2026 21:42
@krowvin
krowvin restored the fix/dependency-version-bounds branch September 24, 2026 17:37
@krowvin krowvin reopened this Sep 24, 2026
krowvin and others added 2 commits September 24, 2026 12:38
Generate dependency installation commands with sys.executable -m pip so
packages are installed into the environment running cwms-cli. Include
--upgrade when installing supported version ranges to replace outdated
packages such as cwms-python 0.5.0.

AI assisted
@krowvin
krowvin requested a review from msweier September 24, 2026 18:06

This branch has not been deployed

No deployments
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