Skip to content

mpremote: Support mip install from local package json file. #12476

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

Conversation

glenn20
Copy link
Contributor

@glenn20 glenn20 commented Sep 19, 2023

Add support for:

  • mpremote mip install package.json where package.json is a json file on the local filesystem.

Without this PR, package json files can only be loaded from http, https or github urls.

This is useful for testing package.json files for pacages in development and for constructing one's own package.json files for python packages which are not yet available for installation using mip.

@github-actions
Copy link

github-actions bot commented Sep 19, 2023

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@codecov
Copy link

codecov bot commented Sep 19, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.59%. Comparing base (752c167) to head (11c9656).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #12476   +/-   ##
=======================================
  Coverage   98.59%   98.59%           
=======================================
  Files         167      167           
  Lines       21599    21599           
=======================================
  Hits        21295    21295           
  Misses        304      304           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andrewleech
Copy link
Contributor

Thanks @glenn20 mip support for local package install has been on my personal TODO list for some time now!

I hadn't thought of targetting the json file directly, I'd been thinking of going straight to manifest - however json support like you've got here is certainly a smaller change.

It does mean that any dependencies will be installed from official / online copies I presume? Maybe that's ok for a first pass, though I'm hoping to eventually be able to point mip at a local clone of micropython-lib and install anything straight from there!

glenn20 added a commit to glenn20/micropython that referenced this pull request Sep 19, 2023
When taken with PR micropython#12476, allow relative URLs in
package.json files to resolve to files on local fs.

Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
@glenn20
Copy link
Contributor Author

glenn20 commented Sep 19, 2023

Thanks @glenn20 mip support for local package install has been on my personal TODO list for some time now!

I hadn't thought of targetting the json file directly, I'd been thinking of going straight to manifest - however json support like you've got here is certainly a smaller change.

It does mean that any dependencies will be installed from official / online copies I presume?

Yes, I was looking at this from the perspective of someone trying to mip package my own packages - and also to write my own local package.json files for micropython packages available out there that haven't yet been mip-ified. You can see that was also the motivation behind the related PR #12477 (relative urls in package.json files). I wasn't thinking about manifest at all.

Maybe that's ok for a first pass, though I'm hoping to eventually be able to point mip at a local clone of micropython-lib and install anything straight from there!

Ooh - that sounds interesting, but I can see that's a bigger body of work than these trivial PRs.

@andrewleech
Copy link
Contributor

Yeah my more common use case is working on changes to modules destined for micropython-lib, hence my thoughts. I do think this use case could be built up to, starting with local json makes sense, then can eventually add layers around that for generating json on-the-fly and maybe calling out to the script that generates all the json files for micropython-lib etc.

@dpgeorge dpgeorge added the tools Relates to tools/ directory in source, or other tooling label Sep 29, 2023
glenn20 added a commit to glenn20/micropython that referenced this pull request Aug 14, 2024
When taken with PR micropython#12476, allow relative URLs in
package.json files to resolve to files on local fs.

Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
@glenn20 glenn20 force-pushed the feature-mip-package-json-from-file branch from 4ecbf11 to dcf342f Compare August 14, 2024 03:47
@glenn20 glenn20 force-pushed the feature-mip-package-json-from-file branch from dcf342f to de3752b Compare February 10, 2025 01:32
glenn20 added a commit to glenn20/micropython that referenced this pull request Feb 10, 2025
When taken with PR micropython#12476, allow relative URLs in
package.json files to resolve to files on local fs.

Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
@glenn20 glenn20 force-pushed the feature-mip-package-json-from-file branch from 4686afd to 2a45de9 Compare February 10, 2025 03:16
@glenn20
Copy link
Contributor Author

glenn20 commented Feb 10, 2025

Rebased, patched and squashed.

glenn20 added a commit to glenn20/micropython that referenced this pull request Feb 10, 2025
URLs in package.json may be specified relative to the base URL of
the package.json file.

When taken with PR micropython#12476, allow relative URLs in
package.json files to resolve to files on local fs.

Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
Add support for `mpremote mip install package.json` where `package.json` is
a json file on the local filesystem.

Without this, package json files can only be loaded from http, https,
github or gitlab URLs.

This is useful for testing `package.json` files for pacages in development
and for constructing one's own `package.json` files for Python packages
which are not yet available for installation using mip.

Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
@dpgeorge dpgeorge force-pushed the feature-mip-package-json-from-file branch from 2a45de9 to 11c9656 Compare February 10, 2025 05:00
@dpgeorge dpgeorge merged commit 11c9656 into micropython:master Feb 10, 2025
57 of 63 checks passed
@dpgeorge
Copy link
Member

Thanks for updating, now merged.

@glenn20 glenn20 deleted the feature-mip-package-json-from-file branch February 10, 2025 09:33
glenn20 added a commit to glenn20/micropython that referenced this pull request Feb 10, 2025
URLs in package.json may be specified relative to the base URL of
the package.json file.

When taken with PR micropython#12476, allow relative URLs in
package.json files to resolve to files on local fs.

Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
glenn20 added a commit to glenn20/micropython that referenced this pull request Feb 15, 2025
URLs in package.json may be specified relative to the base URL of
the package.json file.

When taken with PR micropython#12476, allow relative URLs in
package.json files to resolve to files on local fs.

Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
glenn20 added a commit to glenn20/micropython that referenced this pull request Feb 17, 2025
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>
glenn20 added a commit to glenn20/micropython that referenced this pull request Feb 18, 2025
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.
glenn20 added a commit to glenn20/micropython that referenced this pull request Feb 18, 2025
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>
glenn20 added a commit to glenn20/micropython that referenced this pull request Feb 18, 2025
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>
dpgeorge pushed a commit to glenn20/micropython that referenced this pull request Feb 24, 2025
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>
HighImp pushed a commit to HighImp/micropython that referenced this pull request Mar 16, 2025
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>
mseminatore pushed a commit to mseminatore/micropython that referenced this pull request Mar 31, 2025
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>
lawrencedudley pushed a commit to lawrencedudley/micropython-esp32-pcnt that referenced this pull request May 29, 2025
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>
eliclement pushed a commit to eliclement/micropython that referenced this pull request Jun 2, 2025
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tools Relates to tools/ directory in source, or other tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy