Skip to content

Commit

Permalink
Merge branch 'simplify_createstubs'
Browse files Browse the repository at this point in the history
Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
  • Loading branch information
Josverl committed Feb 5, 2024
2 parents 56fbac5 + fe5fccd commit 2e39bbe
Show file tree
Hide file tree
Showing 119 changed files with 13,566 additions and 9,025 deletions.
11 changes: 7 additions & 4 deletions .env
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Python .env file ..

# Declutter Store all __pycache__ files in the .py_cache folder
PYTHONPYCACHEPREFIX = ".py_cache"

JUPYTER_PLATFORM_DIRS=1
PYDEVD_DISABLE_FILE_VALIDATION=1
# Allow tests to find sources
PYTHONPATH = src

# give 20 secs to complete : subprocess.getstatusoutput
PYDEVD_WARN_EVALUATION_TIMEOUT = 20

# stop nagging for updates
PIP_DISABLE_PIP_VERSION_CHECK=1
PIP_DISABLE_PIP_VERSION_CHECK=1

# stop neggin during debug
JUPYTER_PLATFORM_DIRS=1
PYDEVD_DISABLE_FILE_VALIDATION=1
5 changes: 3 additions & 2 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
name: pytest
on:
workflow_dispatch:
pull_request:
# branches: [main]

# push:
# paths:
# - 'board/**'
Expand All @@ -17,8 +20,6 @@ on:
# - "poetry.lock"
# - "pyrightconfig.json"

pull_request:
branches: [main]

jobs:
run_tests:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ snippets/*/typings
**/typings_*
typings_test
typings
.vscode/Pico-W-Stub
empty
**/*_lock.file

# do not check in any downloaded firmwares
**/firmware
tmp_minified.py
src/stubber/board/board_info.json
44 changes: 24 additions & 20 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"version": "0.2.0",
"configurations": [
{
"name": "dgb pytest --collect-only",
"type": "python",
"name": "Pytest --collect-only (debug)",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"args": [
Expand All @@ -19,14 +19,14 @@
},
{
"name": "Python: file as Module",
"type": "python",
"type": "debugpy",
"request": "launch",
"module": "stubber.${fileBasenameNoExtension}",
"justMyCode": false
},
{
"name": "mpremote",
"type": "python",
"type": "debugpy",
"request": "launch",
"module": "mpremote",
"justMyCode": false,
Expand All @@ -39,18 +39,18 @@
},
{
"name": "Python: stubber - cmdline",
"type": "python",
"type": "debugpy",
"request": "launch",
"module": "stubber.stubber",
"cwd": "${workspaceFolder}",
"args": [
"-v",
"make-variants",
// "-v",
"get-frozen",
"--version",
"preview",
// "switch",
// "v1.20.0",
// "build",
// "--version",
// "latest",
// "--port",
// "esp32",
// "--board",
Expand Down Expand Up @@ -85,25 +85,29 @@
]
},
{
"name": "Python: stubber get-docstubs",
"type": "python",
"name": "Python: board_stubber",
"type": "debugpy",
"request": "launch",
"module": "stubber.stubber",
"program": "scripts/board_stubber.py",
"cwd": "${workspaceFolder}",
"args": [
"get-docstubs"
]
"--format",
"mpy",
"--debug"
],
"console": "integratedTerminal"
},
{
"name": "Python: Current File",
"type": "python",
"type": "debugpy",
"request": "launch",
"program": "${file}",
// "cwd": "${fileDirname}",
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
},
{
"name": "Python: this File - Args ",
"type": "python",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
Expand All @@ -113,7 +117,7 @@
},
{
"name": "Micro-CPython: Current File",
"type": "python",
"type": "debugpy",
"subProcess": false,
"justMyCode": true,
"request": "launch",
Expand All @@ -129,7 +133,7 @@
},
{
"name": "Python: Debug process --path",
"type": "python",
"type": "debugpy",
"request": "launch",
"console": "integratedTerminal",
"program": "${file}",
Expand All @@ -143,7 +147,7 @@
"purpose": [
"debug-test"
],
"type": "python",
"type": "debugpy",
"request": "launch",
"console": "integratedTerminal",
"justMyCode": false,
Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,8 @@
],
"python.analysis.enablePytestExtra": true,
"testExplorer.addToEditorContextMenu": true,
"todo-tree.tree.scanMode": "open files"
"todo-tree.tree.scanMode": "open files",
"python.analysis.typeshedPaths": [
"typings"
]
}
26 changes: 6 additions & 20 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,22 @@
"detail": "run createstubs in linux port",
"type": "shell",
"windows": {
"command": "ubuntu run MICROPYPATH=./board ./tools/micropython board/createstubs.py"
"command": "ubuntu run MICROPYPATH=./src/stubber/board ./tests/tools/ubuntu_20_04/micropython_v1_21_0 src/stubber/board/createstubs.py"
},
"linux": {
"command": "MICROPYPATH=./board ./tools/micropython board/createstubs.py"
"command": "MICROPYPATH=./src/stubber/board ./tests/tools/ubuntu_20_04/micropython_v1_21_0 src/stubber/board/createstubs.py"
},
"problemMatcher": []
},
{
"label": "minify",
"detail": "minify for esp8622",
"type": "shell",
"command": "poetry run stubber minify --all --compile",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "run minified",
"detail": "run minified createstubs in linux port",
"dependsOn": [
"minify"
],
"label": "run createstubs_db",
"detail": "run createstubs_db in linux port",
"type": "shell",
"windows": {
"command": "ubuntu run ./tools/micropython minified/createstubs.py"
"command": "ubuntu run MICROPYPATH=./src/stubber/board ./tests/tools/ubuntu_20_04/micropython_v1_21_0 src/stubber/board/createstubs_db.py"
},
"linux": {
"command": "./tools/micropython minified/createstubs.py"
"command": "MICROPYPATH=./src/stubber/board ./tests/tools/ubuntu_20_04/micropython_v1_21_0 src/stubber/board/createstubs_db.py"
},
"problemMatcher": []
},
Expand Down
18 changes: 18 additions & 0 deletions data/micropython_v1_22_0_rpi_pico_w.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# MicroPython v1.22.0 on 2023-12-27; Raspberry Pi Pico W with RP2040
__main__ array framebuf random
_asyncio asyncio/__init__ gc re
_boot asyncio/core hashlib requests/__init__
_boot_fat asyncio/event heapq rp2
_onewire asyncio/funcs io select
_rp2 asyncio/lock json socket
_thread asyncio/stream lwip ssl
_webrepl binascii machine struct
aioble/__init__ bluetooth math sys
aioble/central builtins micropython time
aioble/client cmath mip/__init__ uasyncio
aioble/core collections neopixel uctypes
aioble/device cryptolib network urequests
aioble/l2cap deflate ntptime webrepl
aioble/peripheral dht onewire webrepl_setup
aioble/security ds18x20 os websocket
aioble/server errno platform
14 changes: 14 additions & 0 deletions data/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Overview of modules avaialble on different ports and boards
These files are used to compile a list of modules that createstubs.py and its variants will attempt to create stubs for.

This can be generated by running the following command in micropython on the board: `help('modules')`
or via mpremote by running the following command: `mpremote exec "help('modules')"`

Store the ouput in a file called `micropython-<version>-<port>[-<board>].txt` in this directory.
place a comment `#` before all lines that do not not contain module names.

After adding or changing any file update the list of modules using from the root of the repository.
```
stubber update-module-list
stubber make-variants
```
56 changes: 28 additions & 28 deletions mip/full.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"urls": [
[
"createstubs.py",
"github:josverl/micropython-stubber/src/stubber/board/createstubs.py"
],
[
"createstubs_db.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_db.py"
],
[
"createstubs_mem.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_mem.py"
],
[
"logging.py",
"github:Josverl/micropython-stubber/src/stubber/board/logging.py"
],
[
"modules.txt",
"github:Josverl/micropython-stubber/src/stubber/board/modulelist.txt"
],
[
"board_info.csv",
"github:Josverl/micropython-stubber/src/stubber/board/board_info.csv"
]
"urls": [
[
"createstubs.py",
"github:josverl/micropython-stubber/src/stubber/board/createstubs.py"
],
"deps": [],
"version": "1.16.2"
}
[
"createstubs_db.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_db.py"
],
[
"createstubs_mem.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_mem.py"
],
[
"logging.py",
"github:Josverl/micropython-stubber/src/stubber/board/logging.py"
],
[
"modulelist.txt",
"github:Josverl/micropython-stubber/src/stubber/board/modulelist.txt"
],
[
"board_info.csv",
"github:Josverl/micropython-stubber/src/stubber/board/board_info.csv"
]
],
"deps": [],
"version": "1.17.0"
}
48 changes: 24 additions & 24 deletions mip/minified.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"urls": [
[
"createstubs.py",
"github:josverl/micropython-stubber/src/stubber/board/createstubs_min.py"
],
[
"createstubs_db.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_db_min.py"
],
[
"createstubs_mem.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_mem_min.py"
],
[
"modules.txt",
"github:Josverl/micropython-stubber/src/stubber/board/modulelist.txt"
],
[
"board_info.csv",
"github:Josverl/micropython-stubber/src/stubber/board/board_info.csv"
]
"urls": [
[
"createstubs.py",
"github:josverl/micropython-stubber/src/stubber/board/createstubs_min.py"
],
"deps": [],
"version": "1.16.2"
}
[
"createstubs_db.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_db_min.py"
],
[
"createstubs_mem.py",
"github:Josverl/micropython-stubber/src/stubber/board/createstubs_mem_min.py"
],
[
"modulelist.txt",
"github:Josverl/micropython-stubber/src/stubber/board/modulelist.txt"
],
[
"board_info.csv",
"github:Josverl/micropython-stubber/src/stubber/board/board_info.csv"
]
],
"deps": [],
"version": "1.17.0"
}
Loading

0 comments on commit 2e39bbe

Please sign in to comment.