Skip to content

Commit a1f4812

Browse files
authored
Merge branch 'main' into conda-force
2 parents 5a3a2ac + 68eb070 commit a1f4812

File tree

8 files changed

+380
-89
lines changed

8 files changed

+380
-89
lines changed

.all-contributorsrc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,28 @@
417417
"code",
418418
"tutorial"
419419
]
420+
},
421+
{
422+
"login": "JacksonBurns",
423+
"name": "Jackson Burns",
424+
"avatar_url": "https://avatars.githubusercontent.com/u/33505528?v=4",
425+
"profile": "http://jacksonwarnerburns.com",
426+
"contributions": [
427+
"code",
428+
"review",
429+
"tutorial"
430+
]
431+
},
432+
{
433+
"login": "jaimergp",
434+
"name": "jaimergp",
435+
"avatar_url": "https://avatars.githubusercontent.com/u/2559438?v=4",
436+
"profile": "https://github.com/jaimergp",
437+
"contributions": [
438+
"code",
439+
"review",
440+
"tutorial"
441+
]
420442
}
421443
],
422444
"contributorsPerLine": 7,

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# <img src="https://www.pyopensci.org/images/logo.png" width=100 /> pyOpenSci scientific Python Packaging Guide
22
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
3-
[![All Contributors](https://img.shields.io/badge/all_contributors-40-orange.svg?style=flat-square)](#contributors-)
3+
[![All Contributors](https://img.shields.io/badge/all_contributors-42-orange.svg?style=flat-square)](#contributors-)
44
<!-- ALL-CONTRIBUTORS-BADGE:END -->
55

66
![GitHub release (latest by date)](https://img.shields.io/github/v/release/pyopensci/python-package-guide?color=purple&display_name=tag&style=plastic)
@@ -125,6 +125,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
125125
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mknorps"><img src="https://avatars.githubusercontent.com/u/27200848?v=4?s=100" width="100px;" alt="Maria Knorps"/><br /><sub><b>Maria Knorps</b></sub></a><br /><a href="https://github.com/pyOpenSci/python-package-guide/commits?author=mknorps" title="Code">💻</a> <a href="https://github.com/pyOpenSci/python-package-guide/pulls?q=is%3Apr+reviewed-by%3Amknorps" title="Reviewed Pull Requests">👀</a></td>
126126
<td align="center" valign="top" width="14.28%"><a href="https://phil.red"><img src="https://avatars.githubusercontent.com/u/291575?v=4?s=100" width="100px;" alt="Philipp A."/><br /><sub><b>Philipp A.</b></sub></a><br /><a href="https://github.com/pyOpenSci/python-package-guide/commits?author=flying-sheep" title="Code">💻</a> <a href="https://github.com/pyOpenSci/python-package-guide/pulls?q=is%3Apr+reviewed-by%3Aflying-sheep" title="Reviewed Pull Requests">👀</a></td>
127127
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Midnighter"><img src="https://avatars.githubusercontent.com/u/135653?v=4?s=100" width="100px;" alt="Moritz E. Beber"/><br /><sub><b>Moritz E. Beber</b></sub></a><br /><a href="https://github.com/pyOpenSci/python-package-guide/commits?author=Midnighter" title="Code">💻</a> <a href="#tutorial-Midnighter" title="Tutorials">✅</a></td>
128+
<td align="center" valign="top" width="14.28%"><a href="http://jacksonwarnerburns.com"><img src="https://avatars.githubusercontent.com/u/33505528?v=4?s=100" width="100px;" alt="Jackson Burns"/><br /><sub><b>Jackson Burns</b></sub></a><br /><a href="https://github.com/pyOpenSci/python-package-guide/commits?author=JacksonBurns" title="Code">💻</a> <a href="https://github.com/pyOpenSci/python-package-guide/pulls?q=is%3Apr+reviewed-by%3AJacksonBurns" title="Reviewed Pull Requests">👀</a> <a href="#tutorial-JacksonBurns" title="Tutorials">✅</a></td>
129+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jaimergp"><img src="https://avatars.githubusercontent.com/u/2559438?v=4?s=100" width="100px;" alt="jaimergp"/><br /><sub><b>jaimergp</b></sub></a><br /><a href="https://github.com/pyOpenSci/python-package-guide/commits?author=jaimergp" title="Code">💻</a> <a href="https://github.com/pyOpenSci/python-package-guide/pulls?q=is%3Apr+reviewed-by%3Ajaimergp" title="Reviewed Pull Requests">👀</a> <a href="#tutorial-jaimergp" title="Tutorials">✅</a></td>
128130
</tr>
129131
</tbody>
130132
</table>

documentation/write-user-documentation/document-your-code-api-docstrings.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class, method, attribute and/or function in your package (_within reason_) that:
4343
- Defines the `type` inputs and outputs (ie. `string`, `int`, `np.array`)
4444
- Explains the expected output `return` of the object, method or function.
4545

46+
(numpy-docstring)=
4647
### Three Python docstring formats and why we like NumPy style
4748

4849
There are several Python docstring formats that you can chose to use when documenting
@@ -252,7 +253,7 @@ the output of the function is also an int.
252253
def add_me(num1: int, num2: int) -> int:
253254
"""A function that sums two numbers.
254255
```
255-
256+
(type-hints)=
256257
### Why use type hints
257258

258259
Type hints:

index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ by the community now! Join our community review process or watch development of
7373

7474
* [What is a Python package?](/tutorials/intro)
7575
* [Make your code installable](/tutorials/1-installable-code)
76+
* [Publish your package to (test) PyPi](/tutorials/publish-pypi)
7677
* *How to add a README and LICENSE to support publication (coming next!)*
7778
* *How to add metadata to a pyproject.toml file for publication to PyPI.*
7879

package-structure-code/python-package-build-tools.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Python Packaging Tools
22

3-
<!-- TODO: add a small discussion on what pinning is?-->
4-
53
## Tools for building your package
64

75
There are a several different build tools that you can use to [create your Python package's _sdist_ and _wheel_ distributions](python-package-distribution-files-sdist-wheel). Below, we discuss the features,
@@ -12,10 +10,9 @@ extensions.
1210

1311
:::{figure-md} package-decision-tree
1412

15-
<img src="../images/python-package-tools-decision-tree.png" alt="Decision tree diagram showing the various front and back end packaging tools. You can decide what packaging tool to use by thinking about what features you need. PDM is currently the most flexible tool that also supports both non pure Python projects and also using different build back-ends. As such currently PDM is the tool we think beginners might appreciate most with Poetry being a close second. Poetry is ideal for pure python projects." width="700px">
13+
<img src="../images/python-package-tools-decision-tree.png" alt="Decision tree diagram showing the various front and back end packaging tools. You can decide what packaging tool to use by thinking about what features you need. PDM and Hatch are currently the most flexible tools as they also using different build back-ends. As such currently PDM and Hatch are the tools we think beginners might appreciate most with Poetry being a close second. Poetry is nice for pure Python projects." width="700px">
1614

17-
Diagram showing the various from end build tools that you can select from. Each tool has different features as highlighted below.
18-
NOTE: this is still a DRAFT so i'm not going to spend time truly cleaning it up until i get lots of feedback on the general approach!!
15+
Diagram showing the different front end build tools available to use in the Python package ecosystem that you can select from. We selected tools to include in this diagram based upon the PyPI survey which helped us understand the most populate tools in the ecosystem. Each tool has different features as highlighted below.
1916
:::
2017

2118
If you want to know more about Python packages that have extensions written in
@@ -207,6 +204,7 @@ front-end tools remove the need to use other core tools in your workflow. For ex
207204
Note that because setuptools does not offer a front-end interface, it is not
208205
included in the table.
209206

207+
(package-features)=
210208
### Package tool features table
211209

212210
```{csv-table}
@@ -215,7 +213,7 @@ included in the table.
215213
:delim: "|"
216214
217215
Default Build Back-end| Flit-core| hatchling| PDM| Poetry-core
218-
Use Other Build Backends|✖ | |✅ |✖
216+
Use Other Build Backends|✖ | |✅ |✖
219217
Dependency management| ✖|✖|✅|✅
220218
Publish to PyPI| ✅|✅|✅|✅
221219
Version Control based versioning (using `git tags`)|✖|✅|✅|✅
@@ -310,7 +308,7 @@ Install your package in editable mode|✅| Flit supports installing your package
310308
Build your sdist and wheel distributions|✅| Flit can be used to build your packages sdist and wheel distributions.
311309
```
312310

313-
\*\* NOTE: _If you are using the most current version of pip, it supports both a symlink approach `flit install -s` and `pip install -e .`_
311+
NOTE: _If you are using the most current version of pip, it supports both a symlink approach `flit install -s` and `pip install -e .`_
314312

315313
```{admonition} Learn more about flit
316314
* [Why use flit?](https://flit.pypa.io/en/stable/rationale.html)
@@ -329,6 +327,7 @@ You may NOT want to use flit if:
329327
- You have a project that is not pure Python (Use Hatch, PDM or setuptools)
330328
- You want environment management (use PDM, Hatch or Poetry)
331329

330+
(hatch)=
332331
## Hatch
333332

334333
[**Hatch**](https://hatch.pypa.io/latest/), similar to Poetry and PDM, provides a
@@ -345,30 +344,29 @@ as building your documentation locally. This means that you could potentially dr
345344
:widths: 20,5,50
346345
:delim: "|"
347346
348-
Use Other Build Backends|| Switching out build back-ends is not currently an option with Hatch. However, this feature is planned for a future release.
347+
Use Other Build Backends|| Switching out build back-ends is not currently an option with Hatch. However, this feature is planned for a future release.
349348
Dependency management|✖| Currently you have to add dependencies manually with Hatch. However a feature to support dependencies management may be added in a future release.
350349
Environment Management |✅ | Hatch supports Python virtual environments. If you wish to use other types of environments such as Conda, you will need to [install a plugin such as hatch-conda for conda support](https://github.com/OldGrumpyViking/hatch-conda).
351350
Publish to PyPI and test PyPI|✅|Hatch supports publishing to both test PyPI and PyPI
352351
Version Control based versioning|✅ | Hatch offers `hatch_vcs` which is a plugin that uses setuptools_scm to support versioning using git tags. The workflow with `hatch_vcs` is the same as that with `setuptools_scm`.
353352
Version bumping| ✅ | Hatch supports you bumping the version of your package using standard semantic version terms patch; minor; major
354353
Follows current packaging standards|✅|Hatch supports current packaging standards for adding metadata to the **pyproject.toml** file.
355-
Install your package in editable mode|✅| You can install your package in editable mode using `pip install -e .` Hatch mentions [editable installs](https://hatch.pypa.io/latest/config/build/#dev-mode) but refers to pip in its documentation.
354+
Install your package in editable mode|✅| Hatch will install your package into any of its environments by default in editable mode. You can install your package in editable mode manually using `pip install -e .` Hatch mentions [editable installs](https://hatch.pypa.io/latest/config/build/#dev-mode) but refers to pip in its documentation.
356355
Build your sdist and wheel distributions|✅| Hatch will build the sdist and wheel distributions
357356
✨Matrix environment creation to support testing across Python versions✨|✅| The matrix environment creation is a feature that is unique to Hatch in the packaging ecosystem. This feature is useful if you wish to test your package locally across Python versions (instead of using a tool such as tox).
358357
✨[Nox / MAKEFILE like functionality](https://hatch.pypa.io/latest/environment/#selection)✨| ✅| This feature is also unique to Hatch. This functionality allows you to create workflows in the **pyproject.toml** configuration to do things like serve docs locally and clean your package build directory. This means you may have one less tool in your build workflow.
359358
✨A flexible build back-end: **hatchling**✨| ✅| **The hatchling build back-end offered by the maintainer of Hatch allows developers to easily build plugins to support custom build steps when packaging.
360359
361360
```
362361

363-
_\*\* There is some argument about this approach placing a burden on maintainers to create a custom build system. But others appreciate the flexibility. The Hatch build hook approach is also comparable with the features offered by PDM._
362+
_There is some argument about this approach placing a burden on maintainers to create a custom build system. But others appreciate the flexibility. The Hatch build hook approach is also comparable with the features offered by PDM._
364363

365364
### Why you might not want to use Hatch
366365

367366
There are a few features that hatch is missing that may be important for some.
368367
These include:
369368

370369
- Hatch doesn't support adding dependencies. You will have to add them manually.
371-
- Hatch currently doesn't support use with other build back-ends. Lack of support for other build back-ends makes Hatch less desirable for users with more complex package builds. If your package is pure Python, then this won't be an issue.
372370
- Hatch won't by default recognize Conda environments without a plugin.
373371
- Similar to PDM, Hatch's documentation can difficult to work through, particularly if you are just getting started with creating a package.
374372
- Hatch, similar to PDM and Flit currently only has one maintainer.

0 commit comments

Comments
 (0)