From 9fafa578f73e3259905891920dada996326584f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 23:16:21 +0000 Subject: [PATCH 1/8] build(deps): bump urllib3 from 2.2.1 to 2.2.2 in /src/mpflash Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.1 to 2.2.2. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/2.2.1...2.2.2) --- updated-dependencies: - dependency-name: urllib3 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- src/mpflash/poetry.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mpflash/poetry.lock b/src/mpflash/poetry.lock index e358c628..912bf37e 100644 --- a/src/mpflash/poetry.lock +++ b/src/mpflash/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "ansicon" @@ -1452,13 +1452,13 @@ test = ["codecov", "coverage", "mypy", "nptyping (>=1.3.0)", "numpy", "pycodesty [[package]] name = "urllib3" -version = "2.2.1" +version = "2.2.2" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.8" files = [ - {file = "urllib3-2.2.1-py3-none-any.whl", hash = "sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d"}, - {file = "urllib3-2.2.1.tar.gz", hash = "sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19"}, + {file = "urllib3-2.2.2-py3-none-any.whl", hash = "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472"}, + {file = "urllib3-2.2.2.tar.gz", hash = "sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168"}, ] [package.extras] From 150105eae90052c26ec0301a66f534bc79e64a25 Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Sat, 29 Jun 2024 23:11:59 +0200 Subject: [PATCH 2/8] feat: Use cache-to-disk to cache micropython versions to disk The commit updates the dependencies in `pyproject.toml` to include the `cache-to-disk` library with version `2.0.0`. Additionally, it modifies the `versions.py` file to import the `cache_to_disk` module and adds a new cache decorator `@cache_to_disk` to the `micropython_versions` function. Signed-off-by: Jos Verlinde --- src/mpflash/mpflash/vendor/versions.py | 15 ++++++++++----- src/mpflash/poetry.lock | 13 ++++++++++++- src/mpflash/pyproject.toml | 1 + 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/mpflash/mpflash/vendor/versions.py b/src/mpflash/mpflash/vendor/versions.py index 00e96691..1aba6606 100644 --- a/src/mpflash/mpflash/vendor/versions.py +++ b/src/mpflash/mpflash/vendor/versions.py @@ -4,12 +4,12 @@ ############################################################# """ -from functools import lru_cache - +from cache_to_disk import cache_to_disk, NoCacheCondition from loguru import logger as log from packaging.version import parse from mpflash.common import GH_CLIENT + OLDEST_VERSION = "1.16" "This is the oldest MicroPython version to build the stubs on" @@ -70,9 +70,10 @@ def clean_version( return version -@lru_cache(maxsize=10) +@cache_to_disk(n_days_to_cache=1) def micropython_versions(minver: str = "v1.20", reverse: bool = False): """Get the list of micropython versions from github tags""" + cache_it = True try: gh_client = GH_CLIENT repo = gh_client.get_repo("micropython/micropython") @@ -100,10 +101,15 @@ def micropython_versions(minver: str = "v1.20", reverse: bool = False): "v1.11", "v1.10", ] + cache_it = False versions = [v for v in versions if parse(v) >= parse(minver)] # remove all but the most recent (preview) version versions = versions[:1] + [v for v in versions if "preview" not in v] - return sorted(versions, reverse=reverse) + versions = sorted(versions, reverse=reverse) + if cache_it: + return versions + # returns - but does not cache + raise NoCacheCondition(function_value=versions) def get_stable_mp_version() -> str: @@ -116,4 +122,3 @@ def get_preview_mp_version() -> str: # read the versions from the git tags all_versions = micropython_versions(minver=OLDEST_VERSION) return [v for v in all_versions if v.endswith(V_PREVIEW)][-1] - diff --git a/src/mpflash/poetry.lock b/src/mpflash/poetry.lock index b776953d..7b3fb836 100644 --- a/src/mpflash/poetry.lock +++ b/src/mpflash/poetry.lock @@ -249,6 +249,17 @@ files = [ {file = "blkinfo-0.2.0.tar.gz", hash = "sha256:322a906595f78832d6725ac74a0b9fd2794df3388584d9f05c1a2f8e19324851"}, ] +[[package]] +name = "cache-to-disk" +version = "2.0.0" +description = "Local disk caching decorator for python function." +optional = false +python-versions = "*" +files = [ + {file = "cache_to_disk-2.0.0-py3-none-any.whl", hash = "sha256:ea5afe13d4284cb4a06169b0807fbc60547cbe19c54563bf90e1d44f24029481"}, + {file = "cache_to_disk-2.0.0.tar.gz", hash = "sha256:79e19ea9b72eedc5cec83bb8aa55374afc671493e7d13d541f3b63eb3a13fb32"}, +] + [[package]] name = "cachetools" version = "5.3.3" @@ -1585,4 +1596,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = ">=3.8.1,<4.0" -content-hash = "99cc10bd15b033a47635e31676205b38443b15697fb189b01a8eb7f2f175acf8" +content-hash = "e0f5697e08c8c691e538c586c7a478cdc93de23d56435373b56abdd2147bda87" diff --git a/src/mpflash/pyproject.toml b/src/mpflash/pyproject.toml index 0d15f2d0..f1492026 100644 --- a/src/mpflash/pyproject.toml +++ b/src/mpflash/pyproject.toml @@ -38,6 +38,7 @@ pyusb = "^1.2.1" requests = "^2.31.0" rich-click = "^1.8.1" tenacity = "8.2.3" +cache-to-disk = "^2.0.0" [tool.poetry.group.dev] From 0dbd8a27338b7283d43e546a2bac2ace9700f8bc Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Tue, 25 Jun 2024 22:23:54 +0200 Subject: [PATCH 3/8] mpflash: Refactor enter_bootloader_cdc_1200bps method to work on windows Fixes: https://github.com/Josverl/micropython-stubber/issues/571 Signed-off-by: Jos Verlinde --- src/mpflash/mpflash/bootloader/__init__.py | 1 - src/mpflash/mpflash/bootloader/touch1200.py | 26 ++++++--------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/src/mpflash/mpflash/bootloader/__init__.py b/src/mpflash/mpflash/bootloader/__init__.py index 256b8bf7..b9ae7a77 100644 --- a/src/mpflash/mpflash/bootloader/__init__.py +++ b/src/mpflash/mpflash/bootloader/__init__.py @@ -21,7 +21,6 @@ def enter_bootloader( # NO bootloader requested, so must be OK to flash return True - log.info(f"Entering bootloader on {mcu.board} on {mcu.serialport} using method: {method.value}") if method == BootloaderMethod.MPY: result = enter_bootloader_mpy(mcu, timeout=timeout) elif method == BootloaderMethod.MANUAL: diff --git a/src/mpflash/mpflash/bootloader/touch1200.py b/src/mpflash/mpflash/bootloader/touch1200.py index 3f62f8a6..058950c3 100644 --- a/src/mpflash/mpflash/bootloader/touch1200.py +++ b/src/mpflash/mpflash/bootloader/touch1200.py @@ -7,32 +7,20 @@ from mpflash.logger import log from mpflash.mpremoteboard import MPRemoteBoard -from .manual import enter_bootloader_manual def enter_bootloader_cdc_1200bps(mcu: MPRemoteBoard, timeout: int = 10): - if sys.platform == "win32": - log.warning("Touch 1200bps method is currently not supported on Windows, switching to manual") - return enter_bootloader_manual(mcu, timeout=timeout) - - log.info(f"Entering bootloader on {mcu.board} on {mcu.serialport} using CDC 1200bps") - # if port argument is present perform soft reset if not mcu.serialport: raise MPFlashError("No serial port specified") + log.info(f"Entering bootloader on {mcu.serialport} using CDC toch 1200 bps method") + # if port argument is present perform soft reset # try to initiate serial port connection on PORT with 1200 baudrate try: - with serial.Serial( - port=mcu.serialport, - baudrate=1200, - parity=serial.PARITY_NONE, - stopbits=serial.STOPBITS_ONE, - bytesize=serial.EIGHTBITS, - rtscts=True, - ) as connection: - print("Connection established") - connection.rts = True - connection.dtr = False - time.sleep(0.4) + com = serial.Serial(mcu.serialport, 1200, dsrdtr=True) + com.rts = False # required + com.dtr = False # might as well + time.sleep(0.2) + com.close() except serial.SerialException as e: log.exception(e) From 658f808dfc224fa39d2ddbe908563d8e2fd593e9 Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Sun, 30 Jun 2024 10:47:26 +0200 Subject: [PATCH 4/8] chore: Update mpflash documentation Signed-off-by: Jos Verlinde --- src/mpflash/README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/mpflash/README.md b/src/mpflash/README.md index 40d05dc8..0130b676 100644 --- a/src/mpflash/README.md +++ b/src/mpflash/README.md @@ -11,8 +11,8 @@ This tool was initially created to be used in a CI/CD pipeline to automate the p `mpflash` has been tested on: - OS: Windows x64, Linux X64, but not (yet) macOS. - Micropython (hardware) ports: - - `rp2`, using `.uf2`, using filecopy (macos not tested yet) - - `samd`, using ` .uf2`, using filecopy (macos not tested yet) + - `rp2`, using `.uf2`, using filecopy + - `samd`, using ` .uf2`, using filecopy - `esp32`, using `.bin`, using esptool, - `esp8266`, using `.bin`, using esptool - `stm32`, using ` .dfu`, using pydfu @@ -25,7 +25,7 @@ Not yet implemented: `nrf`, `cc3200`, `mimxrt` 3. Flash one or all connected MicroPython boards with a specific firmware or version. ## Installation -To install mpflash, you can use pip: `pip install mpflash` +To install mpflash, you can use: `pipx install mpflash` or `pip install mpflash` ## Basic usage You can use mpflash to perform various operations on your MicroPython boards. Here is an example of basic usage: @@ -69,7 +69,7 @@ To download the MicroPython firmware for some boards, use the following command: These will try to download the prebuilt MicroPython firmware for the boards from https://micropython.org/download/ and save it in your downloads folder in the `firmware` directory. The stable version (default) is determined based on the most recent published release, -other versions are `--version preview` and `--version x.y.z` to download the latest preview or version x.y.z respectively. +other options are `--version stable`, `--version preview` and `--version x.y.z` to download the latest stable, preview or version x.y.z respectively. By default the firmware will be downloaded to your OS's preferred `Downloads/firmware` folder, but you can speciy a different directory using the `--dir` option. @@ -92,8 +92,18 @@ After you have downloaded a firmware you can flash the firmware to a board usin This will (try to) autodetect the connected boards, and determine the correct firmware to flash to each board. - `mpflash flash` will flash the latest stable firmware to all connected boards. +If you have a board withouth a running micropython version, you will need to specify the board and the serial port to flash. - `mpflash flash --serial ? --board ?` will prompt to select a specific serial port and board to flash. (the firmware must be dowloaded earlier) +In order to flash the firmware some boards need to be put in bootloader mode, this is done automatically by mpflash where possible and supported by the boards hardware and current bootloader. +The supported `--bootloader` options are: + +- `touch1200` bootloader is activated by connecting to the board at 1200 baud +- `mpy` using micropython to enter the bootloader +- `manual` manual intervention is needed to enter the bootloader +- `none` mpflash assumes the board is ready to flash + +For ESP32 and ESP8266 boards the `esptool` is used to flash the firmware, and this includes activating the bootloader. ### Flashing all connected boards with the latest stable firmware ```bash From cbd92a8d3061155754c2530cde94ab6cf45c47bf Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Sun, 30 Jun 2024 15:27:03 +0200 Subject: [PATCH 5/8] stubber: Add `clone --stubs` option Signed-off-by: Jos Verlinde --- src/stubber/commands/clone_cmd.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/stubber/commands/clone_cmd.py b/src/stubber/commands/clone_cmd.py index 07537825..b9968ac5 100644 --- a/src/stubber/commands/clone_cmd.py +++ b/src/stubber/commands/clone_cmd.py @@ -27,6 +27,7 @@ type=click.Path(file_okay=False, dir_okay=True), ) @click.option( + "--stubs/--no-stubs", "--add-stubs/--no-stubs", "stubs", default=False, From da4f122bee2975ab9f176b585ad664535972cd59 Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Sun, 30 Jun 2024 21:09:52 +0200 Subject: [PATCH 6/8] stubber: use mpflash@latest Signed-off-by: Jos Verlinde --- poetry.lock | 7 ++++--- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index 1fc5492f..ab7a6463 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1479,12 +1479,13 @@ test = ["pytest (<5.4)", "pytest-cov"] [[package]] name = "mpflash" -version = "0.8.6" +version = "0.9.0" description = "Flash and download tool for MicroPython firmwares" optional = false python-versions = "<4.0,>=3.8.1" files = [ - {file = "mpflash-0.8.6-py3-none-any.whl", hash = "sha256:504b53190395ec6b3c22a8c87066295aa4d3737fea885898eafaa3e6296c8500"}, + {file = "mpflash-0.9.0-py3-none-any.whl", hash = "sha256:a7ba60f94607f130bfa223934a0aa79f80b2235f8764ce83a8caa193e7f9bf04"}, + {file = "mpflash-0.9.0.tar.gz", hash = "sha256:d41158e8dbd6fa5db5107e230fe7080553528204b28cce193bd4c906b95a8910"}, ] [package.dependencies] @@ -3164,4 +3165,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0" -content-hash = "e38115af2c5287170a79e43065a6b580651c26afad5e9b757359f0ecc5f3f4f6" +content-hash = "efdbffc3aeb014f615741b18646f6bb246d6c92246c74dc4eedb66e48fe638eb" diff --git a/pyproject.toml b/pyproject.toml index 467600e9..3e0a236b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ python = ">=3.9,<4.0" python-minifier = { version = "^2.7.0", python = "<3.12" } # no support for 3.12 yet requests = "^2.28.0" mypy = "1.9.0" -mpflash = "^0.8.6" +mpflash = "^0.9.0" mpremote = "^1.23.0" # others autoflake = ">=1.7,<3.0" From 63be0a73057910cf764d64be225ef0eaff758eba Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Sun, 30 Jun 2024 21:16:18 +0200 Subject: [PATCH 7/8] mpflash: consistent naming of params with mpflash Signed-off-by: Jos Verlinde --- src/stubber/commands/cli.py | 2 +- src/stubber/commands/get_frozen_cmd.py | 2 +- src/stubber/commands/get_mcu_cmd.py | 2 +- src/stubber/commands/merge_cmd.py | 3 +- src/stubber/commands/publish_cmd.py | 3 +- src/stubber/commands/variants_cmd.py | 3 +- tests/commandline/stubber_cli_test.py | 61 ++++++++++++++++++-------- 7 files changed, 49 insertions(+), 27 deletions(-) diff --git a/src/stubber/commands/cli.py b/src/stubber/commands/cli.py index 2de5b2e9..a3357653 100644 --- a/src/stubber/commands/cli.py +++ b/src/stubber/commands/cli.py @@ -13,7 +13,7 @@ @click.version_option(package_name="micropython-stubber", prog_name="micropython-stubber✏️ ") @click.option( "-V", - "-v", + "-V", "--verbose", count=True, default=0, diff --git a/src/stubber/commands/get_frozen_cmd.py b/src/stubber/commands/get_frozen_cmd.py index 0a26bea2..f672eb1a 100644 --- a/src/stubber/commands/get_frozen_cmd.py +++ b/src/stubber/commands/get_frozen_cmd.py @@ -31,7 +31,7 @@ @click.option( "--version", "--Version", - "-V", + "-v", "version", default="", # default=[CONFIG.stable_version], diff --git a/src/stubber/commands/get_mcu_cmd.py b/src/stubber/commands/get_mcu_cmd.py index de816cd0..8ad9714d 100644 --- a/src/stubber/commands/get_mcu_cmd.py +++ b/src/stubber/commands/get_mcu_cmd.py @@ -21,7 +21,7 @@ @stubber_cli.command(name="get-mcu-stubs") @click.option( "--variant", - "-v", + # "-v", type=click.Choice(["Full", "Mem", "DB"], case_sensitive=False), default="DB", show_default=True, diff --git a/src/stubber/commands/merge_cmd.py b/src/stubber/commands/merge_cmd.py index a1c3488a..a0d4263b 100644 --- a/src/stubber/commands/merge_cmd.py +++ b/src/stubber/commands/merge_cmd.py @@ -18,8 +18,7 @@ @click.option("--family", default="micropython", type=str, show_default=True) @click.option( "--version", - "--Version", - "-V", + "-v", "versions", multiple=True, default=["all"], diff --git a/src/stubber/commands/publish_cmd.py b/src/stubber/commands/publish_cmd.py index dce3b68d..bacfc7d8 100644 --- a/src/stubber/commands/publish_cmd.py +++ b/src/stubber/commands/publish_cmd.py @@ -18,8 +18,7 @@ @click.option("--family", default="micropython", type=str, show_default=True) @click.option( "--version", - "--Version", - "-V", + "-v", "versions", multiple=True, default=[CONFIG.stable_version], diff --git a/src/stubber/commands/variants_cmd.py b/src/stubber/commands/variants_cmd.py index 19879f28..2f1ecc05 100644 --- a/src/stubber/commands/variants_cmd.py +++ b/src/stubber/commands/variants_cmd.py @@ -13,8 +13,7 @@ @click.option( "--version", - "--Version", - "-V", + "-v", "version", default=CONFIG.stable_version, show_default=True, diff --git a/tests/commandline/stubber_cli_test.py b/tests/commandline/stubber_cli_test.py index b80d858e..be4d88d7 100644 --- a/tests/commandline/stubber_cli_test.py +++ b/tests/commandline/stubber_cli_test.py @@ -99,11 +99,19 @@ def test_cmd_switch(mocker: MockerFixture, params: List[str]): mocker.patch("stubber.commands.clone_cmd.git.clone", autospec=True, return_value=0) m_fetch = mocker.patch("stubber.commands.clone_cmd.git.fetch", autospec=True, return_value=0) - m_switch_branch = mocker.patch("stubber.commands.clone_cmd.git.switch_branch", autospec=True, return_value=0) - m_switch_tag = mocker.patch("stubber.commands.clone_cmd.git.switch_tag", autospec=True, return_value=0) - mocker.patch("stubber.commands.clone_cmd.git.get_local_tag", autospec=True, return_value="v1.42") + m_switch_branch = mocker.patch( + "stubber.commands.clone_cmd.git.switch_branch", autospec=True, return_value=0 + ) + m_switch_tag = mocker.patch( + "stubber.commands.clone_cmd.git.switch_tag", autospec=True, return_value=0 + ) + mocker.patch( + "stubber.commands.clone_cmd.git.get_local_tag", autospec=True, return_value="v1.42" + ) - m_match = mocker.patch("stubber.utils.repos.match_lib_with_mpy", autospec=True) # Moved to other module + m_match = mocker.patch( + "stubber.utils.repos.match_lib_with_mpy", autospec=True + ) # Moved to other module mocker.patch("stubber.commands.clone_cmd.Path.exists", return_value=True) result = runner.invoke(stubber.stubber_cli, params) @@ -134,9 +142,15 @@ def test_cmd_switch_version(mocker: MockerFixture, version: str): m_clone = mocker.patch("stubber.commands.clone_cmd.git.clone", autospec=True, return_value=0) m_fetch = mocker.patch("stubber.commands.clone_cmd.git.fetch", autospec=True, return_value=0) - m_switch = mocker.patch("stubber.commands.clone_cmd.git.switch_branch", autospec=True, return_value=0) - m_checkout = mocker.patch("stubber.commands.clone_cmd.git.checkout_tag", autospec=True, return_value=0) - m_get_l_tag = mocker.patch("stubber.commands.clone_cmd.git.get_local_tag", autospec=True, return_value="v1.42") + m_switch = mocker.patch( + "stubber.commands.clone_cmd.git.switch_branch", autospec=True, return_value=0 + ) + m_checkout = mocker.patch( + "stubber.commands.clone_cmd.git.checkout_tag", autospec=True, return_value=0 + ) + m_get_l_tag = mocker.patch( + "stubber.commands.clone_cmd.git.get_local_tag", autospec=True, return_value="v1.42" + ) m_match = mocker.patch("stubber.utils.repos.match_lib_with_mpy", autospec=True) @@ -204,7 +218,9 @@ def test_cmd_stub(mocker: MockerFixture): m_generate.assert_called_once_with(Path(".")) m_postprocessing.assert_called_once() - m_postprocessing.assert_called_once_with([Path(".")], stubgen=False, black=True, autoflake=False) + m_postprocessing.assert_called_once_with( + [Path(".")], stubgen=False, black=True, autoflake=False + ) assert result.exit_code == 0 @@ -216,13 +232,17 @@ def test_cmd_get_frozen(mocker: MockerFixture, tmp_path: Path): # check basic command line sanity check runner = CliRunner() - m_get_local_tag = mocker.patch("stubber.basicgit.get_local_tag", autospec=True, return_value="v1.42") + m_get_local_tag = mocker.patch( + "stubber.basicgit.get_local_tag", autospec=True, return_value="v1.42" + ) m_freeze_any = mocker.patch("stubber.commands.get_frozen_cmd.freeze_any", autospec=True) m_post = mocker.patch("stubber.utils.do_post_processing", autospec=True) # fake run - need to ensure that there is a destination folder - result = runner.invoke(stubber.stubber_cli, ["get-frozen", "--stub-folder", tmp_path.as_posix()]) + result = runner.invoke( + stubber.stubber_cli, ["get-frozen", "--stub-folder", tmp_path.as_posix()] + ) assert result.exit_code == 0 # FIXME : test fails in CI m_freeze_any.assert_called_once() @@ -243,8 +263,6 @@ def test_cmd_get_frozen(mocker: MockerFixture, tmp_path: Path): # ) - - ########################################################################################## # get-core ########################################################################################## @@ -278,13 +296,17 @@ def test_cmd_get_docstubs(mocker: MockerFixture, tmp_path: Path): # check basic command line sanity check runner = CliRunner() - m_get_l_tag = mocker.patch("stubber.basicgit.get_local_tag", autospec=True, return_value="v1.42") + m_get_l_tag = mocker.patch( + "stubber.basicgit.get_local_tag", autospec=True, return_value="v1.42" + ) # from stubber.commands.get_docstubs import generate_from_rst m_generate = mocker.patch("stubber.commands.get_docstubs_cmd.generate_from_rst", autospec=True) # fake run - result = runner.invoke(stubber.stubber_cli, ["get-docstubs", "--stub-folder", tmp_path.as_posix()]) + result = runner.invoke( + stubber.stubber_cli, ["get-docstubs", "--stub-folder", tmp_path.as_posix()] + ) assert result.exit_code == 0 # process is called assert m_generate.call_count == 1 @@ -292,14 +314,13 @@ def test_cmd_get_docstubs(mocker: MockerFixture, tmp_path: Path): assert m_get_l_tag.call_count >= 1 - ########################################################################################## # merge ########################################################################################## @pytest.mark.parametrize( "cmdline", [ - ["merge", "-V", "1.18", "-V", "1.19"], + ["merge", "-v", "1.18", "-v", "1.19"], ["merge", "--version", "latest"], ], ) @@ -307,7 +328,9 @@ def test_cmd_get_docstubs(mocker: MockerFixture, tmp_path: Path): def test_cmd_merge(mocker: MockerFixture, cmdline: List[str]): runner = CliRunner() # from stubber.commands.clone import git - m_merge_docstubs = mocker.patch("stubber.commands.merge_cmd.merge_all_docstubs", autospec=True, return_value={}) + m_merge_docstubs = mocker.patch( + "stubber.commands.merge_cmd.merge_all_docstubs", autospec=True, return_value={} + ) result = runner.invoke(stubber.stubber_cli, cmdline) assert result.exit_code == 0 m_merge_docstubs.assert_called_once() @@ -327,7 +350,9 @@ def test_cmd_merge(mocker: MockerFixture, cmdline: List[str]): def test_cmd_publish(mocker: MockerFixture, cmdline: List[str]): runner = CliRunner() # from stubber.commands.clone import git - m_publish_multiple = mocker.patch("stubber.commands.publish_cmd.publish_multiple", autospec=True, return_value={}) + m_publish_multiple = mocker.patch( + "stubber.commands.publish_cmd.publish_multiple", autospec=True, return_value={} + ) result = runner.invoke(stubber.stubber_cli, cmdline) assert result.exit_code == 0 m_publish_multiple.assert_called_once() From 189bf9046eb767897af9fa634052fc4b1ef74241 Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Sun, 30 Jun 2024 22:48:53 +0200 Subject: [PATCH 8/8] security: update dependencies Signed-off-by: Jos Verlinde --- poetry.lock | 16 ++++++++-------- pyproject.toml | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/poetry.lock b/poetry.lock index ab7a6463..0dcf1d33 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2510,13 +2510,13 @@ files = [ [[package]] name = "requests" -version = "2.31.0" +version = "2.32.3" description = "Python HTTP for Humans." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"}, - {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"}, + {file = "requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6"}, + {file = "requests-2.32.3.tar.gz", hash = "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760"}, ] [package.dependencies] @@ -3003,13 +3003,13 @@ test = ["codecov", "coverage", "mypy", "nptyping (>=1.3.0)", "numpy", "pycodesty [[package]] name = "urllib3" -version = "2.2.1" +version = "2.2.2" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.8" files = [ - {file = "urllib3-2.2.1-py3-none-any.whl", hash = "sha256:450b20ec296a467077128bff42b73080516e71b56ff59a60a02bef2232c4fa9d"}, - {file = "urllib3-2.2.1.tar.gz", hash = "sha256:d0570876c61ab9e520d776c38acbbb5b05a776d3f9ff98a5c8fd5162a444cf19"}, + {file = "urllib3-2.2.2-py3-none-any.whl", hash = "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472"}, + {file = "urllib3-2.2.2.tar.gz", hash = "sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168"}, ] [package.extras] @@ -3165,4 +3165,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0" -content-hash = "efdbffc3aeb014f615741b18646f6bb246d6c92246c74dc4eedb66e48fe638eb" +content-hash = "a5a9ba3a979964a570f07d367cdf43269ed50c70773099a67f5f4b0ec88e076b" diff --git a/pyproject.toml b/pyproject.toml index 3e0a236b..3f456475 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,7 @@ stubber = "stubber.stubber:stubber_cli" [tool.poetry.dependencies] python = ">=3.9,<4.0" python-minifier = { version = "^2.7.0", python = "<3.12" } # no support for 3.12 yet -requests = "^2.28.0" +requests = "^2.32.3" mypy = "1.9.0" mpflash = "^0.9.0" mpremote = "^1.23.0" @@ -74,6 +74,7 @@ tenacity = "^8.2.2" tomli = { version = "^2.0.1", python = "<3.11" } tomli-w = "^1.0.0" typed-config = "^1.3.0" +urllib3 = "^2.2.2" [tool.poetry.group.docs] optional = true