Skip to content

Commit 09b0682

Browse files
authored
build: Change build system to hatchling
This is needed for splitting the project into `griffe` and `griffelib`, managing the two in a monorepo, and having Griffe dependency on `griffelib` be dynamic and pinned to the exact same version, to keep them in sync at all times without manual intervention. PR-430: #430
1 parent 4f60476 commit 09b0682

1 file changed

Lines changed: 18 additions & 12 deletions

File tree

pyproject.toml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[build-system]
2-
requires = ["pdm-backend"]
3-
build-backend = "pdm.backend"
2+
# pdm-backend is left here as a dependency of the version discovery script currently in use.
3+
# It may be removed in the future. See mkdocstrings/griffe#430
4+
requires = ["hatchling", "pdm-backend"]
5+
build-backend = "hatchling.build"
46

57
[project]
68
name = "griffe"
@@ -58,17 +60,22 @@ Funding = "https://github.com/sponsors/pawamoy"
5860
[project.scripts]
5961
griffe = "griffe:main"
6062

61-
[tool.pdm.version]
62-
source = "call"
63-
getter = "scripts.get_version:get_version"
63+
[tool.hatch.version]
64+
source = "code"
65+
path = "scripts/get_version.py"
66+
expression = "get_version()"
6467

65-
[tool.pdm.build]
68+
[tool.hatch.build]
6669
# Include as much as possible in the source distribution, to help redistributors.
67-
excludes = ["**/.pytest_cache", "**/.mypy_cache"]
68-
source-includes = [
70+
ignore-vcs = true
71+
exclude = [".github", ".pdm-build"]
72+
73+
[tool.hatch.build.targets.sdist]
74+
include = [
6975
"config",
7076
"docs",
7177
"scripts",
78+
"src",
7279
"share",
7380
"tests",
7481
"duties.py",
@@ -77,13 +84,12 @@ source-includes = [
7784
"LICENSE",
7885
]
7986

80-
[tool.pdm.build.wheel-data]
87+
[tool.hatch.build.targets.wheel]
8188
# Manual pages can be included in the wheel.
8289
# Depending on the installation tool, they will be accessible to users.
8390
# pipx supports it, uv does not yet, see https://github.com/astral-sh/uv/issues/4731.
84-
data = [
85-
{path = "share/**/*", relative-to = "."},
86-
]
91+
sources = ["src/"]
92+
artifacts = ["share/**/*"]
8793

8894
[dependency-groups]
8995
maintain = [

0 commit comments

Comments
 (0)