Open samskiter opened 1 year ago
Ok, fixed a bug with using get-frozen with version=latest https://github.com/Josverl/micropython-stubber/pull/442
Update: I seem to be successfully using the get-frozen
get-docstubs
and merge
commands now
build
outputs into publish/micropython-latest-rp2-rpi_pico_w-stubs (note the lower case now). My build command looks like stubber build --version latest --port rp2 --board RPI_PICO_W
- I haven't worked out how to get this output into VSCode yet - about to start tryingMy understanding of the workflow right now:
mkdir repos && cd repos
cd ..
(aka move to the micropython-stubs repo) and start creating the stubs:stubber get-core
- This creates a bunch of folders like stubs/cpython_core-micropython
stubber get-frozen --black --version=latest
- This should create stubs/micropython-latest-frozen
stubber get-docstubs
- this should create sstubs/micropython-latrest-docstubs
stubs/micropython-latest-rp2-RPI_PICO_W
- Instructions for this are elsewhere, but looks roughly like: cd repos/micropython
(aka go into the micropython repo) git submodule update --init
(aka get the submodules all checked out) make -C mpy-cross
cd ports/rp2
make BOARD=RPI_PICO_W
. Then you need to flash your version of micropython onto a board and run createstubs.py
(I followed instructions here: https://github.com/paulober/Pico-W-Stub/blob/main/micropython-stubber.md#generating-the-stubs). Drag the files off an drop them in micropython-stubs/stubs/micropython-latest-rp2-RPI_PICO_W
stubber merge --version latest --port rp2 --board RPI_PICO_W
stubber build --version latest --port rp2 --board RPI_PICO_W
The above doesn't work - seems that the frozen stubs overwrite the merged stubs - I thiunk I need to work out how to get the micropython repo to update the frozen bits
Sam, thanks for your perseverance
This project started very small years ago - and has grown over time. documentation that I once wrote - has been surpassed by the reality of tools and micropython evolving. also there is tech dept of some functionality - such as creating the firmware aka board stubs - that are not fully integrated into the packaged stubber tool, as I can't get them fully stable across all ports ( not esp8266)
writing this from memory in the train:
clone the micropython-stubber repo ( to get the scripts folder and the pyproject.toml file that holds the config)
either pip install micropython-stubber
or poetry install
stubber clone --with stubs
optionally stubber clone --version v1.21.0
This will clone the micropython, -lib and -stubs repos under /repos/*
run python scripts/board_stubber.py
this will run the createstubs.py on the board , run post processing , merge them with the checked out stubs , and build them ( not sure about the build step)
the get-core command is obsoleted - it has been replaced by the get-docstubs which is actually better than get-core ever was. Il l need to deprecate that command.
Sam, thanks for your perseverance
This project started very small years ago - and has grown over time. documentation that I once wrote - has been surpassed by the reality of tools and micropython evolving. also there is tech dept of some functionality - such as creating the firmware aka board stubs - that are not fully integrated into the packaged stubber tool, as I can't get them fully stable across all ports ( not esp8266)
writing this from memory in the train:
- clone the micropython-stubber repo ( to get the scripts folder and the pyproject.toml file that holds the config)
- either
pip install micropython-stubber
orpoetry install
stubber clone --with stubs
- optionally
stubber clone --version v1.21.0
This will clone the micropython, -lib and -stubs repos under/repos/*
- run
python scripts/board_stubber.py
this will run the createstubs.py on the board , run post processing , merge them with the checked out stubs , and build them ( not sure about the build step)- the get-core command is obsoleted - it has been replaced by the get-docstubs which is actually better than get-core ever was. Il l need to deprecate that command.
Thanks for this and sorry for my previous impatience - felt so close to getting things working!
I think your instructions work but only for a specific tagged version. I'm testing a branch of micropython (https://github.com/micropython/micropython/pull/10704) so I need to check out an arbitrary commit and generate stubs...
I notice you didn't mention using get-frozen or get-docstubs specifically but I think I will need those?
I never considered a specific COMMIT, only versions to be honest. You could add a local tag based on semver. I think something like v1.20.x could work.
Also if you do not specify a version, I think most commands just leave the repost on the commit they are. Or at least that is something that can be added with little change
After looking at that PR I think I understand better what you are trying to do. If there is a new DMA.rst file you'll indeed need to run get-docstubs and may need to run Get-frozen as well
Perhaps --version
should also allow PR#1234
notation, let me think on that.
Still for this specific PR it will not be of any use,
as the PR does not add/change:
docs/library
comparing to main there are only 2 .rst files changed, however the files docs/rp2/general.rst
and docs/rp2/quickref.rst
are not used in generation stubs
so that means that you do not need to re-generate the docstubs , nor the frozen stubs.
You can recreate them , or re-use them from the nearest (lower) version
--version=HEAD
might be an interesting option and the produced output could be v<latest>-<sha>
or v-adhoc-<sha>
or something like that? - just some way to specify that I'd like it to be built right where we are...
Have you considered not checking in anything that is generated by the build? that might have made things clearer for me personally.
you considered not checking in anything that is generated by the build? Nothing is checked in automatically by the stubber
just some way to specify that I'd like it to be built right where we are...
It already does that, if you just do not specify a version Or do you have a specific command where you find this does not work?
All output that is not a specific tag, is considered 'latest', as that's exactly what I need, and keeps me from needing to do quite complex version resolution,
I see that if you are working on a year old PR that that is confusing, but it still works if you mentally time travel back to that PR.
It may be useful for your scenario if you remove all -latest- folders
Naming convention. I do not think that using the Git hash for versioning is useful. It does not follow semver, nor is it human readable. Also I do not see how it would be helpful in your scenario.
I may consider adding the pre-release build nr, now that that is adopted by micropython. Still that would be 1.22.0-B1 and newer, and not solve parallel branches such as a PR or a fork
It already does that, if you just do not specify a version Or do you have a specific command where you find this does not work?
Yea, I'm not sure that's working for me, OR I'm getting confused! I think I couldn't find a way to get this to work for the merge and get-docstub commands because of this 'switch branch' command. https://github.com/Josverl/micropython-stubber/blob/3779db10af8ebfe356e082fa06f3bd82943cc77b/src/stubber/publish/candidates.py#L241
Latest also seems to be the default for those commands: https://github.com/Josverl/micropython-stubber/blob/3779db10af8ebfe356e082fa06f3bd82943cc77b/src/stubber/publish/candidates.py#L202
It may be useful for your scenario if you remove all -latest- folders
That might be a good idea
Nothing is checked in automatically by the stubber
Sorry I meant the stubs library - are the outputs, of e.g. 'generate docstubs' not checked in there? Could these be viewed as intermediate-generate files?
I do not think that using the Git hash for versioning is useful. It does not follow semver, nor is it human readable. Also I do not see how it would be helpful in your scenario.
Sorry I mean something like:
v1.19.0-a64d88
or
v-adhoc-a64d88
I have seen it as quite common practice to include a non-human-readable portion to version numbers (e.g. SHAs or build numbers) even for releases - this allows developer traceability back to a specific commit and build (as version numbers can be a little 'blurry' sometimes).
It would help my scenario of debug-devolpment because I could produce builds that I can produce stub builds that would let me easily identify where they came from...
It's been a week or so since I needed to touch this issue so some of this is from memory so sorry if this is a bit of a nonsensical reply :D
Describe the bug I've tried 2 or 3 times to work out how to use this to generate stubs for a custom micropython build for the RPi Pico W but I'm really struggling!
Here's what I've tried/gleaned so far:
get-frozen
but despite apparent success, no folders seem to be createdget-core
doesn't seem to create a micropython-core directory.My guess for what I should do:
pip install micropython-stubber
micropython-latest-rp2-RPI_PICO_W
stubber get-frozen --black --version=latest
stubber get-docstubs
stubber merge --version latest --board RPI_PICO_W
stubber build --version latest --port rp2 --board RPI_PICO_W
This just isn't working for me - I'm getting failures about missing frozen stubs and all sorts - I must be doing something fundamentally wrong here or misunderstanding what's already checked in and what needs to be generated