Skip to content

Commit a3d4722

Browse files
committed
Move tox configuration to pyproject.toml.
Remove tox.ini and update uv.lock.
1 parent c958461 commit a3d4722

File tree

4 files changed

+524
-319
lines changed

4 files changed

+524
-319
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
.python-version
66
_version.py
77
/packages/
8+
/.vscode/
89

910
# Byte-compiled / optimized / DLL files
1011
__pycache__/

pyproject.toml

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,21 @@ dynamic = ["version"]
2929
mp-image-tool-esp32 = "mp_image_tool_esp32.main:main"
3030

3131
[tool.hatch]
32-
build.targets.wheel.packages = ["src/mp_image_tool_esp32"]
3332
build.hooks.vcs.version-file = "src/mp_image_tool_esp32/_version.py"
33+
build.targets.wheel.packages = ["src/mp_image_tool_esp32"]
3434
version.source = "vcs" # Get the version from git, eg: 0.0.6.dev0+g1234567
35-
# Don't include the local component in the version number:
36-
# - so we can publish to test-pypi without bumping the version tags.
35+
# Drop the local version part (eg: +g1234567) or pypi will reject package
3736
version.raw-options.local_scheme = "no-local-version"
37+
# A manually triggered github release workflow may generate a new tag
38+
# with .devN suffix. We need to tell setuptools_scm to ignore past tags with
39+
# this suffix when calculating the version number else it refuses to
40+
# bump the version number.
41+
version.raw-options.git_describe_command = [
42+
"git", "describe", "--dirty", "--tags", "--long",
43+
"--match", "v*.[0-9]",
44+
"--match", "v*.[0-9][0-9]",
45+
"--match", "v*.[0-9][0-9][0-9]",
46+
]
3847

3948
[tool.uv]
4049
dev-dependencies = [
@@ -43,32 +52,65 @@ dev-dependencies = [
4352
"pyyaml>=6.0.2",
4453
"requests>=2.32.3",
4554
"tox>=4.0.0",
55+
"tox-uv>=0.3.0", # uv support for tox
56+
"pytest-cov>=3.0.0",
4657
# For code type checks: uv run mypy --no-sources mypy src
4758
"mypy>=0.910",
4859
"types-requests>=2.32.0.20240914",
4960
"types-pyserial>=3.5",
5061
# For linting: uv run --no-sources ruff format --check src
5162
"ruff>=0.6.7",
52-
# For publishing locally: uv publish --keyring-provider=subprocess --username=__token__
5363
"keyring>=25", # For uv publish --keyring-provider=subprocess
5464
# Used by .git/hooks/post-{commit,checkout} to update _version.py:
5565
# uv run --frozen hatch build --hooks-only
5666
"hatch>=1.12.0",
67+
"hatch-vcs>=0.3.0", # For building and updating _version.py
5768
]
5869

5970
[tool.uv.sources]
6071
# Use a local copy of littlefs-python for development
6172
# Use --no-sources at build time to ignore when building the wheel
6273
littlefs-python = { path = "packages/littlefs-python", editable = true }
6374

75+
[tool.tox] # https://tox.wiki/en/latest/config.html#pyproject-toml-native
76+
env_list = [
77+
"clean", "mypy", "lint", "format",
78+
"3.8", "3.9", "3.10", "3.11", "3.12", "3.13"
79+
]
80+
requires = ["tox>=4.19", "tox-uv>=1.13"]
81+
env.clean.commands = [["coverage", "erase"]] # Cleanup coverage data
82+
env.clean.deps = ["coverage"]
83+
env.clean.skip_install = true
84+
env.mypy.commands = [["mypy"]]
85+
env.mypy.deps = ["mypy", "pytest", "types-requests", "types-pyserial"]
86+
env.lint.commands = [["ruff", "check"]]
87+
env.lint.deps = ["ruff"]
88+
env.format.commands = [["ruff", "format", "--check"]]
89+
env.format.deps = ["ruff"]
90+
env_run_base.commands = [["pytest"]]
91+
env_run_base.deps = ["pytest", "pytest-cov", "requests", "pyyaml"]
92+
env_run_base.package = "editable"
93+
6494
[tool.mypy]
65-
python_version = "3.10"
95+
files = ["src"]
96+
exclude = ["packages"]
97+
python_version = "3.9"
6698
disallow_untyped_defs = true
6799
warn_return_any = true
68100
warn_unused_ignores = true
69-
exclude = ["tests"]
70101
mypy_path = "typings"
71102

72103
[tool.ruff]
104+
include = ["src/**/*.py"]
73105
exclude = ["_version.py"]
74106
lint.extend-select = ["I"] # Enable ruffs isort rules (for compat with vscode ruff)
107+
108+
[tool.pytest.ini_options]
109+
minversion = "6.0"
110+
addopts = ["--cov"]
111+
112+
[tool.coverage]
113+
run.source = ["src"]
114+
run.omit = ["_version.py"]
115+
report.skip_covered = true
116+
append = true

tox.ini

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)