Skip to content

Commit acb6c0f

Browse files
committed
feat: include multiple backends
1 parent cf9c221 commit acb6c0f

File tree

1 file changed

+57
-7
lines changed

1 file changed

+57
-7
lines changed

pages/developers/pep621.md

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ you select doesn't really matter that much; they all use a standard
1414
configuration language specified in [PEP 621][]. The PyPA's Flit is a great
1515
option. In the future, scikit-build and meson may support this sort of
1616
configuration, enabling binary extension packages to benefit too. These [PEP
17-
621][] tools currently include [Flit][], [PDM][], [Trampolim][], and [Whey][].
18-
[Setuptools][] might gain support in 2022, and [Poetry][] might as well.
17+
621][] tools currently include [Flit][], [Hatch][], [PDM][], [Trampolim][], and
18+
[Whey][]. [Setuptools][] has experimental support, and [Poetry][] might as
19+
well.
1920

2021
> #### Classic files
2122
>
@@ -37,11 +38,41 @@ configuration, enabling binary extension packages to benefit too. These [PEP
3738
Packages must have a `pyproject.toml` file that selects the backend (this one
3839
is for Flit):
3940

41+
<div class="skhep-bar d-flex m-2" style="justify-content:center;">
42+
<button class="skhep-bar-item btn m-2 btn-purple" onclick="openTab('flit')" id='flit-btn'>Flit</button>
43+
<button class="skhep-bar-item btn m-2" onclick="openTab('hatch')" id='hatch-btn'>Hatch</button>
44+
<button class="skhep-bar-item btn m-2" onclick="openTab('pdm')" id='pdm-btn'>PDM</button>
45+
<button class="skhep-bar-item btn m-2" onclick="openTab('setuptools')" id='setuptools-btn'>Setuptools (experimental)</button>
46+
</div>
47+
48+
<div class="skhep-tab" markdown="1" id="flit">
4049
```toml
4150
[build-system]
4251
requires = ["flit_core >=3.2"]
4352
build-backend = "flit_core.buildapi"
4453
```
54+
</div>
55+
<div class="skhep-tab" markdown="1" id="hatch" style="display:none;">
56+
```toml
57+
[build-system]
58+
requires = ["hatchling >=0.7"]
59+
build-backend = "hatchling.build"
60+
```
61+
</div>
62+
<div class="skhep-tab" markdown="1" id="pdm" style="display:none;">
63+
```toml
64+
[build-system]
65+
requires = ["pdm-pep517"]
66+
build-backend = "pdm.pep517.api"
67+
```
68+
</div>
69+
<div class="skhep-tab" markdown="1" id="setuptools" style="display:none;">
70+
```toml
71+
[build-system]
72+
requires = ["setuptools @ git+https://github.com/pypa/setuptools@experimental/support-pyproject"]
73+
build-backend = "setuptools.build_meta"
74+
```
75+
</div>
4576

4677
## pyproject.toml: project
4778

@@ -77,16 +108,17 @@ classifiers = [
77108
]
78109

79110
[project.urls]
80-
Source = "https://github.com/scikit-hep/package"
111+
Homepage = "https://github.com/scikit-hep/package"
81112
Documentation = "https://package.readthedocs.io/"
82113
"Bug Tracker" = "https://github.com/scikit-hep/package/issues"
83114
Discussions = "https://github.com/scikit-hep/package/discussions"
84115
Changelog = "https://package.readthedocs.io/en/latest/changelog.html"
85116
```
86117

87118
You can read more about each field, and all allowed fields, in [PEP 621][],
88-
[Flit](https://flit.readthedocs.io/en/latest/pyproject_toml.html#new-style-metadata) or
89-
[Whey](https://whey.readthedocs.io/en/latest/configuration.html).
119+
[Flit](https://flit.readthedocs.io/en/latest/pyproject_toml.html#new-style-metadata)
120+
or [Whey](https://whey.readthedocs.io/en/latest/configuration.html). Note that
121+
"Homepage" is special, and replaces the old url setting.
90122

91123
## Package structure
92124

@@ -99,8 +131,9 @@ instead of the installed version - this obviously tends to break if you build
99131
parts of the library or if you access package metadata.
100132

101133
This sadly is not part of the standard metadata in `[project]`, so it depends
102-
on what backend you you use. Flit and PDM use automatic detection, while
103-
Trampolim and whey do not, requiring a `tool` setting.
134+
on what backend you you use. Flit, Hatch, PDM, and (experimental) setuptools
135+
use automatic detection, while Trampolim and whey do not, requiring a `tool`
136+
setting.
104137

105138

106139
## Versioning
@@ -146,5 +179,22 @@ providing at least `test`, `docs`, and `dev`.
146179
[pdm]: https://pdm.fming.dev
147180
[trampolim]: https://github.com/FFY00/trampolim
148181
[whey]: https://whey.readthedocs.io
182+
[hatch]: https://ofek.dev/hatch/latest/
149183
[setuptools]: https://setuptools.readthedocs.io
150184
[pep 621]: https://www.python.org/dev/peps/pep-0621
185+
186+
<script>
187+
function openTab(tabName) {
188+
var tab = document.getElementsByClassName("skhep-tab");
189+
for (const t of tab) {
190+
t.style.display = t.id == tabName ? "block" : "none";
191+
}
192+
var btn = document.getElementsByClassName("skhep-bar-item");
193+
for (const b of btn) {
194+
if(b.id == tabName.concat("-btn"))
195+
b.classList.add("btn-purple");
196+
else
197+
b.classList.remove("btn-purple");
198+
}
199+
}
200+
</script>

0 commit comments

Comments
 (0)