Skip to content

Add a module-info sub-command returning the version of the evaluating modulefile #713

Open

Description

@xdelaruelle

Inside a modulefile, module-info name returns the full name of the module being evaluated, such as app/1.2.3 or compiler/gcc/12.1. Very often, what the modulefile author actually needs is only the version part, that is the component after the last /, to build an installation path, a library directory name or a message. There is currently no modulefile command returning this component directly.

Authors therefore resort to Tcl string manipulation like lindex [split [module-info name] /] end or file tail [module-info name]. Feedback gathered at the HPSF Conference 2026 showed that this idiom is a recurring source of friction: it is not obvious for people who are not Tcl literate, it gets copied around with small variations, and it is one of the first things people ask when writing their first modulefiles or when comparing with other tools where an equivalent accessor exists.

The need is for a dedicated module-info sub-command that returns the version of the currently evaluating modulefile, defined as the part of the module name after the last /. For a module named app/1.2.3 it should return 1.2.3; for compiler/gcc/12.1 it should return 12.1. For a module whose name has no / separator, the behavior should be clearly defined and documented (for instance returning an empty string).

The returned value should reflect the module name as resolved for the evaluation, consistently with what module-info name returns, so that symbolic versions and aliases are handled the same way by both commands. The complementary accessor returning the name without its version part would make sense as well, to fully cover the use case addressed today by the module-info-name-return-basename cookbook recipe.

This would make modulefiles simpler to write and read, and would remove a Tcl idiom that newcomers find off-putting.

Activity

  1. added this to the 5.8.0 milestone on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions