Skip to content

Rename modulename to load_name for Extensions and allow as root-parameter - #5257

Open
Flamefire wants to merge 9 commits into
easybuilders:developfrom
Flamefire:load_name
Open

Flamefire wants to merge 9 commits into
easybuilders:developfrom
Flamefire:load_name

Conversation

@Flamefire

@Flamefire Flamefire commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

This replaces the misleading modulename by load_name as it is used to test-load the module/package/software although the naming might differ:

  • Julia Modules
  • Python & Perl packages
  • import
  • require
  • list | grep

load should still be generic enough.

I also deprecated passing a dict to collect_exts_file_info and get_modulenames: We don't need that and it just complicates things in the function: We always have an extension at that point. I don't see where a dict with an options key could even come from.

Fixes #493

Initial draft done by AI, manually verified and adjusted afterwards

Based on

So those should be merged first

@smoors

smoors commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

also needs fixes in easyblocks that use self.options['modulename']?

@Flamefire

Copy link
Copy Markdown
Contributor Author

Indeed. That might actually be an issue:

  • User sets load_name
  • easyblock defaults modulename to something
    -> conflict

I'll check if I can come up with eg. a dict-wrapper that redirects reads and writes to load_name

@Flamefire

Copy link
Copy Markdown
Contributor Author

Ok I added "aliasing" code now.
This allows
a) Setting self.options['modulename'] resulting in load_name being set (instead)
b) Set self.options = {'modulename': 'Foo'} with the same effect

@Flamefire

Copy link
Copy Markdown
Contributor Author

Once this gets merged I'll update the affected easyblocks

_log.nosupport("Obtained value of type '%s' for extra_vars, should be 'dict'" % type(extra_vars), '2.0')

extra_vars.update({
'load_name': [None, "Name used to load/import this software package, defaults to its name.", CUSTOM],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Flamefire Flamefire Sep 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes I'd say we keep that logic elsewhere. In Pythonpackage we can overwrite the default:

  • Use if set
  • If extension_name is set use that
  • Else use name.lower().replace('-', '_')

But I think the 2nd step (extension_name, then name) makes sense

@Flamefire

Copy link
Copy Markdown
Contributor Author

Ok, I added the extension_name-as-default-load_name commit. That was quite a bit of work to get all cases right. In the end I could just propagate extension_name from the ExtensionEasyBlock to self.options and covered all cases I could think of in tests

#5260 is still included here

@Flamefire

Flamefire commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor Author

On second thought this is not the right way: we should NOT use self.options and try duplicating the Easyconfig parameter into it but rather the other way round: deprecate using it and set the value for options in the Easyconfig for backwards compatibility
Otherwise we risk the 2 values becoming out of sync: with load_name at the top level someone might set it there but we use it from self.options

Adding extension_name showed this: it is not available where we need it and duplicating it into self.options means someone might set it there

More general: do we need the Extension class at all? It seems ExtensionEasyblock is all we need together with self.is_extension. Not having to deal with both might make it easier to understand and update

@Flamefire

Copy link
Copy Markdown
Contributor Author

I added a new commit: Deprecate self.options, options EC parameter and set all in self.cfg

That implements the idea I had above:

If we have load_name and extension_name in both self.cfg and self.options they can have differing values.
As options now are always known easyconfig parameters we only need self.cfg and can remove self.options

May need adjusting other tests too but wanted to get some feedback first.
I tried to make self.options as backwards compatible as possible. But e.g. for i in self.options, options.keys and options.items would be different because they cannot known which EC parameter would have been in there. I hence did not add them but left the basic get/set/is-in methods.

I can imagine less invasive methods only deprecating access to self.options itself for now: Ignore load_name and extension_name in options, error when we have load_name in self.cfg and modulename in options
load_name/extension_name are now so that is valid, but can still lead to silent issues when users update by just replacing modulename to load_name

@Flamefire

Copy link
Copy Markdown
Contributor Author

@boegel @smoors Fixing the tests is just a small chore. Do you agree with the proposed solution:

  • self.options deprecated
  • Reads writes go to self.cfg
  • Using non-cfg parameters in self.options is deprecated. Currently handled by a local dict for unknown params
  • self.options is only mostly backwards compatible

This provides us a clear and clean way forward. I guess there was intention to have plain Extension instances but that wouldn't even work anymore. Every extension is actually an ExtensionEasyBlock. Only reason to keep Extension might be circular imports when checking if an ext_instance is an Extension(EasyBlock) done inside easyblock.py which is also imported from extensioneasyblock.py. Users shouldn't actually instantiate the class. We could deprecate the __init__ method and call an _setup method from ExtensionEasyBlock or set up everything from there. Currently it is a bit messy what parts are set by which of the 2 classes __init__ functions

@smoors

smoors commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

+1 from me for deprecating self.options, but i don't feel qualified enough to review this big PR.

@Flamefire

Copy link
Copy Markdown
Contributor Author

Sorry, this was pretty complicated to keep backwards compatibility.
I moved a bit more to #5260
Maybe I can factor out the options deprecation but I think that won't work without allowing modulename at the root first which shouldn't be done without the deprecation and remapping machinery.
I also created #5291 with commits that work without this PR and will rebase this one after those 2

Comment thread easybuild/framework/extension.py Outdated
@Flamefire
Flamefire force-pushed the load_name branch 2 times, most recently from 0fc9a59 to 4188fe3 Compare October 5, 2026 11:09
@boegel

boegel commented Oct 7, 2026

Copy link
Copy Markdown
Member

We need to get EasyBuild v5.4.1 ASAP (it's way overdue), so I'm moving this one to the next milestone (release after v5.4.1)...

Flamefire and others added 9 commits October 7, 2026 10:10
…arameter

This replaces the misleading `modulename` by `load_name` as it is used
to test-load the module/package/software although the naming might differ:
- Julia Modules
- Python & Perl packages
- `import`
- `require`
- `list | grep`

`load` should still be generic enough.
This allows
a) Setting `self.options['modulename']` resulting in `load_name` being set
b) Set `self.options = {'modulename': 'Foo'}` with the same effect
If we have `load_name` and `extension_name` in both `self.cfg` and
`self.options` they can have differing values.
As options now are always known easyconfig parameters we only need
`self.cfg` and can remove `self.options`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

extension options are not how they should be

3 participants