Skip to content

Commit 425fc23

Browse files
committed
Fix: broken links and add alt tags
1 parent ea0d1bf commit 425fc23

File tree

2 files changed

+29
-13
lines changed

2 files changed

+29
-13
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ Hatch:
6060
To better understand your options, when it comes to building a Python package, it's important to first understand the difference between a
6161
build tool front-end and build back-end.
6262

63+
(build_backends)=
64+
6365
### Build back-ends
6466

6567
Most packaging tools have a back-end

package-structure-code/python-package-distribution-files-sdist-wheel.md

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Learn about Building a Python Package
22

3-
:::{figure-md} build-workflow
4-
<img src="../images/python-package-development-process.png" alt="Alt tag to be added when image is final" width="700px">
3+
:::{figure-md} build_workflow
4+
<img src="../images/python-package-development-process.png" alt="Graphic showing the high level packaging workflow. On the left you see a graphic with code, metadata and tests in it. those items all go into your package. Documentation and data are below that box because they aren't normally published in your packaging wheel distribution. an arrow to the right takes you to a build distribution files box. that box leads you to either publishing to testpypi or the real pypi. from pypi you can then connect to conda forge for an automated build that sends distributions from pypi to conda-forge. " width="700px">
55

6-
You need to build your Python package in order to publish it to PyPI (or Conda). The build process organizes your code and metadata into a distribution format that can be uploaded to PyPI and subsequently downloaded and installed by users.
6+
You need to build your Python package in order to publish it to PyPI (or Conda). The build process organizes your code and metadata into a distribution format that can be uploaded to PyPI and subsequently downloaded and installed by users. NOTE: you need to publish a sdist to PyPI in order for conda-forge to properly build your package automatically.
77
:::
88

99
## What is building a Python package?
1010

11-
To [publish your Python package](build-workflow) and make it easy for anyone to install, you first need to build it.
11+
To [publish your Python package](build_workflow) and make it easy for anyone to install, you first need to build it.
1212

1313
But, what does it mean to build a Python package?
1414

15-
[As shown in the figure above](build-workflow), when you build your Python package, you convert the source files into something called a distribution package. A distribution package contains your source code and metadata about the package, in the format required by the Python Package Index, so that it can be installed by tools like pip.
15+
[As shown in the figure above](build_workflow), when you build your Python package, you convert the source files into something called a distribution package. A distribution package contains your source code and metadata about the package, in the format required by the Python Package Index, so that it can be installed by tools like pip.
1616

1717
:::{note}
1818
The term package used to mean many different things in Python and other languages. On this page, we adapt the convention of the [Python Packaging Authority](https://www.pypa.io/en/latest/) and refer to the product of the
@@ -29,7 +29,7 @@ The metadata that both build tools and PyPI uses to describe and understand your
2929

3030
1. It helps whatever tool you use to build your package (pip, [pypa's Build](https://pypi.org/project/build/) or an end-to-end tool such as poetry, PDM or Hatch) understand how to build your package. Information it provides to your build tool includes:
3131

32-
- The [build-system] table in your pyproject.toml file tells pip what [build backend tool](python-package-build-tools.html#build-back-ends) you wish to use for creating your sdist and wheel distributions.
32+
- The `[build-system]` table in your pyproject.toml file tells pip what [build backend tool](build_backends) you wish to use for creating your sdist and wheel distributions.
3333

3434
```toml
3535
[build-system]
@@ -65,8 +65,10 @@ classifiers = [
6565
]
6666
```
6767

68-
```{admonition}
69-
project metadata used to be stored in either a setup.py file or a setup.cfg file. The current recommended practice for storing package metadata is to use a pyproject.toml file. [Learn more about the pyproject.toml file here.](pyproject-toml-python-package-metadata)
68+
```{admonition} What happened to setup.py and setup.cfg for metadata?
69+
:class: note
70+
71+
Project metadata used to be stored in either a setup.py file or a setup.cfg file. The current recommended practice for storing package metadata is to use a pyproject.toml file. [Learn more about the pyproject.toml file here.](pyproject-toml-python-package-metadata)
7072
```
7173

7274
### An example - xclim
@@ -80,17 +82,29 @@ When you publish to PyPI, you will notice that each package has metadata listed.
8082

8183
When you add the classifier section to your pyproject.toml
8284
and your package is built, the build tool organizes the metadata into a format that PyPI can understand and
83-
represent on your pypi landing page. These classifiers also allow users to sort through packages by version of python they support, categories and more.
85+
represent on your PyPI landing page. These classifiers also allow users to sort through packages by version of python they support, categories and more.
8486
```
8587

86-
:::{figure-md} fig-target
87-
<img src="../images/python-build-package/pypi-metadata-keywords-license.png" alt="t." width="700px">
88+
:::{figure-md} build-workflow
89+
<img src="../images/python-package-development-process.png" alt="Graphic showing the high level packaging workflow. On the left you see a graphic with code, metadata and tests in it. those items all go into your package. Documentation and data are below that box because they aren't normally published in your packaging wheel distribution. an arrow to the right takes you to a build distribution files box. that box leads you to either publishing to testpypi or the real pypi. from pypi you can then connect to conda forge for an automated build that sends distributions from pypi to conda-forge. " width="700px">
8890

91+
You need to build your Python package in order to publish it to PyPI (or Conda). The build process organizes your code and metadata into a distribution format that can be uploaded to PyPI and subsequently downloaded and installed by users. NOTE: you need to publish a sdist to PyPI in order for conda-forge to properly build your package automatically.
8992
:::
9093

91-
:::{figure-md} fig-target
92-
<img src="../images/python-build-package/pypi-metadata-maintainers.png" alt="t." width="700px">
94+
:::{figure-md}
95+
96+
<img src="../images/python-build-package/pypi-metadata-keywords-license.png" alt="This screenshot shows the metadata on pypi for the xclim package. on it you can see the name of the license, the author and maintainer names keywords associated with the package and the base python version it requires which is 3.8." width="400px">
97+
98+
PyPI screenshot showing metadata for the xclim package.
99+
:::
100+
101+
---
102+
103+
:::{figure-md} pypi-metadata-maintainers
104+
105+
<img src="../images/python-build-package/pypi-metadata-maintainers.png" alt="Here you see the maintinaer metadata as it is displayed on PyPI. for xclim there are three maintainers listed with their profile pictures and github user names to the right. " width="300px">
93106

107+
Maintainer names and GitHub usernames for the xclim package as they are displayed on PyPI. This information is recorded in your pyproject.toml and then processed by your build tool and stored in your packages sdist and wheel distributions.
94108
:::
95109

96110
## How to create the distribution format that PyPI and Pip expects?

0 commit comments

Comments
 (0)