Skip to content

Enable xbuildenv source introspection via a marker file - #414

Open
agriyakhetarpal wants to merge 9 commits into
mainfrom
pyodide-xbuildenv-source-introspection-and-marker
Open

Enable xbuildenv source introspection via a marker file#414
agriyakhetarpal wants to merge 9 commits into
mainfrom
pyodide-xbuildenv-source-introspection-and-marker

Conversation

@agriyakhetarpal

Copy link
Copy Markdown
Member

I don't particularly like the ergonomics of this PR... hence, this is ready for review, but not ready to merge just yet and I am scouting opinions.

The idea is to have a file called .xbuildenv-source, which will record where the xbuildenv came from – whether it's a release xbuildenv, a stable-debug xbuildenv, a nightly one, or a nightly-debug one. We can think of these as "channels". Of course, we also support custom URLs for the source of the xbuildenv, in which case we record the URL itself into the marker file.

LMK what you think about this!

Comment on lines +64 to +68
# If source is not provided, derive it from the metadata file, so that
# pointing PYODIDE_CROSS_BUILD_ENV_METADATA_URL at the nightly metadata
# can still record what was installed.
if source is None:
source = source_for_metadata_url(self.metadata_url)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this is needed. If a user passes any metadata URL, we should assume it is a custom URL.

Comment on lines +191 to +194
replaced_path = download_path.with_name(download_path.name + ".replaced")
shutil.rmtree(replaced_path, ignore_errors=True)
download_path.rename(replaced_path)
return replaced_path

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Well, I don't like this behavior. How about adding the source to the xbuildenv directory instead when downloading? For example, we can use 0.29.3-debug or 0.29.3-nightly instead of sharing 0.29.3. By doing that, we can remove the SOURCE_MARKER_FILE and use the directory name as the version name, which is consistent with the previous behavior.

Comment on lines +32 to +35
# An environment installed with --url has no release behind it to name, so the
# URL it came from is its source. A distinct type rather than a bare str, so
# that a URL cannot be passed where a release stream is expected.
SourceURL = NewType("SourceURL", str)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't quite get what the benefit of using a wrapped type is in this case. Of course, parse don't validate is a good practice, but do we need any validation at all for this URL?

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.

2 participants