-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
mpremote: Support relative URLs in mip package.json file. #12477
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
mpremote: Support relative URLs in mip package.json file. #12477
Conversation
Code size report:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #12477 +/- ##
=======================================
Coverage 98.53% 98.53%
=======================================
Files 169 169
Lines 21822 21822
=======================================
Hits 21502 21502
Misses 320 320 ☔ View full report in Codecov by Sentry. |
+1 |
87700bc
to
cb745f5
Compare
I think I effectively implemented it in ViperIDE since day 0, and now found this PR while researching the project import feature: vshymanskyy/ViperIDE#42 |
eabff45
to
b3cd762
Compare
Rebased, patched and squashed. |
7831b6f
to
4542ab6
Compare
Rebased and squashed. |
4542ab6
to
f31439d
Compare
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.
This is a really great improvement, makes it much easier to define a package.json
that works locally and the same file works on a remote HTTP(S) server, among other things.
Two things that I think need doing:
- Update the docs at
docs/reference/package.rst
to mention this new feature. - Update micropython-lib's mip package to support the same relative URLs, so that when mip is run locally on a board (with a network connection) it can work (or using
micropython -m mip
).
Would be good to include (1) in this PR.
(2) needs to be done in a separate PR to micropython-lib.
I'm happy to do either or both of those, or leave it to you @glenn20, just let me know.
OK. I will add that this afternoon.
Re. 2, Im also happy to take a look this afternoon and post a second PR, but go ahead if you prefer to do it yourself ;). I also have a small test script for this PR (and the local fs PR) that I'll update as a test in tools/mpremote/tests. |
Great, thanks, I'll leave it to you.
Very good! I can make a test package available at |
Update `docs/reference/packages.rst` to add documentation for: - Installing packages from local filesystems (PR micropython#12476); and - Using relative URLs in the package.json file (PR micropython#12477). Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
c3bab1b
to
90cf3a4
Compare
This allows to specify relative URLs in package.json, which are resolved relative to the package.json URL. This mirrors the functionality added to mpremote in micropython/micropython#12477.
URLs in package.json may be specified relative to the base URL of the package.json file. Relative URLs wil work for package.json files installed from the web as well as local file paths. Update `docs/reference/packages.rst` to add documentation for: - Installing packages from local filesystems (PR micropython#12476); and - Using relative URLs in the package.json file (PR micropython#12477); - Update the packaging example to encourage relative URLs as the default in package.json.
f48655d
to
4c8d89c
Compare
URLs in package.json may be specified relative to the base URL of the package.json file. Relative URLs wil work for package.json files installed from the web as well as local file paths. Update `docs/reference/packages.rst` to add documentation for: - Installing packages from local filesystems (PR micropython#12476); and - Using relative URLs in the package.json file (PR micropython#12477); - Update the packaging example to encourage relative URLs as the default in package.json. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
4c8d89c
to
4bb9cda
Compare
Squashed commits. |
URLs in package.json may be specified relative to the base URL of the package.json file. Relative URLs wil work for package.json files installed from the web as well as local file paths. Docs: update `docs/reference/packages.rst` to add documentation for: - Installing packages from local filesystems (PR micropython#12476); and - Using relative URLs in the package.json file (PR micropython#12477); - Update the packaging example to encourage relative URLs as the default in package.json. Add tools/mpremote/tests/test_mip_local_install.sh to test the installation of a package from local files using relative URLs in the package.json. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
7cc10a8
to
d70e4d7
Compare
This allows to specify relative URLs in package.json, which are resolved relative to the package.json URL. This mirrors the functionality added to mpremote in micropython/micropython#12477.
This allows to specify relative URLs in package.json, which are resolved relative to the package.json URL. This mirrors the functionality added to mpremote in micropython/micropython#12477. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
This allows to specify relative URLs in package.json, which are resolved relative to the package.json URL. This mirrors the functionality added to mpremote in micropython/micropython#12477. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
This allows to specify relative URLs in package.json, which are resolved relative to the package.json URL. This mirrors the functionality added to mpremote in micropython/micropython#12477. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
I have submitted micropython-lib:#975 to support relative URLs in the (Builds are failing due to something deprecated in the github actions.) |
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.
Thanks for adding the test, and updating the docs. This looks really good now!
URLs in `package.json` may now be specified relative to the base URL of the `package.json` file. Relative URLs wil work for `package.json` files installed from the web as well as local file paths. Docs: update `docs/reference/packages.rst` to add documentation for: - Installing packages from local filesystems (PR micropython#12476); and - Using relative URLs in the `package.json` file (PR micropython#12477); - Update the packaging example to encourage relative URLs as the default in `package.json`. Add `tools/mpremote/tests/test_mip_local_install.sh` to test the installation of a package from local files using relative URLs in the `package.json`. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
d70e4d7
to
2992e34
Compare
This allows to specify relative URLs in package.json, which are resolved relative to the package.json URL. This mirrors the functionality added to mpremote in micropython/micropython#12477. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
URLs in `package.json` may now be specified relative to the base URL of the `package.json` file. Relative URLs wil work for `package.json` files installed from the web as well as local file paths. Docs: update `docs/reference/packages.rst` to add documentation for: - Installing packages from local filesystems (PR micropython#12476); and - Using relative URLs in the `package.json` file (PR micropython#12477); - Update the packaging example to encourage relative URLs as the default in `package.json`. Add `tools/mpremote/tests/test_mip_local_install.sh` to test the installation of a package from local files using relative URLs in the `package.json`. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
URLs in `package.json` may now be specified relative to the base URL of the `package.json` file. Relative URLs wil work for `package.json` files installed from the web as well as local file paths. Docs: update `docs/reference/packages.rst` to add documentation for: - Installing packages from local filesystems (PR micropython#12476); and - Using relative URLs in the `package.json` file (PR micropython#12477); - Update the packaging example to encourage relative URLs as the default in `package.json`. Add `tools/mpremote/tests/test_mip_local_install.sh` to test the installation of a package from local files using relative URLs in the `package.json`. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
URLs in `package.json` may now be specified relative to the base URL of the `package.json` file. Relative URLs wil work for `package.json` files installed from the web as well as local file paths. Docs: update `docs/reference/packages.rst` to add documentation for: - Installing packages from local filesystems (PR micropython#12476); and - Using relative URLs in the `package.json` file (PR micropython#12477); - Update the packaging example to encourage relative URLs as the default in `package.json`. Add `tools/mpremote/tests/test_mip_local_install.sh` to test the installation of a package from local files using relative URLs in the `package.json`. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
URLs in `package.json` may now be specified relative to the base URL of the `package.json` file. Relative URLs wil work for `package.json` files installed from the web as well as local file paths. Docs: update `docs/reference/packages.rst` to add documentation for: - Installing packages from local filesystems (PR micropython#12476); and - Using relative URLs in the `package.json` file (PR micropython#12477); - Update the packaging example to encourage relative URLs as the default in `package.json`. Add `tools/mpremote/tests/test_mip_local_install.sh` to test the installation of a package from local files using relative URLs in the `package.json`. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
Allow URLs in mip package.json files to be specified relative to the base URL of the package.json file.
This simplifies use of mip packages from forked or copied repos. When taken together with PR #12476, it also simplifies installing from repos cloned to the local filesystem. Is also useful during testing and development.
Example package.json (adapted from https://github.com/glenn20/micropython-esp32-ota/blob/main/mip/ota/package.json):