Skip to content

Commit bb18724

Browse files
committed
Improvements to template pyproject.toml
1 parent ab7094b commit bb18724

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

template/pyproject.toml.jinja

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,29 @@ dynamic = ["version"]
1717
license.file = "LICENSE"
1818
readme = "README.md"
1919
requires-python = ">=3.10"
20-
21-
[project.optional-dependencies]
22-
dev = [
20+
optional-dependencies = { dev = [
21+
"build",
2322
"copier",
2423
{% if type_checker=="mypy" %}"mypy",
2524
{% endif %}{% if sphinx %}"myst-parser",
2625
{% endif %}"pipdeptree",
2726
"pre-commit",
2827
{% if sphinx %}"pydata-sphinx-theme>=0.12",
29-
{% endif %} {% if type_checker=="pyright" %}"pyright",
28+
{% endif %}{% if type_checker=="pyright" %}"pyright",
3029
{% endif %}"pytest>8.3.4",
3130
"pytest-cov",
3231
"ruff",
3332
{% if sphinx %}"sphinx-autobuild",
3433
"sphinx-copybutton",
3534
"sphinx-design",
3635
{% endif %}"tox-uv",
36+
"twine",
3737
"types-mock",
38-
]
39-
40-
[project.scripts]
41-
{{ repo_name }} = "{{ package_name }}.__main__:main"
42-
43-
[project.urls]
44-
GitHub = "{{ repo_url }}"
45-
46-
[[project.authors]] # Further authors may be added by duplicating this section
47-
email = "{{ author_email }}"
48-
name = "{{ author_name }}"
38+
] }
39+
scripts = { {{ repo_name }} = "{{ package_name }}.__main__:main" }
40+
urls = { GitHub = "{{ repo_url }}" }
41+
# Further authors may be added by appending to this list
42+
authors = [ { email = "{{ author_email }}", name = "{{ author_name }}" } ]
4943

5044

5145
[tool.setuptools_scm]
@@ -79,10 +73,17 @@ source = ["src", "**/site-packages/"]
7973

8074
[tool.tox]
8175
skipsdist = true
76+
requires = ["tox-uv>=1.25.0"]
77+
# envs to runs automatically with tox -p
78+
env_list = ["pre-commit", "type-checking", "docs"] # "tests"]
79+
80+
[tool.tox.env]
81+
passenv = { "*" = "" }
82+
# Include setuptools, pip, ... in the tox envs
83+
uv_seed = { enabled = true }
8284

8385
[tool.tox.env.pre-commit]
8486
description = "Run pre-commit"
85-
direct = true
8687
allowlist_externals = ["pre-commit"]
8788
commands = [
8889
[
@@ -96,13 +97,13 @@ commands = [
9697

9798
[tool.tox.env.type-checking]
9899
description = "Run type-checking"
99-
direct = true
100100
allowlist_externals = ["{{ type_checker }}"]
101+
# needed otherwise throws reportUnknownMemberType errors
102+
deps = ["pytest"]
101103
commands = [["{{ type_checker }}", "src", "{posargs}"]]
102104

103105
[tool.tox.env.tests]
104106
description = "Run tests"
105-
direct = true
106107
allowlist_externals = ["pytest"]
107108
commands = [
108109
[
@@ -118,16 +119,17 @@ commands = [
118119

119120
{% if sphinx %}[tool.tox.env.docs]
120121
description = "Run docs"
121-
direct = true
122122
allowlist_externals = ["sphinx-build", "sphinx-autobuild"]
123123
commands = [
124124
[
125-
"sphinx-{posargs:build}",
126-
"-EW",
127-
"--keep-going",
125+
"sphinx-build",
128126
"-T",
129127
"docs",
130128
"build/html",
129+
{ replace = "posargs", default = [
130+
"-EW",
131+
"--keep-going",
132+
], extend = true },
131133
],
132134
]
133135
{% endif %}

0 commit comments

Comments
 (0)