@@ -16,11 +16,15 @@ license = { file = "LICENSE" }
1616readme = " README.md"
1717requires-python = " >=3.12,<4.0"
1818dependencies = [" pyyaml>=6.0.2" ]
19- optional-dependencies = { dev = [
20- " pdm>=2.22.3" ,
19+ scripts = { phoebus-guibuilder = " phoebus_guibuilder.__main__:main" }
20+
21+ [dependency-groups ]
22+ dev = [
23+ " basedpyright>=1.27.1" ,
24+ " hatch>=1.14.0" ,
25+ " hatch-vcs" ,
2126 " pre-commit" ,
2227 " pydata-sphinx-theme>=0.12" ,
23- " pyright" ,
2428 " pytest>=8.3.4" ,
2529 " pytest-asyncio" ,
2630 " pytest-cov" ,
@@ -29,31 +33,40 @@ optional-dependencies = { dev = [
2933 " pytest-rerunfailures" ,
3034 " pytest-timeout" ,
3135 " ruff" ,
32- " sphinx<8.2.0 " ,
36+ " sphinx" ,
3337 " sphinx-autobuild" ,
3438 " autodoc-pydantic" ,
3539 " sphinxcontrib-mermaid" ,
3640 " sphinx-copybutton" ,
3741 " sphinx-design" ,
38- " tox>=4.22" ,
3942 " types-mock" ,
4043 " types-pyyaml" ,
41- ] }
42- scripts = { phoebus-guibuilder = " phoebus_guibuilder.__main__:main" }
44+ ]
4345
4446[build-system ]
45- requires = [" pdm-backend" ]
46- build-backend = " pdm.backend"
47+ requires = [" hatchling" , " hatch-vcs" ]
48+ build-backend = " hatchling.build"
49+
50+ [tool .uv ]
51+ default-groups = []
4752
48- [tool .pdm .version ]
49- fallback_version = " 0.0.0"
50- source = " scm"
51- tag_filter = " *"
53+ [tool .hatch .version ]
54+ source = " vcs"
55+ fallback-version = " 0.1.0"
5256# allows for tags with the format 0.1.0a1
53- tag_regex = " (?P<version>([1-9][0-9]*!)?(0|[1-9][0-9]*)(\\ .(0|[1-9][0-9]*))*((a|b|c|rc)(0|[1-9][0-9]*))?)"
57+ tag-pattern = " (?P<version>([1-9][0-9]*!)?(0|[1-9][0-9]*)(\\ .(0|[1-9][0-9]*))*((a|b|c|rc)(0|[1-9][0-9]*))?)"
5458# version_format = "phoebus_guibuiler.version:format_version"
55- write_to = " phoebus_guibuilder/_version.py"
56- write_template = " __version__ = '{}'\n "
59+ raw-options = { version_scheme = " only-version" , local_scheme = " dirty-tag" }
60+
61+ [tool .hatch .build .hooks .vcs ]
62+ version-file = " src/phoebus_guibuilder/_version.py"
63+ template = '''
64+ # This file is automatically generated by Hatch
65+ # Do not modify this file directly
66+
67+ __version__ = "{version}"
68+ version_tuple = {version_tuple}
69+ '''
5770
5871[tool .pyright ]
5972typeCheckingMode = " standard"
@@ -87,59 +100,35 @@ data_file = "/tmp/phoebus_guibuilder.coverage"
87100# Tests are run from installed location, map back to the src directory
88101source = [" src" , " **/site-packages/" ]
89102
90- [tool .tox ]
91- skipsdist = true
103+ [tool .hatch .envs .default .scripts ]
104+ all = [
105+ " hatch run precommit:precommit" ,
106+ " hatch run type-check:type-check" ,
107+ " hatch run tests:tests" ,
108+ # "hatch run docs:docs"
109+ ]
110+ precommit = [" hatch run precommit:precommit" ]
111+ type-check = [" hatch run type-check:type-check" ]
112+ tests = [" hatch run tests:tests" ]
113+ docs = [" hatch run docs:docs" ]
92114
93- [tool .tox . env . pre-commit ]
115+ [tool .hatch . envs . precommit ]
94116description = " Run pre-commit"
95- direct = true
96- allowlist_externals = [" pre-commit" ]
97- commands = [
98- [
99- " pre-commit" ,
100- " run" ,
101- # "--all-files",
102- " --show-diff-on-failure" ,
103- " {posargs}" ,
104- ],
105- ]
117+ scripts = { precommit = [" pre-commit run --show-diff-on-failure {args}" ] }
106118
107- [tool .tox . env .type-checking ]
119+ [tool .hatch . envs .type-check ]
108120description = " Run type-checking"
109- direct = true
110- allowlist_externals = [" pyright" ]
111- commands = [[" pyright" , " src" , " {posargs}" ]]
121+ scripts = { type-check = [" basedpyright --stats src {args}" ] }
112122
113- [tool .tox . env .tests ]
123+ [tool .hatch . envs .tests ]
114124description = " Run tests"
115- direct = true
116- allowlist_externals = [" pytest" ]
117- commands = [
118- [
119- " pytest" ,
120- " --cov=phoebus_guibuilder" ,
121- " --cov-report" ,
122- " term" ,
123- " --cov-report" ,
124- " xml:cov.xml" ,
125- " {posargs}" ,
126- ],
127- ]
125+ scripts = { tests = [
126+ " pytest --cov=phoebus_guibuilder --cov-report term --cov-report xml:cov.xml {args}" ,
127+ ] }
128128
129- [tool .tox . env .docs ]
129+ [tool .hatch . envs .docs ]
130130description = " Run docs"
131- direct = true
132- allowlist_externals = [" sphinx-build" , " sphinx-autobuild" ]
133- commands = [
134- [
135- " sphinx-{posargs:build}" ,
136- " -EW" ,
137- " --keep-going" ,
138- " -T" ,
139- " docs" ,
140- " build/html" ,
141- ],
142- ]
131+ scripts = { docs = [" sphinx-{args:build} -EW --keep-going -T docs build/html" ] }
143132
144133[tool .ruff ]
145134src = [" src" , " tests" , " system_tests" ]
@@ -160,3 +149,4 @@ lint.select = [
160149# See https://github.com/DiamondLightSource/python-copier-template/issues/154
161150# Remove this line to forbid private member access in tests
162151"tests/**/*" = [" SLF001" ]
152+ # dependencies = ["sphinx-build", "sphinx-autobuild"]
0 commit comments