Skip to content

Commit e9af215

Browse files
committed
Oops wrong page
1 parent 3433f99 commit e9af215

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

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

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,4 @@
1-
# Python Package Build Tools
2-
3-
## What is building a Python package and why do we do it?
4-
5-
In Python, if you want to publish your code in a way that can be
6-
installed by both yourself and others, your code, tests and associated
7-
metadata need to be organized in a specific way. This specific
8-
organization and structure is important because it's the structure
9-
that both `PyPI` and any installer that you use like `pip` can
10-
understand and parse. This process of organizing and formatting your
11-
code, documentation, tests and metadata into a format that both pip
12-
and PyPI can use, is called a build step.
13-
14-
For instance, when you publish to PyPI, you will notice that each package has metadata listed. Let’s have a look at [xclim](https://pypi.org/project/xclim/), one of our [pyOpenSci packages](https://www.pyopensci.org/python-packages.html). Notice that on the PyPI landing page you see some metadata about the package including python, maintainer information and more. PyPI is able to populate this metadata because it was defined using correct syntax and classifiers by Xclim's maintainers, [pyproject.toml file](https://github.com/Ouranosinc/xclim/blob/master/pyproject.toml). This metadata when the xclim package is built, is translated into a distribution file that allows PyPI to read the metadata and print it out on their website.
15-
16-
## How to create the distribution format that PyPI and Pip expects?
17-
18-
You could in theory create your own scripts to organize your code the way PyPI wants it to be. However, just like there are packages that handle known structures such as Pandas for data frames and Numpy for arrays, there are packages and tools that help you create package build distribution files.
19-
20-
```{note}
21-
22-
BREAKOUT: there are a suite of packaging tools that can either help you with the entire packaging process or just one step of the process. For instance setuptools is a commonly used build back end that can be used to create your SDist and wheel. Whereas tools like Hatch, PDM, Poetry and flit help with other parts of the packaging process. While this can cause some confusion and complexity in the packaging ecosystem - for the most part, each tool provides the same distribution output (with minor differences that most users may not care about). Learn more about those tools on this page.
23-
```
24-
25-
Below, you will learn about the two distribution files that PyPI expects you to publish: SDist and Wheel. You will learn about
26-
their structure and what files belong in each.
1+
# Python Packaging Tools
272

283
<!-- TODO: add a small discussion on what pinning is?-->
294

0 commit comments

Comments
 (0)