micropython / micropython/micropython-lib
mip: package installation using GitLab URLs for repos in subgroups
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.1k
- Avg merge
- 7d 6h
- Merged PRs (30d)
- 3
Description
This is more of an awareness piece and something to trigger a discussion. There is also the possibility that I am wrong and the installation process is working as intended.
I'm currently developing MicroPython packages on GitLab, which sit inside a 'Libraries' subgroup, which is inside a parent 'MicroPython IoT Projects' group.
Due to the way that the mip _rewrite_url function parses GitLab and GitHub URLs, the assumption is made that the first component after splitting the URL, is the org and the second is the repository slug, which doesn't account for subgroups.
As a result, I had to change the way I reference my packages and package extension urls and deps in the package.json files. My network-utils 'package.json' has to have the following structure:
{
"urls": [
["network_utils/__init__.py", "https://gitlab.com/micropython-iot-projects/libraries/micropython-network-utils/-/raw/HEAD/network-utils/network_utils/__init__.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"
}
In order to install network-utils with mpremote, I would have to use the following command:
mpremote mip install https://gitlab.com/micropython-iot-projects/libraries/micropython-network-utils/-/raw/HEAD/network-utils/package.json
The command below will not work, resulting in a 403 error:
mpremote mip install gitlab:micropython-iot-projects/libraries/micropython-network-utils/network-utils/package.json
The network-utils-mqtt extension package, which requires network-utils, had to have its package.json written like so:
{
"urls": [
["network_utils/mqtt.py", "https://gitlab.com/micropython-iot-projects/libraries/micropython-network-utils/-/raw/HEAD/network-utils-mqtt/network_utils/mqtt.py"]
],
"deps": [
["https://gitlab.com/micropython-iot-projects/libraries/micropython-network-utils/-/raw/HEAD/network-utils/", "develop"]
],
"version": "0.0.1"
}
The URL for the deps, which is the network-utils package this one extends, had to be rewritten so that the package.json could be found correctly.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the _rewrite_url function in micropython/mip/mip/init.py around line 63 and reproduce the failing mpremote mip install command using the GitLab subgroup URL. Compare it with the working raw URL and existing GitHub/GitLab forms; done means subgroup package and dependency URLs resolve correctly without breaking current URL handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- gitlab, python
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100