Skip to content

Make specifying exts_defaultclass optional #4800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

Flamefire
Copy link
Contributor

@Flamefire Flamefire commented Mar 7, 2025

It is NOT required when all extensions have either custom easyblocks or an easyblock key in their option dict.
In those cases exts_defaultclass is redundant making it harder to write the EasyConfig.

Check for a missing easyblock when actually using it so the error will be just a bit later but still (almost) the same.

One noteworthy semi-related change is the try-finally to the clean_up_fake_module call. We did that only when the exts_defaultclass was missing but not when anything else fails which looks like an omission. To keep at least the behavior for this the try-finally is required as the exception comes from init_ext_instances now. As a (IMO good) side effect it will also be called for any other error happening along the way, e.g. the similar error that the default easyblock is not found

Also some small drive-by fixes without any functional change to reduce the amount of linter warnings in the touched files.

Recent example usage for a CMakePythonPackage Easyconfig:

exts_list = [('%(namelower)s', version, {
    'easyblock': 'PythonPackage',
    'nosource': True,
    'download_dep_fail': True,
    'use_pip': True,
    'sanity_pip_check': True,
    'start_dir': '../python',
})]

But also applies if only software-specific easyblocks are used and we really don't want a default

@Flamefire Flamefire force-pushed the optional-exts_defaultclass branch 2 times, most recently from d051011 to 9ae77ee Compare March 7, 2025 14:51
- Some places could use `dict.items`.
- Pylint supressions added
- Ignore G002 (Logging statements should not use % formatting for their first argument)
- Early return for skipped tests to avoid indent
@Flamefire Flamefire force-pushed the optional-exts_defaultclass branch from 9ae77ee to a106f61 Compare March 7, 2025 15:00
It is NOT required when all extensions have either custom easyblocks or
an `easyblock` key in their option dict.
In those cases `exts_defaultclass` is redundant making it harder to
write the EasyConfig.
Check for a missing easyblock when actually using it so the error will
be just a bit later but still (almost) the same.
@Flamefire Flamefire force-pushed the optional-exts_defaultclass branch from a106f61 to c7ec26d Compare March 7, 2025 16:21
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.

1 participant