-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
100 lines (90 loc) · 3.09 KB
/
pyproject.toml
File metadata and controls
100 lines (90 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
[project]
name = "MY_PROJECT_NAME"
description = "MY PROJECT DESCRIPTION."
readme = "README.md"
authors = [{name = "MY_NAME", email = "MY_EMAIL"}]
urls = {Homepage = "https://github.com/MY_NAME/MY_PROJECT_NAME"}
license = {text = "MIT"}
requires-python = ">=3.9"
dependencies = [
"rich>=10.12.0", # For pretty printing: rich.print()
]
dynamic = ["version"]
[project.scripts]
hello = "MY_PROJECT_NAME:main"
[dependency-groups]
typing = [
"mypy>=0.910", # For code type checks: uv run mypy src
"types-pyserial>=3.5", "types-pyyaml>=6.0"
]
test = [
{include-group = "typing"},
"ruff>=0.6.7", # For linting: uv run ruff format --check src
"pytest>=8.3.2", # For running tests: pytest, tox
"pytest-cov>=3.0.0",
"tox>=4.22", # For running tests: uv run tox
"tox-uv>=1.13", # uv support for tox
"tox_gh>=1.5", # For running github actions: uv run tox-gh
]
dev = [
{include-group = "test"},
"hatch>=1.12", # For building package
"hatch-vcs>=0.3.0", # For building and updating _version.py
]
[build-system]
requires = ["hatchling>=1.24", "hatch-vcs>=0.3"]
build-backend = "hatchling.build"
[tool.hatch]
build.hooks.vcs.version-file = "src/MY_PROJECT_NAME/_version.py"
version.source = "vcs" # Get the version from git, eg: 0.0.6.dev0+g1234567
# Drop the local version part (eg: +g1234567) or pypi will reject package
version.raw-options.local_scheme = "no-local-version"
# A manually triggered github release workflow may generate a new tag
# with .devN suffix. We need to tell setuptools_scm to ignore past tags with
# this suffix when calculating the version number else it refuses to
# bump the version number.
version.raw-options.git_describe_command = [
"git", "describe", "--dirty", "--tags", "--long",
"--match", "v*.[0-9]",
"--match", "v*.[0-9][0-9]",
"--match", "v*.[0-9][0-9][0-9]",
]
# https://tox.wiki/en/latest/config.html#pyproject-toml-native
[tool.tox]
env_list = [
"clean", "typing", "lint", "format",
"3.9", "3.10", "3.11", "3.12", "3.13"
]
env.clean.commands = [["coverage", "erase"]] # Reset the coverage data at start
env.clean.skip_install = true
env.typing.commands = [["mypy"]]
env.lint.commands = [["ruff", "check"]]
env.format.commands = [["ruff", "format", "--check"]]
env_run_base.commands = [["pytest", {replace = "posargs", extend = true}]]
env_run_base.dependency_groups = ["test"]
# For Github Actions workflow - see https://github.com/tox-dev/tox-gh
[tool.tox.gh.python]
# Perform static code checks only for the latest python version
"3.13" = ["clean", "typing", "lint", "format", "3.13"]
"3.12" = ["3.12"]
"3.11" = ["3.11"]
"3.10" = ["3.10"]
"3.9" = ["3.9"]
[tool.mypy]
files = ["src", "tests"]
python_version = "3.9"
disallow_untyped_defs = true
warn_return_any = true
warn_unused_ignores = true
mypy_path = "typings"
[tool.ruff]
exclude = ["_version.py"]
lint.extend-select = ["I"] # Enable ruffs isort rules (for compat with vscode ruff)
[tool.pytest.ini_options]
minversion = "6.0"
addopts = ["--cov"]
[tool.coverage]
run.source = ["src", "tests"]
run.omit = ["_version.py"]
report.skip_covered = true
append = true