Skip to content

Commit 69f036e

Browse files
committed
Incorporate the build backend into the pyproject.toml
1 parent 9223528 commit 69f036e

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

index.html

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,12 +1566,16 @@ <h3><code>pyproject.toml</code></h3>
15661566
instead:
15671567
</p>
15681568
<p class="fragment fade-in-then-out" data-fragment-index="6">
1569+
Build dependencies will be installed by the build front end
1570+
(<em>e.g.</em>, <code>pip</code>):
1571+
</p>
1572+
<p class="fragment fade-in-then-out" data-fragment-index="7">
15691573
Create an executable for calling your hook's CLI:
15701574
</p>
15711575
</div>
15721576
<div class="center fragment" data-fragment-index="0">
15731577
<pre>
1574-
<code data-trim class="language-toml hide-line-numbers" data-line-numbers="1-31|2|3|4-6|8-9|15-19|13" data-fragment-index="1">
1578+
<code data-trim class="language-toml hide-line-numbers" data-line-numbers="1-23|2|3|4-6|8-9|15-19|21-23|13" data-fragment-index="1">
15751579
[project]
15761580
name = "pre-commit-workshop"
15771581
version = "0.1.0"
@@ -1591,6 +1595,10 @@ <h3><code>pyproject.toml</code></h3>
15911595
"pre-commit", # so you can run hooks on the codebase
15921596
# "pytest", # remember to add tests for your hook
15931597
]
1598+
1599+
[build-system]
1600+
requires = ["hatchling"]
1601+
build-backend = "hatchling.build"
15941602
</code>
15951603
</pre>
15961604
<small
@@ -1640,15 +1648,21 @@ <h2>Exercise</h2>
16401648
exercise. Be sure to create an entry point that will hit the CLI.
16411649
</p>
16421650
<p>
1643-
Confirm that you can <code>pip install</code> it (note that you will
1644-
need to create any files referenced in the
1645-
<code>pyproject.toml</code>, such as <code>README.md</code>).
1651+
Confirm that you can install it: <code>pip install -e .</code> or
1652+
<code>uv sync</code>. Note that you will need to declare any
1653+
dependencies outside the standard library and create any files
1654+
referenced in the <code>pyproject.toml</code>, such as
1655+
<code>README.md</code>.
16461656
</p>
16471657
</section>
16481658
<section id="example-solution-2-3">
16491659
<h2>Example solution</h2>
1660+
<p>
1661+
Replace the existing <code>[project]</code> section with the
1662+
following:
1663+
</p>
16501664
<pre>
1651-
<code data-trim class="language-toml hide-line-numbers" data-line-numbers="1-19|2-8|10-11|13">
1665+
<code data-trim class="language-toml hide-line-numbers" data-line-numbers="1-13|2-8|10-11|13">
16521666
[project]
16531667
name = "filename-validation"
16541668
version = "0.1.0"
@@ -1662,12 +1676,6 @@ <h2>Example solution</h2>
16621676
dependencies = []
16631677

16641678
scripts.validate-filename = "filename_validation.cli:main"
1665-
1666-
[dependency-groups]
1667-
dev = [
1668-
"pre-commit", # so you can run hooks on the codebase
1669-
# "pytest", # remember to add tests for your hook
1670-
]
16711679
</code>
16721680
</pre>
16731681
</section>

0 commit comments

Comments
 (0)