tools/mpremote: Add an alias for codeberg repos.#18989
tools/mpremote: Add an alias for codeberg repos.#18989agatti wants to merge 1 commit intomicropython:masterfrom
Conversation
|
Code size report: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #18989 +/- ##
=======================================
Coverage 98.46% 98.46%
=======================================
Files 176 176
Lines 22784 22784
=======================================
Hits 22435 22435
Misses 349 349 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The There will be some firmware impact, but I would support a limited list of additional shorthands for common hosting services. |
Indeed! Thanks for the reminder, I've submitted the micropython-lib part of this change right now. |
|
Should only a branch reference possible? I think a tag reference will not work with this API. E.g. |
|
Sigh. Yes, they have one url for tags and one for branches (if you replace /branch/ with /tag/ your link works). I'll open an issue on codeberg itself and ask them how to proceed in this case, since you can't expect the on-device component of the package manager to handle auth tokens, and maybe they won't like being hit twice (once for /branch/ and once for /tag/) on each file download attempt. Thanks a lot for letting me know. Marking as draft. |
|
You could use the Forgejo API: https://codeberg.org/api/swagger#/repository/repoGetRawFile I think if your line would look like this, it should work: |
f11e14f to
317013a
Compare
|
Turns out that if you remove /branch/ it automatically picks the right URL :) Can you please try this version? |
|
Nevermind, you're right - the client on the device doesn't follow redirects. I'll update using your path reference. |
This commit introduces an alias to access codeberg repos from within mpremote's package manager. Right now packages hosted on codeberg could only be referenced by their full URL, unlike other packages hosted on either GitHub or GitLab. To make access those packages easier, now they can be referenced as "codeberg:org/repo@branch". Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
317013a to
958c042
Compare
|
Done! @yvo64 I've used your package for tests, it works both via |
|
good catch, is there a way to create a repeatable test for the different patterns - even if that test is manual only and skipped in ci builds ? |
|
I guess we can publish a If that's acceptable I don't mind writing the test package and the script myself, after the appropriate accounts have been opened by somebody with a micropython.org email address :) |
There was a problem hiding this comment.
I have tested with all source specifications I think are relevant, and they all work.
https://gist.github.com/Josverl/61cdc3c742ba1e1761d5041c8483a011
Summary
This PR introduces an alias to access codeberg repos from within
mpremote's package manager.Right now packages hosted on codeberg could only be referenced by their full URL, unlike other packages hosted on either GitHub or GitLab. To make access to those packages easier, now they can be referenced as
"codeberg:org/repo@branch".
Testing
I've pushed a test package on codeberg myself to test the behaviour of
mpremote(https://codeberg.org/agatti/micropython-package-test). The package was successfully installed on an ESP8266 board, also when referenced with a custom branch/tag name.Trade-offs and Alternatives
Whilst this does not directly impact the interpreter, it might be seen an invitation for others to add niche Git hosting providers that few people use, or for services that may not be seen as long-lasting. Except for services that cater to a specific region (eg. Mainland China), the only other provider I reckon that may have some traction is SourceHut, but I don't really have any numbers to back my assumptions up.
I've refactored the alias lookup code a bit to make addition of a new provider easier to reason with. If adding a new alias for Codeberg is not something worth having, at least the refactoring can still be useful.
Generative AI
I did not use generative AI tools when creating this PR.