-
Notifications
You must be signed in to change notification settings - Fork 79
tests: rework downloading the wheelhouse for isolation tests #1199
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
henryiii
wants to merge
4
commits into
main
Choose a base branch
from
henryiii/tests/moreoutputwheel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+91
−56
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # /// script | ||
| # dependencies = ["pip"] | ||
| # /// | ||
|
|
||
| """ | ||
| Download wheels into the pytest cache. Must be run from the pytest directory | ||
| (project root, usually). If run in an environment, requires pip. Only downloads | ||
| pybind11, ninja, or cmake if those are in the environment already. | ||
| """ | ||
|
|
||
| import importlib.util | ||
| import subprocess | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| WHEELS = [ | ||
| "build", | ||
| "cython", | ||
| "hatchling", | ||
| "pip", | ||
| "setuptools", | ||
| "virtualenv", | ||
| "wheel", | ||
| ] | ||
|
|
||
| if importlib.util.find_spec("cmake") is not None: | ||
| WHEELS.append("cmake") | ||
|
|
||
| if importlib.util.find_spec("ninja") is not None: | ||
| WHEELS.append("ninja") | ||
|
|
||
| if importlib.util.find_spec("pybind11") is not None: | ||
| WHEELS.append("pybind11") | ||
|
|
||
|
|
||
| def prepare(wheelhouse: Path) -> None: | ||
| subprocess.run( | ||
| [ | ||
| sys.executable, | ||
| "-m", | ||
| "pip", | ||
| "download", | ||
| "-q", | ||
| "-d", | ||
| str(wheelhouse), | ||
| *WHEELS, | ||
| ], | ||
| check=True, | ||
| ) | ||
| print(f"Downloaded wheels to {wheelhouse}") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| wheelhouse = Path(".pytest_cache/d/wheelhouse") | ||
| wheelhouse.mkdir(parents=True, exist_ok=True) | ||
| prepare(wheelhouse) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to gate this by presence of scikit-build-core wheel.
Also don't think we need to 2 different locks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not an editable wheel, so it needs to be rebuilt every time the tests run - here it's being rebuilt by every process, but that's hopefully pretty cheap. Probably cheaper if we use build isolation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With two locks we can have one process start downloading wheels while the others are rebuilding the scikit-build-core wheel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait I don't get this part. Isn't it building the wheel so that every subsequent
pip imstallis taking that wheel? I am thinking about the guarding for across the workers, but maybe you are considering it across different commits? It should be checked across thehatch-vcsversion, which I think you were trying to do previously?Good point, but that would only happen if it skips the locked functions gated by
main.lockright? But speaking of which is it re-using the pip/uv cache? Using auv.lockor equivalent could make the downloads be effectively no-opsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's testing the current source of scikit-build-core, so it has to be fresh. Yes, I'd like to only build it on one worker, but it's not that easy unless we make sure we always clean it up after a run (regardless of if the run failed, cancelled, etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some local debugging hoping that
hatch vcscould help with the dirty files, but it seems like that would not work since it doesn't check the actual contents of the files when it is dirty, only the current date and if there are any dirty files.The only alternative I can think of is to explicitly check against the
worker_idand only run it onmaster, but are we able to do that without hard-codingpytest-xdistdependency?