Expose YARN_VERSION and YARN_SHA256#110
Open
Darshan808 wants to merge 5 commits into
Open
Conversation
krassowski
reviewed
May 25, 2026
Comment on lines
+14
to
+22
| # Minified yarn berry embeds the version as: YarnVersion:()=>VarName ... var VarName="x.y.z" | ||
| _match = re.search(rb"YarnVersion:\(\)=>(\w+)", _yarn_bytes) | ||
| if _match: | ||
| _var = re.escape(_match.group(1)) | ||
| _match = re.search(rb"var " + _var + rb'="([^"]+)"', _yarn_bytes) | ||
|
|
||
| if not _match: | ||
| msg = "Could not extract YARN_VERSION from vendored yarn.js" | ||
| raise RuntimeError(msg) |
Member
There was a problem hiding this comment.
This looks a bit fragile, I think a minimum countermeasure would be adding a test case for this.
fleming79
reviewed
Jun 28, 2026
fleming79
left a comment
Contributor
There was a problem hiding this comment.
Some comments for consideration.
| from pathlib import Path | ||
|
|
||
| _yarn_js = Path(__file__).resolve().parent / "yarn.js" | ||
| _yarn_bytes = _yarn_js.read_bytes() |
Contributor
There was a problem hiding this comment.
Consider deleting this when it is no longer required as it takes significant memory to store.
| msg = "Could not extract YARN_VERSION from vendored yarn.js" | ||
| raise RuntimeError(msg) | ||
|
|
||
| YARN_VERSION: str = _match.group(1).decode() |
Contributor
There was a problem hiding this comment.
I recommend storing the version and hash as constants and comparing the hash instead with an assertion. If the hash hasn't changed, the version will be correct.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #105
Description
Expose Yarn version from the vendored
yarn.jsat import time and also compute and expose its SHA256 hash.Currently, the generated hash matches the upstream Yarn 3.5.0 release. Once PR #109 is merged, the bundled
yarn.jswill diverge, and the hash will become specific to Jupyter Builder rather than any standard Yarn release.