1- [build-system ]
2- requires = [" hatchling" , " hatch-vcs" ]
3- build-backend = " hatchling.build"
4-
51[project ]
62name = " mp-image-tool-esp32"
73description = " Tool for manipulating micropython ESP32 firmware files"
@@ -18,7 +14,6 @@ classifiers = [
1814requires-python = " >=3.8"
1915dependencies = [
2016 " esptool>=4.6.2" ,
21- " littlefs-python>=0.12.0" ,
2217 " rich>=10.12.0" ,
2318 " more-itertools>=8.8.0" ,
2419 " typing-extensions>=4.12" ,
@@ -28,10 +23,34 @@ dynamic = ["version"]
2823[project .scripts ] # The entry points for the command line tools
2924mp-image-tool-esp32 = " mp_image_tool_esp32.main:main"
3025
26+ [project .optional-dependencies ]
27+ littlefs = [" littlefs-python>=0.12.0" ]
28+
29+ [dependency-groups ]
30+ typing = [" mypy>=0.910" , " types-requests>=2.32.0.20240914" , " types-pyserial>=3.5" ]
31+ test = [
32+ {include-group = " typing" },
33+ " ruff>=0.6.7" , " pytest>=8.3.2" , " pytest-cov>=3.0.0" , " requests>=2.32.3" ,
34+ " pyyaml>=6.0.2" , " tox>=4.22.0" , " tox-uv>=0.3.0" ,
35+ ]
36+ dev = [
37+ {include-group = " test" },
38+ " keyring>=25" , # For uv publish --keyring-provider=subprocess
39+ # Used by .git/hooks/post-{commit,checkout} to update _version.py:
40+ # uv run --frozen hatch build --hooks-only
41+ " hatch>=1.12.0" ,
42+ " hatch-vcs>=0.3.0" , # For building and updating _version.py
43+ ]
44+
45+ [build-system ]
46+ requires = [" hatchling" , " hatch-vcs" ]
47+ build-backend = " hatchling.build"
48+
49+ # Build python packages and update version number
3150[tool .hatch ]
32- build.hooks.vcs.version-file = " src/mp_image_tool_esp32/_version.py"
3351build.targets.wheel.packages = [" src/mp_image_tool_esp32" ]
3452version.source = " vcs" # Get the version from git, eg: 0.0.6.dev0+g1234567
53+ build.hooks.vcs.version-file = " src/mp_image_tool_esp32/_version.py"
3554# Drop the local version part (eg: +g1234567) or pypi will reject package
3655version.raw-options.local_scheme = " no-local-version"
3756# A manually triggered github release workflow may generate a new tag
@@ -45,45 +64,25 @@ version.raw-options.git_describe_command = [
4564 " --match" , " v*.[0-9][0-9][0-9]" ,
4665]
4766
48- [tool .uv ]
49- dev-dependencies = [
50- # For running tests: pytest, pyyaml, requests, tox, mypy, ruff
51- " pytest>=8.3.2" ,
52- " pyyaml>=6.0.2" ,
53- " requests>=2.32.3" ,
54- " tox>=4.0.0" ,
55- " tox-uv>=0.3.0" , # uv support for tox
56- " pytest-cov>=3.0.0" ,
57- " mypy>=0.910" , # For code type checks: uv run mypy --no-sources mypy src
58- " types-requests>=2.32.0.20240914" ,
59- " types-pyserial>=3.5" ,
60- " ruff>=0.6.7" , # For linting: uv run --no-sources ruff format --check src
61- " keyring>=25" , # For uv publish --keyring-provider=subprocess
62- # Used by .git/hooks/post-{commit,checkout} to update _version.py:
63- # uv run --frozen hatch build --hooks-only
64- " hatch>=1.12.0" ,
65- " hatch-vcs>=0.3.0" , # For building and updating _version.py
66- ]
67-
6867# https://tox.wiki/en/latest/config.html#pyproject-toml-native
69- [tool .tox ] #
68+ [tool .tox ]
69+ requires = [" tox>=4.22" , " tox-uv>=1.13" ]
7070env_list = [
71- " clean" , " mypy " , " lint" , " format" ,
71+ " clean" , " typing " , " lint" , " format" ,
7272 " 3.8" , " 3.9" , " 3.10" , " 3.11" , " 3.12" , " 3.13"
7373]
74- requires = [" tox>=4.19" , " tox-uv>=1.13" ]
7574env.clean.commands = [[" coverage" , " erase" ]] # Cleanup coverage data
76- env.clean.deps = [" coverage" ]
7775env.clean.skip_install = true
78- env.mypy.commands = [[" mypy" ]]
79- env.mypy.deps = [" mypy" , " pytest" , " types-requests" , " types-pyserial" ]
76+ env.typing.commands = [[" mypy" ]]
8077env.lint.commands = [[" ruff" , " check" ]]
81- env.lint.deps = [" ruff" ]
8278env.format.commands = [[" ruff" , " format" , " --check" ]]
83- env.format.deps = [" ruff" ]
79+ env.3.8.commands = [[" pytest" , " --cov=mp_image_tool_esp32" ]]
80+ env.3.13.commands = [[" pytest" , " --cov=mp_image_tool_esp32" ]]
8481env_run_base.commands = [[" pytest" ]]
85- env_run_base.deps = [" pytest" , " pytest-cov" , " requests" , " pyyaml" ]
86- env_run_base.package = " editable"
82+ env_run_base.dependency_groups = [" test" ]
83+ env_run_base.extras = [" littlefs" ] # Include optional dependencies
84+ env_run_base.package = " wheel" # Build package wheel and install into environments
85+ env_run_base.wheel_build_env = " .pkg" # Re-use one wheel for each environment
8786
8887[tool .mypy ]
8988files = [" src" ]
@@ -98,12 +97,7 @@ include = ["src/**/*.py"]
9897exclude = [" _version.py" ]
9998lint.extend-select = [" I" ] # Enable ruffs isort rules (for compat with vscode ruff)
10099
101- [tool .pytest .ini_options ]
102- minversion = " 6.0"
103- addopts = [" --cov" ]
104-
105100[tool .coverage ]
106- run.source = [" src" ]
107101run.omit = [" _version.py" ]
108102report.skip_covered = true
109103append = true
0 commit comments