Skip to content

Exposing config type once resolved and running #2175

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

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

WebReflection
Copy link
Contributor

@WebReflection WebReflection commented Sep 17, 2024

Description

This MR fixes #2174 by exposing a type in the already handy config we provide.

Changes

  • add a check for the MicroPython interpreter/runtime
  • set a config["type"]
  • test everything is working as expected

Checklist

  • All tests pass locally
  • I have updated CHANGELOG.md
  • I have created documentation for this(if applicable)

@@ -10,6 +10,11 @@

config = json.loads(globalThis.JSON.stringify(_config))

if "MicroPython" in sys.version:
Copy link
Member

Choose a reason for hiding this comment

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

I usually normalise to: if "micropython" in sys.version.lower() But I don't think it makes much difference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe they really want the MicroPython brand to be MicroPython but I don't mind applying that change ... alternatively I could use other try/catches or pass the type from the page but that is actually pretty convoluted due workers VS main VS config in PyScript VS Polyscript and so on ... I think this was the fastest and easy way around.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah... it's also the smallest possible change. We can refine later if there are problems / feature requests. Was just mentioning it as a sort of "out of interest..." point. 👍

@ntoll
Copy link
Member

ntoll commented Sep 17, 2024

Also, apologies, I thought I had marked this as approved when I first commented. My bad.

@WebReflection WebReflection merged commit dd86169 into pyscript:main Sep 17, 2024
2 checks passed
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.

Expose py or mpy via congif interpreter
2 participants