Repo structure¶
2 python versions
This and sister repos¶
repo |
Why |
Where |
example |
---|---|---|---|
micropython-stubber |
needed to make stubs |
in your source folder |
develop/micropython-stubber |
micropython-stubs |
stores collected stubs |
next to the |
develop/micropython-stubs |
Note
recommended is to create a symlink from
develop/micropython-stubber\all-stubs
todevelop/micropython-stubs
Structure of this repo¶
The file structure is based on my personal windows environment, but you should be able to adapt that without much hardship to you own preference and OS.
What |
Details |
Where |
---|---|---|
stub root |
symlink to connect the 2 sister-repos |
all_stubs |
firmware stubber |
MicroPython |
board/createstubs.py |
minified firmware stubber |
MicroPython |
minified/createstubs.py |
PC based scripts |
CPython |
src/* |
PC based scripts |
CPython |
process.py |
pytest tests |
test/* |
|
Naming Convention and Stub folder structure¶
What |
Why |
Where |
---|---|---|
stub root |
connect the 2 repos |
all_stubs |
cpython stubs for micropython core |
adapt for differences between CPython and MicroPython |
stubs/cpython-core |
generated stub files |
needed to use stubs |
stubs/{firmware}-{port}-{version}-frozen |
Frozen stub files |
better code intellisense |
stubs/{firmware}-{version}-frozen |
Note: I found that, for me, using submodules caused more problems than it solved. So instead I link the two main repo’s using a symlink.
cd /develop
git clone https://github.com/josverl/micropython-stubber.git
git clone https://github.com/josverl/micropython-stubs.git
cd micropython-stubber
poetry install
stubber clone
Create a symbolic link¶
To create the symbolic link to the ../micropython-stubs/stubs
folder the instructions differ slightly for each OS/
The below examples assume that the micropython-stubs repo is cloned ‘next-to’ your project folder.
please adjust as needed.
Windows 10¶
Requires Developer enabled
or elevated powershell prompt.
# target must be an absolute path, resolve path is used to resolve the relative path to absolute
New-Item -ItemType SymbolicLink -Path "all-stubs" -Target (Resolve-Path -Path ../micropython-stubs/stubs)
or use mklink in an (elevated) command prompt
rem target must be an absolute path
mklink /d all-stubs c:\develop\micropython-stubs\stubs
Linux/Unix/Mac OS¶
# target must be an absolute path
ln -s /path/to/micropython-stubs/stubs all-stubs