Skip to content

Allow major-version upper bounds in version ranges #698

Description

@adrien-cotte

Is your feature request related to a problem? Please describe.

Modules currently rejects version ranges whose bounds have different precision:

$ module load cmake@3.20:3
ERROR: Invalid version range '3.20:3'

Spack supports this syntax. For example, with cmake@3.31.11 and cmake@4.4.3 installed:

$ spack find cmake@3.20:3
cmake@3.31.11

This is useful to express "version >= 3.20, but still within major version 3".

Describe the solution you'd like

Accept version ranges such as:

module load cmake@3.20:3

and match compatible 3.x versions satisfying the lower bound.

For example, cmake@3.31.11 should match, while cmake@4.4.3 should not.

Describe alternatives you've considered

A possible workaround is to use a range such as @3.20:3.999.

This works in many practical cases, but it is less natural and requires inventing an arbitrary upper bound instead of simply expressing "up to the end of major version 3".

Additional context

Existing ranges such as @3 and @3:4 would remain unchanged.

Since @3.20:3 is currently rejected as invalid syntax, adding support for it should have limited impact on existing behavior.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions