Skip to content

Commit 974ece8

Browse files
authored
Merge pull request #371 from espressif/bump/python-3.10
bump: drop python 3.7, 3.8, 3.9
2 parents 162abd3 + dc35678 commit 974ece8

File tree

45 files changed

+411
-493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+411
-493
lines changed

.github/workflows/test-build-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Python
1616
uses: actions/setup-python@v5
1717
with:
18-
python-version: "3.7"
18+
python-version: "3.10"
1919
- name: Install dependencies
2020
run: |
2121
bash foreach.sh install

.github/workflows/test-python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
strategy:
2222
matrix:
2323
include:
24-
- python-version: "3.7"
24+
- python-version: "3.10"
2525
arch: "ARM64"
2626
- python-version: "3.13"
2727
arch: "X64"

.pre-commit-config.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@ exclude: |
88
99
repos:
1010
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v5.0.0
11+
rev: v6.0.0
1212
hooks:
1313
- id: trailing-whitespace
1414
- id: end-of-file-fixer
1515
- id: mixed-line-ending
1616
args: ["-f=lf"]
1717
- repo: https://github.com/astral-sh/ruff-pre-commit
18-
rev: "v0.11.6"
18+
rev: "v0.12.12"
1919
hooks:
20-
- id: ruff
20+
- id: ruff-check
2121
args: ["--fix"]
2222
- id: ruff-format
23-
args: ["--preview"]
2423

2524
# documentation
2625
- repo: https://github.com/sphinx-contrib/sphinx-lint

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# CHANGELOG
22

3+
## v2.0.0 (TBD)
4+
5+
### Breaking Changes
6+
7+
- **Python Support**: Drop support for Python 3.7, 3.8, 3.9. Now requires Python 3.10+
8+
- **esptool**: Update esptool requirement to >=5.1.dev1,<6 (from ~=4.9)
9+
- **Deprecated Code Removal**:
10+
- Remove `EsptoolArgs` class from `pytest-embedded-serial-esp`
11+
- Remove deprecated parameters `hard_reset_after` and `no_stub` from `use_esptool()` decorator
12+
- Remove deprecated `stub` property from `EspSerial` class (use `esp` instead)
13+
- Remove deprecated `parse_test_menu()` and `parse_unity_menu_from_str()` methods from `IdfUnityDutMixin` (use `test_menu` property instead)
14+
- Remove deprecated CLI option `--add-target-as-marker` (use `--add-target-as-marker-with-amount` instead)
15+
16+
### Migration Guide
17+
18+
1. **Python Version**: Upgrade to Python 3.10 or higher
19+
2. **esptool**: Update esptool to version 5.1.dev1 or higher (but less than 6.0)
20+
3. **Code Changes**:
21+
- Replace `dut.stub` with `dut.esp`
22+
- Replace `dut.parse_test_menu()` calls with `dut.test_menu` property access
23+
- Replace `parse_unity_menu_from_str()` with `_parse_unity_menu_from_str()` if needed. `dut.test_menu` is preferred.
24+
- Update CLI usage from `--add-target-as-marker` to `--add-target-as-marker-with-amount`
25+
- Remove any usage of `EsptoolArgs` class
26+
- Remove `hard_reset_after` and `no_stub` parameters from `use_esptool()` calls
27+
328
## v1.17.0a0 (2025-08-07)
429

530
### Feat

conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import shutil
33
import sys
44
import textwrap
5-
from typing import List, Pattern
5+
from re import Pattern
66

77
import pytest
88
from _pytest.config import Config
@@ -59,7 +59,7 @@ def cache_file_remove(cache_dir):
5959

6060
@pytest.fixture
6161
def first_index_of_messages():
62-
def _fake(_pattern: Pattern, _messages: List[str], _start: int = 0) -> int:
62+
def _fake(_pattern: Pattern, _messages: list[str], _start: int = 0) -> int:
6363
for i, _message in enumerate(_messages):
6464
if _pattern.match(_message) and i >= _start:
6565
return i

pytest-embedded-arduino/pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ classifiers = [
1818
"Operating System :: OS Independent",
1919
"Programming Language :: Python :: 3 :: Only",
2020
"Programming Language :: Python :: 3",
21-
"Programming Language :: Python :: 3.7",
22-
"Programming Language :: Python :: 3.8",
23-
"Programming Language :: Python :: 3.9",
2421
"Programming Language :: Python :: 3.10",
2522
"Programming Language :: Python :: 3.11",
2623
"Programming Language :: Python :: 3.12",
@@ -29,7 +26,7 @@ classifiers = [
2926
"Topic :: Software Development :: Testing",
3027
]
3128
dynamic = ["version", "description"]
32-
requires-python = ">=3.7"
29+
requires-python = ">=3.10"
3330

3431
dependencies = [
3532
"pytest-embedded~=1.17.0a2",

pytest-embedded-arduino/pytest_embedded_arduino/app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import json
22
import os
3-
from typing import ClassVar, Dict, List, Tuple
3+
from typing import ClassVar
44

55
from pytest_embedded.app import App
66

@@ -17,7 +17,7 @@ class ArduinoApp(App):
1717
"""
1818

1919
#: dict of flash settings
20-
flash_settings: ClassVar[Dict[str, Dict[str, str]]] = {
20+
flash_settings: ClassVar[dict[str, dict[str, str]]] = {
2121
'esp32': {'flash_mode': 'dio', 'flash_size': 'detect', 'flash_freq': '80m'},
2222
'esp32s2': {'flash_mode': 'dio', 'flash_size': 'detect', 'flash_freq': '80m'},
2323
'esp32c3': {'flash_mode': 'dio', 'flash_size': 'detect', 'flash_freq': '80m'},
@@ -28,7 +28,7 @@ class ArduinoApp(App):
2828
}
2929

3030
#: dict of binaries' offset.
31-
binary_offsets: ClassVar[Dict[str, List[int]]] = {
31+
binary_offsets: ClassVar[dict[str, list[int]]] = {
3232
'esp32': [0x1000, 0x8000, 0x10000],
3333
'esp32s2': [0x1000, 0x8000, 0x10000],
3434
'esp32c3': [0x0, 0x8000, 0x10000],
@@ -57,7 +57,7 @@ def _get_fqbn(self, build_path) -> str:
5757
fqbn = options['fqbn']
5858
return fqbn
5959

60-
def _get_bin_files(self, build_path, sketch, target) -> List[Tuple[int, str, bool]]:
60+
def _get_bin_files(self, build_path, sketch, target) -> list[tuple[int, str, bool]]:
6161
bootloader = os.path.realpath(os.path.join(build_path, sketch + '.ino.bootloader.bin'))
6262
partitions = os.path.realpath(os.path.join(build_path, sketch + '.ino.partitions.bin'))
6363
app = os.path.realpath(os.path.join(build_path, sketch + '.ino.bin'))

pytest-embedded-arduino/pytest_embedded_arduino/serial.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import logging
2-
from typing import Optional
32

43
import esptool
54
from pytest_embedded_serial_esp.serial import EspSerial
@@ -19,7 +18,7 @@ class ArduinoSerial(EspSerial):
1918
def __init__(
2019
self,
2120
app: ArduinoApp,
22-
target: Optional[str] = None,
21+
target: str | None = None,
2322
**kwargs,
2423
) -> None:
2524
self.app = app

pytest-embedded-idf/pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ classifiers = [
1717
"Operating System :: OS Independent",
1818
"Programming Language :: Python :: 3 :: Only",
1919
"Programming Language :: Python :: 3",
20-
"Programming Language :: Python :: 3.7",
21-
"Programming Language :: Python :: 3.8",
22-
"Programming Language :: Python :: 3.9",
2320
"Programming Language :: Python :: 3.10",
2421
"Programming Language :: Python :: 3.11",
2522
"Programming Language :: Python :: 3.12",
@@ -28,7 +25,7 @@ classifiers = [
2825
"Topic :: Software Development :: Testing",
2926
]
3027
dynamic = ["version", "description"]
31-
requires-python = ">=3.7"
28+
requires-python = ">=3.10"
3229

3330
dependencies = [
3431
"pytest-embedded~=1.17.0a2",

pytest-embedded-idf/pytest_embedded_idf/app.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import shlex
55
import subprocess
66
import sys
7-
from typing import Any, ClassVar, Dict, List, NamedTuple, Optional, Tuple
7+
from typing import Any, ClassVar, NamedTuple
88

99
from pytest_embedded.app import App
1010

@@ -26,8 +26,8 @@ class IdfApp(App):
2626
flash_settings (dict[str, Any]): dict of flash settings
2727
"""
2828

29-
XTENSA_TARGETS: ClassVar[List[str]] = ['esp32', 'esp32s2', 'esp32s3']
30-
RISCV32_TARGETS: ClassVar[List[str]] = [
29+
XTENSA_TARGETS: ClassVar[list[str]] = ['esp32', 'esp32s2', 'esp32s3']
30+
RISCV32_TARGETS: ClassVar[list[str]] = [
3131
'esp32c3',
3232
'esp32c2',
3333
'esp32c6',
@@ -44,7 +44,7 @@ class IdfApp(App):
4444
def __init__(
4545
self,
4646
*args,
47-
part_tool: Optional[str] = None,
47+
part_tool: str | None = None,
4848
**kwargs,
4949
):
5050
super().__init__(*args, **kwargs)
@@ -95,7 +95,7 @@ def parttool_path(self) -> str:
9595
raise ValueError('Partition Tool not found. (Default: $IDF_PATH/components/partition_table/gen_esp32part.py)')
9696

9797
@property
98-
def sdkconfig(self) -> Dict[str, Any]:
98+
def sdkconfig(self) -> dict[str, Any]:
9999
"""
100100
Returns:
101101
dict contains all k-v pairs from the sdkconfig file
@@ -143,7 +143,7 @@ def is_xtensa(self):
143143
return False
144144

145145
@property
146-
def partition_table(self) -> Dict[str, Any]:
146+
def partition_table(self) -> dict[str, Any]:
147147
"""
148148
Returns:
149149
partition table dict generated by the partition tool
@@ -187,14 +187,14 @@ def partition_table(self) -> Dict[str, Any]:
187187
self._partition_table = partition_table
188188
return self._partition_table
189189

190-
def _get_elf_file(self) -> Optional[str]:
190+
def _get_elf_file(self) -> str | None:
191191
for fn in os.listdir(self.binary_path):
192192
if os.path.splitext(fn)[-1] == '.elf':
193193
return os.path.realpath(os.path.join(self.binary_path, fn))
194194

195195
return None
196196

197-
def _get_bin_file(self) -> Optional[str]:
197+
def _get_bin_file(self) -> str | None:
198198
for fn in os.listdir(self.binary_path):
199199
if os.path.splitext(fn)[-1] == '.bin':
200200
return os.path.realpath(os.path.join(self.binary_path, fn))
@@ -229,7 +229,7 @@ def write_flash_args(self):
229229

230230
def _parse_flash_args_json(
231231
self,
232-
) -> Tuple[Dict[str, Any], List[FlashFile], Dict[str, str]]:
232+
) -> tuple[dict[str, Any], list[FlashFile], dict[str, str]]:
233233
flash_args_json_filepath = None
234234
for fn in os.listdir(self.binary_path):
235235
if fn == self.FLASH_ARGS_JSON_FILENAME:
@@ -242,7 +242,7 @@ def _parse_flash_args_json(
242242
with open(flash_args_json_filepath) as fr:
243243
flash_args = json.load(fr)
244244

245-
def _is_encrypted(_flash_args: Dict[str, Any], _offset: int, _file_path: str):
245+
def _is_encrypted(_flash_args: dict[str, Any], _offset: int, _file_path: str):
246246
for entry in _flash_args.values():
247247
try:
248248
if (entry['offset'], entry['file']) == (_offset, _file_path):
@@ -268,7 +268,7 @@ def _is_encrypted(_flash_args: Dict[str, Any], _offset: int, _file_path: str):
268268

269269
return flash_args, flash_files, flash_settings
270270

271-
def get_sha256(self, filepath: str) -> Optional[str]:
271+
def get_sha256(self, filepath: str) -> str | None:
272272
"""
273273
Get the sha256 of the file
274274

0 commit comments

Comments
 (0)