Skip to content

Commit a293b6f

Browse files
committed
Test pre-release dependencies
1 parent 5ee89c5 commit a293b6f

1 file changed

Lines changed: 36 additions & 30 deletions

File tree

{{cookiecutter.project_name}}/pyproject.toml

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
22
build-backend = "hatchling.build"
3-
requires = [ "hatchling" ]
3+
requires = ["hatchling"]
44

55
[project]
66
name = "{{ cookiecutter.project_name }}"
@@ -11,9 +11,7 @@ license = { file = "LICENSE" }
1111
maintainers = [
1212
{ name = "{{ cookiecutter.author_full_name }}", email = "{{ cookiecutter.author_email }}" },
1313
]
14-
authors = [
15-
{ name = "{{ cookiecutter.author_full_name }}" },
16-
]
14+
authors = [{ name = "{{ cookiecutter.author_full_name }}" }]
1715
requires-python = ">=3.10"
1816
classifiers = [
1917
"Programming Language :: Python :: 3 :: Only",
@@ -27,10 +25,7 @@ dependencies = [
2725
# for debug logging (referenced from the issue template)
2826
"session-info2",
2927
]
30-
optional-dependencies.dev = [
31-
"pre-commit",
32-
"twine>=4.0.2",
33-
]
28+
optional-dependencies.dev = ["pre-commit", "twine>=4.0.2"]
3429
optional-dependencies.doc = [
3530
"docutils>=0.8,!=0.18.*,!=0.19.*",
3631
"ipykernel",
@@ -47,40 +42,53 @@ optional-dependencies.doc = [
4742
"sphinxcontrib-bibtex>=1",
4843
"sphinxext-opengraph",
4944
]
50-
optional-dependencies.test = [
51-
"coverage",
52-
"pytest",
53-
]
45+
optional-dependencies.test = ["coverage", "pytest"]
46+
47+
48+
49+
{% if cookiecutter.project_name.lower().replace("-", "_") != cookiecutter.package_name -%}
5450
# https://docs.pypi.org/project_metadata/#project-urls
5551
urls.Documentation = "https://{{ cookiecutter.project_name }}.readthedocs.io/"
5652
urls.Homepage = "https://github.com/{{ cookiecutter.github_user }}/{{ cookiecutter.github_repo }}"
5753
urls.Source = "https://github.com/{{ cookiecutter.github_user }}/{{ cookiecutter.github_repo }}"
58-
59-
{% if cookiecutter.project_name.lower().replace("-", "_") != cookiecutter.package_name -%}
6054
[tool.hatch.build.targets.wheel]
61-
packages = [ "src/{{ cookiecutter.package_name }}" ]
55+
6256

6357
{% endif -%}
6458

59+
packages = ["src/{{ cookiecutter.package_name }}"]
6560
[tool.hatch.envs.default]
6661
installer = "uv"
67-
features = [ "dev" ]
62+
features = ["dev"]
6863

6964
[tool.hatch.envs.docs]
70-
features = [ "doc" ]
65+
features = ["doc"]
7166
scripts.build = "sphinx-build -M html docs docs/_build {args}"
7267
scripts.open = "python -m webbrowser -t docs/_build/html/index.html"
7368
scripts.clean = "git clean -fdX -- {args:docs}"
7469

75-
[[tool.hatch.envs.hatch-test.matrix]]
76-
python = [ "3.10", "3.13" ]
7770
[tool.hatch.envs.hatch-test]
78-
features = [ "test" ]
71+
features = ["test"]
72+
73+
[[tool.hatch.envs.hatch-test.matrix]]
74+
deps = ["stable"]
75+
python = ["3.10", "3.13"]
76+
77+
[[tool.hatch.envs.hatch-test.matrix]]
78+
deps = ["stable", "pre"]
79+
python = ["3.13"]
80+
81+
[tool.hatch.envs.hatch-test.overrides]
82+
matrix.deps.env-vars = [
83+
{ key = "UV_PRERELEASE", value = "allow", if = [
84+
"pre",
85+
] },
86+
]
7987

8088
[tool.ruff]
8189
line-length = 120
82-
src = [ "src" ]
83-
extend-include = [ "*.ipynb" ]
90+
src = ["src"]
91+
extend-include = ["*.ipynb"]
8492

8593
format.docstring-code-format = true
8694

@@ -112,23 +120,21 @@ lint.ignore = [
112120
"E731", # Do not assign a lambda expression, use a def -> lambda expression assignments are convenient
113121
"E741", # allow I, O, l as variable names -> I is the identity matrix
114122
]
115-
lint.per-file-ignores."*/__init__.py" = [ "F401" ]
116-
lint.per-file-ignores."docs/*" = [ "I" ]
117-
lint.per-file-ignores."tests/*" = [ "D" ]
123+
lint.per-file-ignores."*/__init__.py" = ["F401"]
124+
lint.per-file-ignores."docs/*" = ["I"]
125+
lint.per-file-ignores."tests/*" = ["D"]
118126
lint.pydocstyle.convention = "numpy"
119127

120128
[tool.pytest.ini_options]
121-
testpaths = [ "tests" ]
129+
testpaths = ["tests"]
122130
xfail_strict = true
123131
addopts = [
124132
"--import-mode=importlib", # allow using test files with same name
125133
]
126134

127135
[tool.coverage.run]
128-
source = [ "{{ cookiecutter.package_name }}" ]
129-
omit = [
130-
"**/test_*.py",
131-
]
136+
source = ["{{ cookiecutter.package_name }}"]
137+
omit = ["**/test_*.py"]
132138

133139
[tool.cruft]
134140
skip = [

0 commit comments

Comments
 (0)