Skip to content
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

mpremote: Implement mip install from GitLab. #13791

Merged
merged 2 commits into from
May 15, 2024

Conversation

OlivierLenoir
Copy link
Contributor

mpremote: Implement mip install from GitLab.

tools/mpremote/README.md: Add mip install gitlab:org/repo@branch.
Add example mpremote mip install gitlab:org/repo@branch.

tools/mpremote/mpremote/mip.py: Implement install from GitLab.
Modify _rewrite_url() to allow mip install from gitlab: repository.

mpremote/mpremote/main.py: Add gitlab:org/repo, gitlab:org/repo@branch.
Modify argparse_mip() for gitlab:org/repo, gitlab:org/repo@branch.

docs/reference/packages.rst: Mip install from GitLab.
Describe how to mip install from GitLab.

docs/reference/mpremote.rst: Install package from GitLab.
Install the package from the specified branch at org/repo on GitLab.

Signed-off-by: Olivier Lenoir olivier.len02@gmail.com

Copy link

codecov bot commented Mar 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.39%. Comparing base (025d10a) to head (e816b49).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #13791   +/-   ##
=======================================
  Coverage   98.39%   98.39%           
=======================================
  Files         161      161           
  Lines       21204    21204           
=======================================
  Hits        20864    20864           
  Misses        340      340           

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

Copy link

github-actions bot commented Mar 1, 2024

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
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS

@OlivierLenoir
Copy link
Contributor Author

OlivierLenoir commented Mar 1, 2024

Both pull requests are link to the same implementation of mip install from GitLab.

Signed-off-by: Olivier Lenoir olivier.len02@gmail.com


micropython/micropython-lib#816

Modify _rewrite_url() to allow mip install from gitlab: repository.

Signed-off-by: Olivier Lenoir olivier.len02@gmail.com


#13791

mpremote: Implement mip install from GitLab.

tools/mpremote/README.md: Add mip install gitlab:org/repo@branch.
Add example mpremote mip install gitlab:org/repo@branch.

tools/mpremote/mpremote/mip.py: Implement install from GitLab.
Modify _rewrite_url() to allow mip install from gitlab: repository.

mpremote/mpremote/main.py: Add gitlab:org/repo, gitlab:org/repo@branch.
Modify argparse_mip() for gitlab:org/repo, gitlab:org/repo@branch.

docs/reference/packages.rst: Mip install from GitLab.
Describe how to mip install from GitLab.

docs/reference/mpremote.rst: Install package from GitLab.
Install the package from the specified branch at org/repo on GitLab.

Signed-off-by: Olivier Lenoir olivier.len02@gmail.com

Copy link
Member

@jimmo jimmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks @OlivierLenoir !

@@ -56,6 +56,24 @@ If no json file is specified, then "package.json" is implicitly added::
>>> mip.install("github:org/repo") # Uses default branch of that repo
>>> mip.install("github:org/repo", version="branch-or-tag")

The URL can also start with ``gitlab:`` as a simple way of pointing to content
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding docs.

This section mostly just duplicates the above though, and because the gitlab support works in exactly the same way at github, maybe just say

The URL can also start with ``gitlab:`` and works in exactly the same way as GitHub URLs described above ``gitlab:org/repo[/path]``, including support for branches.

@OlivierLenoir
Copy link
Contributor Author

@jimmo , I've aggregated both topics into one. I've also added a deps example with gitlab:.
Let me know if you valid the documentations modification.

Copy link
Member

@jimmo jimmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating! Please squash the commits down to a single commit (or if you want, one to the code and one to the docs).

The URL can also start with ``github:`` as a simple way of pointing to content
hosted on GitHub::
The URL can also start with ``github:`` or ``gitlab:`` as a simple way of pointing to content
hosted on GitHub:: or GitLab::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra :: after GitHub

@OlivierLenoir
Copy link
Contributor Author

Thanks for updating! Please squash the commits down to a single commit (or if you want, one to the code and one to the docs).

@OlivierLenoir
Copy link
Contributor Author

@jimmo, I've fix the extra :: after github.
Regarding your demand to squash down to a single commit, I'm not certain how to do, it's my first real contribution to MicroPython project.
I plan to rebase my local git repository, but is it the right method?

git rebase -i HEAD~<number_of_commit>
git push --force-with-lease

As 5 files have been updated, what should be the commit first line and comment?
Can you help?

@OlivierLenoir OlivierLenoir force-pushed the dev-branch branch 2 times, most recently from 8b232e9 to 370e6a1 Compare March 13, 2024 21:02
@robert-hh
Copy link
Contributor

You PR seems completely messed up, since it contains all the STATIC->static changes.
Did you rebase your branch before changing the STATIC case locally? Then

@OlivierLenoir
Copy link
Contributor Author

You PR seems completely messed up, since it contains all the STATIC->static changes. Did you rebase your branch before changing the STATIC case locally? Then

I'm trying to rebase my commit into one, but it fail because I did not format the commit message as it should.
It seem that I'm not doing it the right way.
@robert-hh, what should I do? Drop my fork and start again? Thanks for your help.

@jimmo
Copy link
Member

jimmo commented Mar 14, 2024

@OlivierLenoir This might help: https://github.com/jimmo/git-and-micropython

Basically if you do a rebase -i and remove all the lines for commits that aren't relevant to your PR.

@OlivierLenoir
Copy link
Contributor Author

@jimmo I think it's now correct, thanks to your help: https://github.com/jimmo/git-and-micropython.
What is the next step, if any?


More sophisticated packages (i.e. with more than one file, or with dependencies)
can be downloaded by specifying the path to their ``package.json``.

>>> mip.install("http://example.com/x/package.json")
>>> mip.install("github:org/user/path/package.json")
>>> mip.install("gitlab:org/user/path/package.json")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering but do we really want to repeat this in every single example in all involved readme/.rst files? Because suppose we add another method then we'd also have to adjust all locations again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just consider that example should be explicit to ease search and understanding.
I've done it searching for github:, and now gitlab:.

$ grep -rl "github:\|gitlab:"
tools/mpremote/README.md
tools/mpremote/mpremote/mip.py
tools/mpremote/mpremote/main.py
docs/reference/packages.rst
docs/reference/mpremote.rst

Changes are:
- main.py: Add gitlab:org/repo, gitlab:org/repo@branch.
- mip.py: Implement install from GitLab.
- README.md: Add mip install gitlab:org/repo@branch example.

Signed-off-by: Olivier Lenoir <olivier.len02@gmail.com>
Signed-off-by: Olivier Lenoir <olivier.len02@gmail.com>
@dpgeorge dpgeorge merged commit e816b49 into micropython:master May 15, 2024
64 checks passed
@dpgeorge
Copy link
Member

Thanks for the contribution! Now merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants