Skip to content
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

Add circuitpython-mpy-cross command #119

Merged
merged 3 commits into from
Oct 8, 2024

Conversation

jepler
Copy link
Member

@jepler jepler commented Jun 16, 2024

This adds the ability to (download or build, then) invoke any supported version of mpy-cross:

$ circuitpython-mpy-cross --circuitpython-version 8.x -- --version
CircuitPython 8.2.0 on 2023-07-05; mpy-cross emitting mpy v5-CircuitPython
$ circuitpython-mpy-cross --circuitpython-version 9.x -- --version
CircuitPython 9.0.0-alpha.2 on 2023-10-27; mpy-cross emitting mpy v6.1

The idea of having a download & run wrapper around mpy-cross originates with https://pypi.org/project/mpy-cross-multi/ but re-uses our existing infra for downloading or building mpy-cross as needed, instead of uploading binary artifacts to pypi.

This also improves how mpy-cross is downloaded or built: These activities happen in the user's "cache" directory (e.g., $HOME/.cache on Linux/Mac, some other folder on Windows)

this also enables sharing the copy of mpy-cross across multiple repos.

Testing performed:

  • with a pip install -e . of this library, just ran a local build of jepler_udecimal: circuitpython-build-bundles --filename_prefix jepler_udecimal --library_location .
  • invocation of mpy-cross above
  • building a "9.0.x" version locally on Linux

jepler added 3 commits June 15, 2024 10:49
.. rather than in a build_deps folder, polluting the repo where it's used

this also enables sharing the copy of mpy-cross across multiple repos.
This wraps the process of building or downloading mpy-cross for a specified
version, then running it with specified arguments.

e.g.,
```
$ circuitpython-mpy-cross --circuitpython-version 9.x -- --version
CircuitPython 9.0.0-alpha.2 on 2023-10-27; mpy-cross emitting mpy v6.1
```
@jepler jepler requested a review from tekktrik June 16, 2024 16:54
@jepler
Copy link
Member Author

jepler commented Jun 17, 2024

once #111 is merged, it might be nice to make this enough smarter that it can munge before mpy-cross compiling.

Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

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

This looks good to me.

I tested it successfully with circuitpython-build-bundles inside of a library to build all bundle versions as well as the new mpy-cross command on an individual .py file.

I think this will be a handy addition to the build-tools.

@jepler jepler merged commit d7e66be into adafruit:main Oct 8, 2024
2 checks passed
@jepler jepler deleted the circuitpython-mpy-cross-command branch October 8, 2024 01:19
@jepler
Copy link
Member Author

jepler commented Oct 8, 2024

Thanks for testing! I'd forgotten this was out there.

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