Skip to content
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

stop using modextrapaths to update $PYTHONPATH with standard path to installed Python packages (lib/python%(pyshortver)s/site-packages) #20960

Open
wants to merge 8 commits into
base: 5.0.x
Choose a base branch
from

Conversation

Micket
Copy link
Contributor

@Micket Micket commented Jul 3, 2024

All the trivial cases cleaned up here. Some others i could potentially partly clean up, which uses a mix of several PYTHONPATH (standard + nonstandard location, Spark is an example of such an easyconfig).

Should of course not be merged until the corresponding framework PR is merged.

@Micket Micket added the EasyBuild-5.0 EasyBuild 5.0 label Jul 3, 2024
@Micket Micket added this to the 5.0 milestone Jul 3, 2024
@Flamefire
Copy link
Contributor

That reminds me of an old PR of mine: #13385

However all but 1 of the ECs are now deprecated and that one is fixed here. However there was also an enhancement to CI which I extracted to #20963

And a regexp I used which you might try in your tree: grep -E ": 'lib/python[^/]+/site-packages'" $(grep --files-with-matches -Er "\\beasyblock = '(ConfigureMakePythonPackage|PythonBundle)'")

@Flamefire
Copy link
Contributor

@boegel boegel changed the title Drop manually specified default PYTHONPATH's stop using modextrapaths to update $PYTHONPATH with standard path to installed Python packages (lib/python*/site-packages) Oct 1, 2024
@boegel boegel changed the title stop using modextrapaths to update $PYTHONPATH with standard path to installed Python packages (lib/python*/site-packages) stop using modextrapaths to update $PYTHONPATH with standard path to installed Python packages (lib/python%(pyshortver)s/site-packages) Oct 1, 2024
modextrapaths = ec.get('modextrapaths', {})
regex = re.compile(r'^lib*/python[0-9]\.[0-9]+/site-packages$')
for key, value in modextrapaths.items():
value = resolve_template(value, ec.template_values)
Copy link
Contributor

Choose a reason for hiding this comment

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

ec.get has a resolve parameter defaulting to True, so it seems the value is already resolved at this point, isn't it?

If it was indeed required I'd suggest putting it below the check to avoid resolving every value without using almost any

Copy link
Member

Choose a reason for hiding this comment

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

Ah, maybe, I didn't actually verify that tbh... Will check

# don't allow updating of $PYTHONPATH with standard lib/python*/site-packages path,
# since that's already taken care of by EasyBuild framework now
# (cfr. https://github.com/easybuilders/easybuild-framework/pull/4539)
modextrapaths = ec.get('modextrapaths', {}, resolve=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

We usually denote explicitly when we do not want to resolve values so I'd not be so explicit (only) here and given ec.get('key') == ec['key']`

Suggested change
modextrapaths = ec.get('modextrapaths', {}, resolve=True)
modextrapaths = ec.get('modextrapaths', {})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EasyBuild-5.0 EasyBuild 5.0
Projects
Status: Nice-to-have
Development

Successfully merging this pull request may close these issues.

3 participants