Skip to content

Commit 82e1c20

Browse files
committed
Update pyproject.toml for dependency groups
1 parent 610654e commit 82e1c20

1 file changed

Lines changed: 19 additions & 48 deletions

File tree

index.html

Lines changed: 19 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,46 +1532,31 @@ <h3><code>pyproject.toml</code></h3>
15321532
instead:
15331533
</p>
15341534
<p class="fragment fade-in-then-out" data-fragment-index="6">
1535-
Creating a package is recommended for testing and reuse:
1536-
</p>
1537-
<p class="fragment fade-in-then-out" data-fragment-index="7">
15381535
Create an executable for calling your hook's CLI:
15391536
</p>
15401537
</div>
15411538
<div class="center fragment" data-fragment-index="0">
15421539
<pre>
1543-
<code data-trim class="language-toml hide-line-numbers" data-line-numbers="1-31|6|7|8-17|19-20|21-24|29-31|27" data-fragment-index="1">
1544-
[build-system]
1545-
requires = ["setuptools", "setuptools-scm"]
1546-
build-backend = "setuptools.build_meta"
1547-
1540+
<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">
15481541
[project]
1549-
name = "your-pre-commit-hook"
1542+
name = "pre-commit-workshop"
15501543
version = "0.1.0"
15511544
authors = [{name = "Your Name", email = "email@example.com"},]
1552-
description = "TODO"
1545+
description = "A pre-commit hook created during the workshop."
15531546
readme = "README.md"
1554-
license = {file = "LICENSE"}
1555-
classifiers = [
1556-
"Development Status :: 1 - Planning", # update later
1557-
"Programming Language :: Python"
1558-
]
1559-
urls.Homepage = "https://example.com"
1560-
urls.Documentation = "https://example.com/docs"
15611547

1562-
dependencies = ["your-hook-dependencies"]
15631548
requires-python = ">=3.10"
1564-
optional-dependencies.dev = [
1565-
"pre-commit", # so you can run hooks on the codebase
1566-
"pytest", # remember to add tests for your hook
1567-
]
1549+
dependencies = [] # TODO: declare any dependencies
15681550

1569-
# TODO: update `your-script-name` and the path
1570-
scripts.your-script-name = "your_pkg.your_module:hook_function"
1551+
# TODO: update `your-script-name` with the name of your choice
1552+
# TODO: update `pkg.module:function` to point to your function
1553+
scripts.your-script-name = "pkg.module:function"
15711554

1572-
# optional (if you are making a package)
1573-
[tool.setuptools.packages.find]
1574-
where = ["src"]
1555+
[dependency-groups]
1556+
dev = [
1557+
"pre-commit", # so you can run hooks on the codebase
1558+
# "pytest", # remember to add tests for your hook
1559+
]
15751560
</code>
15761561
</pre>
15771562
<small
@@ -1629,11 +1614,7 @@ <h2>Exercise</h2>
16291614
<section id="example-solution-2-3">
16301615
<h2>Example solution</h2>
16311616
<pre>
1632-
<code data-trim class="language-toml hide-line-numbers" data-line-numbers="1-33|6-17|19-20|26">
1633-
[build-system]
1634-
requires = ["setuptools", "setuptools-scm"]
1635-
build-backend = "setuptools.build_meta"
1636-
1617+
<code data-trim class="language-toml hide-line-numbers" data-line-numbers="1-19|2-8|10-11|13">
16371618
[project]
16381619
name = "filename-validation"
16391620
version = "0.1.0"
@@ -1642,27 +1623,17 @@ <h2>Example solution</h2>
16421623
]
16431624
description = "Validates that filenames meet criteria."
16441625
readme = "README.md"
1645-
license = {file = "LICENSE"}
1646-
classifiers = [
1647-
"Development Status :: 3 - Alpha",
1648-
"Programming Language :: Python"
1649-
]
16501626

1651-
dependencies = []
16521627
requires-python = ">=3.10"
1653-
optional-dependencies.dev = [
1654-
"pre-commit",
1655-
"pytest",
1656-
]
1628+
dependencies = []
16571629

16581630
scripts.validate-filename = "filename_validation.cli:main"
16591631

1660-
[project.urls]
1661-
Homepage = "https://github.com/stefmolin/validate-filename"
1662-
Documentation = "https://stefaniemolin.com/validate-filename"
1663-
1664-
[tool.setuptools.packages.find]
1665-
where = ["src"]
1632+
[dependency-groups]
1633+
dev = [
1634+
"pre-commit", # so you can run hooks on the codebase
1635+
# "pytest", # remember to add tests for your hook
1636+
]
16661637
</code>
16671638
</pre>
16681639
</section>

0 commit comments

Comments
 (0)