Make mip record package info #17534
Replies: 3 comments 4 replies
-
Looks interesting and it would be good to have reproducible installs.
|
Beta Was this translation helpful? Give feedback.
-
Consider the case where multiple packages share the same dependency. How does uninstalling one of the set deal with the dependency? |
Beta Was this translation helpful? Give feedback.
-
I now changed the top level of the metadata format a bit (added extra dict with "packages" key for future extension and turned list of specs into dict of specs): {
"packages": {
"github:andyrids/micropython-networkutils/networkutils": {
"requested_version": "latest",
"resolved_version": "c68d57aa5ceef22289a72b316b5e26eb56715786",
"metadata": {
"urls": [
[
"networkutils/core.py",
"https://gitlab.com/micropython-iot-projects/libraries/micropython-networkutils/-/raw/HEAD/networkutils/networkutils/core.py"
]
],
"deps": [
[
"logging",
"latest"
],
[
"github:josverl/micropython-stubs/mip/typing.mpy",
"main"
],
[
"github:josverl/micropython-stubs/mip/typing_extensions.mpy",
"main"
]
],
"version": "0.0.1"
},
"files": [
{
"path": "networkutils/core.py",
"sha256": "8029c9073ed34c9bcab5e810ce032ea631ad952db112be8456fe861f449b8016"
}
]
},
"logging": {
"requested_version": "latest",
"index": "https://micropython.org/pi/v2",
"resolved_version": "0.6.2",
"metadata": {
"version": "0.6.2",
"hashes": [
[
"logging.py",
"ba7c1bf2"
]
],
"v": 1
},
"files": [
{
"path": "logging.py",
"sha256": "ba7c1bf28a494d22680556cf7565fc15cef30c74fdf5077140e39732dc3b42a8"
}
]
},
"github:josverl/micropython-stubs/mip/typing.mpy": {
"requested_version": "main",
"resolved_version": "30b34ee3d54b0a349b7ef87fd7daf863cc14e0e4",
"files": [
{
"path": "typing.mpy",
"sha256": "c64c2de9d05d3ae432c121f453cd9a17712fed874c8c03b810c89315e4c6e6c0"
}
]
},
"github:josverl/micropython-stubs/mip/typing_extensions.mpy": {
"requested_version": "main",
"resolved_version": "30b34ee3d54b0a349b7ef87fd7daf863cc14e0e4",
"files": [
{
"path": "typing_extensions.mpy",
"sha256": "286bb50dd7e072415338d917c01adc16a56d98eb79aa02f5bac13c15ed65de40"
}
]
}
}
} Also, I changed the file name to "mip-packages.json" (instead of "packages-info.json" proposed earlier). The more specific name is better, when other tools (e.g. Also, I changed the policy of uninstalling old versions when installing a package which has been already installed. Now the old version is uninstalled only if the user explicitly wants to install After these changes I created the pull request: #17646 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I propose introducing a metadata file for recording information about packages installed by mip (at least by the mpremote variant).
The file would sit in the target folder (e.g.
/lib
) and cover information about all packages installed into this folder.For example,
mip install github:andyrids/micropython-networkutils/networkutils
would create following file:Here is how one could benefit from this:
mip list
andmip uninstall
. You could easily look up the version of your installed dependency./lib
folder with package.json. If each "deps" entry is represented in this metadata file, the tool can tell you quickly that your device is up to date.I have already completed an implementation of this idea, but I haven't created the pull request yet.
The implementation may have bugs, but the big features are done:
list
anduninstall
work. Afteruninstall
removes the last remaining package, the metadata file (currently named as packages-info.json) gets removed as well.install
looks up and records the hash of the latest commit in required branch (or HEAD).Looking forward to hear your comments!
Beta Was this translation helpful? Give feedback.
All reactions