Skip to content

std_pip_args: use PythonPipBuilder.std_args(...) instead#47260

Merged
alalazo merged 2 commits intodevelopfrom
hs/fix/remove-std_pip_args-use
Oct 30, 2024
Merged

std_pip_args: use PythonPipBuilder.std_args(...) instead#47260
alalazo merged 2 commits intodevelopfrom
hs/fix/remove-std_pip_args-use

Conversation

@haampie
Copy link
Copy Markdown
Member

@haampie haampie commented Oct 28, 2024

Currently std_pip_args is set in build_environment.py for any package,
including ones that don't depend on python or pip.

This commit replaces globals with direct calls to PythonPipBuilder.std_args,
so (A) the origin is clear, and (B) the dependency on build_environment.py
is effectively removed, which was an input that was not reflected in the package
hash.

@spackbot-app

This comment was marked as off-topic.

@spackbot-app

This comment was marked as off-topic.

@adamjstewart
Copy link
Copy Markdown
Member

Uh, is this something we're planning on doing for all the builders? I thought we created the globals so we wouldn't need all of this cruft.

@haampie
Copy link
Copy Markdown
Member Author

haampie commented Oct 28, 2024

There was a general consensus to get rid of std_{cmake,meson,pip}_args, because

  1. they are defined in build_environment.py which is the wrong place:
    1. changes to their values is not reflected in the hash.
    2. they are defined for any package, whether they do depend on pip or not.
  2. their origin is unclear when just looking at package.py

References to std_{cmake,meson}_args were already removed from other PRs.

I don't think PythonPipBuilder.std_args(self) is that much cruft?

The alternative is to leave the global, and define them in {cmake,meson,py-pip}/package.py
through setup_dependent_package(child, parent), but that is too broad as it should only ever
be called on a build edge <root spec to be built> - {cmake,meson,py-pip}, whereas right now
it's called on any in-edge of {cmake,meson,py-pip}.

@adamjstewart
Copy link
Copy Markdown
Member

Thanks, didn't know there was a discussion on this. As long as there is good reason (like the hash) and we're planning on doing the same for all build systems I'm happy.

Copy link
Copy Markdown
Member

@adamjstewart adamjstewart left a comment

Choose a reason for hiding this comment

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

Code changes look fine, just need to get CI to pass now.

@adamjstewart
Copy link
Copy Markdown
Member

FYI, the Packaging Guide still references std_cmake_args and may need to be updated with the new syntax.

@haampie
Copy link
Copy Markdown
Member Author

haampie commented Oct 28, 2024

To be fair, the package hash issue is not addressed by this PR because spack.build_systems.python is not hashed. The only improvements of this PR are:

  1. remove dependencies on inputs from build_environment.py which are unaccounted for in the package hash.
  2. allow users to find the definition of the default pip args global

Moving the literal value of std_pip_args into py-pip/package.py would fix the hash issue, but then the question is how to keep PythonPipBuilder.std_args in sync with it.

The similar PRs for std_cmake_args and std_meson_args were much smaller, so let me just bring up this PR in the Monday meeting.

@haampie

This comment was marked as resolved.

@alalazo

This comment was marked as resolved.

@haampie

This comment was marked as resolved.

@alalazo
Copy link
Copy Markdown
Member

alalazo commented Oct 29, 2024

@spackbot run pipeline

Screenshot from 2024-10-29 16-14-10

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Oct 29, 2024

I've started that pipeline for you!

@alalazo alalazo self-assigned this Oct 30, 2024
@alalazo alalazo merged commit 161b2d7 into develop Oct 30, 2024
@alalazo alalazo deleted the hs/fix/remove-std_pip_args-use branch October 30, 2024 08:18
@wdconinc wdconinc mentioned this pull request Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants