|
25 | 25 | # and complex packaging. Some of the recommended ones are listed below -
|
26 | 26 | # - [Python Packaging User Guide](https://packaging.python.org/en/latest/)
|
27 | 27 | # - [pyOpenSci Python Package Guide](https://www.pyopensci.org/python-package-guide/)
|
28 |
| -# - [Scientific Python Packaging Guide]https://learn.scientific-python.org/development/tutorials/packaging/ |
| 28 | +# - [Scientific Python Packaging Guide](https://learn.scientific-python.org/development/tutorials/packaging/) |
29 | 29 | #
|
30 | 30 | # Besides the guides, there are numerous "cookie" templates available for developers. These templates
|
31 | 31 | # allow developers to generate an empty Python package following good practices and guidelines with a
|
|
97 | 97 | # |-- LICENSE.md
|
98 | 98 | # |-- CITATION.md
|
99 | 99 | # |-- README.md
|
100 |
| -# `-- setup.py |
| 100 | +# `-- pyproject.toml |
101 | 101 | # ```
|
102 | 102 | #
|
103 | 103 | #
|
|
147 | 147 | # In this case, we'll be using `hatch` to build our package, so we list it in the `requires` field. Technically speaking, `hatch` is the front-end (a CLI utility)
|
148 | 148 | # for the actual build-backend `hatchling`. `hatchling` is installed with hatch and can be specified as the `build-backend` in `pyproject.toml`.
|
149 | 149 | #
|
150 |
| -# Finally, we can set specific options for `hatch` using additional sections in `pyproject.toml`: in this case, we will tell `hatch` that it needs to find **and include** all of the files in our `src` folder. |
| 150 | +# Finally, we can set specific options for `hatch` using additional sections in `pyproject.toml`: in this case, we will tell `hatch` that it needs to find **and include** all of the files in our `src/greetings` folder. |
| 151 | +# We could have skipped adding the directory manually if our package had a `__init__.py` file (more on this below). |
151 | 152 | # The best way to look at all the options of a build-backend is by going through its documentation.
|
152 | 153 |
|
153 | 154 | # %%
|
|
161 | 162 | name = "Greetings"
|
162 | 163 | version = "0.1.0"
|
163 | 164 |
|
164 |
| -[tool.hatch.build.targets.sdist] |
165 |
| -include = [ |
166 |
| - "src*", |
| 165 | +[tool.hatch.build.targets.wheel] |
| 166 | +packages = [ |
| 167 | + "src/greetings", |
167 | 168 | ]
|
168 | 169 |
|
169 | 170 | # %% [markdown]
|
@@ -343,9 +344,9 @@ def process():
|
343 | 344 | [project.scripts]
|
344 | 345 | greet = "greetings.command:process"
|
345 | 346 |
|
346 |
| -[tool.hatch.build.targets.sdist] |
347 |
| -include = [ |
348 |
| - "greetings/", |
| 347 | +[tool.hatch.build.targets.wheel] |
| 348 | +packages = [ |
| 349 | + "src/greetings", |
349 | 350 | ]
|
350 | 351 |
|
351 | 352 | # %% language="bash"
|
@@ -422,9 +423,9 @@ def process():
|
422 | 423 | [project.scripts]
|
423 | 424 | greet = "greetings.command:process"
|
424 | 425 |
|
425 |
| -[tool.hatch.build.targets.sdist] |
426 |
| -include = [ |
427 |
| - "src/", |
| 426 | +[tool.hatch.build.targets.wheel] |
| 427 | +packages = [ |
| 428 | + "src/greetings", |
428 | 429 | ]
|
429 | 430 |
|
430 | 431 |
|
@@ -676,8 +677,10 @@ def test_greeter(fixture):
|
676 | 677 | [project.optional-dependencies]
|
677 | 678 | dev = ["pytest >= 6"]
|
678 | 679 |
|
679 |
| -[tool.hatch.build.targets.sdist] |
680 |
| -include = ["src*"] |
| 680 | +[tool.hatch.build.targets.wheel] |
| 681 | +packages = [ |
| 682 | + "src/greetings", |
| 683 | +] |
681 | 684 |
|
682 | 685 |
|
683 | 686 | # %% [markdown]
|
|
0 commit comments