← index #747PR #10846
Related · high · value 2.096
QUERY · ISSUE

mip / package.json: Allow 'deps' to come from another repository

openby hmaerkiopened 2023-10-14updated 2023-10-18

Problem

In repo https://github.com/hmaerki/experiment_micropython_mip, I create a mip-package which may be install as follows:

import mip
mip.install("dryer2023", version="main", index="https://hmaerki.github.io/experiment_micropython_mip")

This is the package.json file:

{
    "version": "0.1",
    "hashes": [
        ["dryer2023/statemachine.mpy", "a47f24f2064b"],
        ["dryer2023/__init__.mpy", "c4104085da6d"]
    ],
    "deps": [
        ["umqtt.simple",  "latest"]     <== ERROR A
        ["https://micropython.org/pi/v2/package/6/umqtt.simple/latest.json",  "dummy"]  <== ERROR B
    ]
}

The installation of the hashes works nice.

In the deps section, I would like to install umqtt.simple from another index (the micropython default) but I could not make it working.

  • ERROR A: Will search in my index (https://hmaerki.github.io/experiment_micropython_mip) which is wrong.
  • ERROR B: This will correctly download 'latest.json' but then again will try to get the mpy-files from my index which is wrong.

Proposed: Solution

["umqtt.simple", "latest"] should always search in https://micropython.org/pi/v2
["github:org/repo/path/latest.json", "latest"] should search in github:org/repo/path/latest.json

Are there other suggestions/thoughs?

1 comment
ned-pcs · 2023-10-18

Take a look at my work in #676

CANDIDATE · PULL REQUEST

mpremote/mip: Allow version override in package.

closedby Josverlopened 2023-02-24updated 2025-05-16
tools

Adds the capability for a mip package.json to include urls to github hosted files that are versioned
This change allows explicit versions/branches to be specified at the url level.
This allows a package to combine files from different branches, in the same repo, and across different repo's as well.
The default behavior's remains to 'inherit' an explicit version specified at the package level using the @branch-or-tag notation,

Example package:

{
    "urls": [
        [ "foo.py", "github:my/repo/folder/foo.py@foo-beta"],
        [ "bar.py", "github:my/repo/folder/bar.py" ]
    ],
    "deps": [],
    "version": "1.2.3"
}

allows mip to install the packages files from two different branches

  • mpremote mip install github:my/repo

    • foo.py from branch foo-beta
    • bar.py from branch master
  • mpremote mip install github:my/repo@foo-beta

    • foo.py from branch foo-beta
    • bar.py from branch foo-beta
  • mpremote mip install github:my/repo@bar-alfa

    • foo.py from branch foo-beta
    • bar.py from branch bar-alfa

also see: Discord: https://discord.com/channels/574275045187125269/1024252597839859734/1078727025596059698

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied