Skip to content

Commit b98fe56

Browse files
committed
Fix: address comments on intro page and update with python as a flex language
1 parent 9ba0e17 commit b98fe56

File tree

4 files changed

+80
-63
lines changed

4 files changed

+80
-63
lines changed

conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
html_theme = 'furo'
9494
html_static_path = ["_static"]
9595
html_css_files = ["pyos.css"]
96-
html_title = "pyOpenSci Package Guide"
96+
html_title = "pyOpenSci Python Packaging Guide"
9797
html_logo = "images/logo/logo.png"
9898

9999
# Add any paths that contain custom static files (such as style sheets) here,

index.md

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -111,42 +111,39 @@ to see here, [we invite you to open an issue on GitHub that details any changes
111111

112112
```{toctree}
113113
:hidden:
114-
:caption: Documentation
115114
116-
Documentation Overview <documentation/index>
117-
Write User Documentation <documentation/write-user-documentation/intro>
118-
Core GitHub Repository Files <documentation/repository-files/intro>
119-
Documentation Tools & Hosting <documentation/hosting-tools/intro>
115+
🏠 Home <self>
120116
```
121117

122-
123118
```{toctree}
124119
:hidden:
125-
:caption: Package structure & code style
120+
:caption: Package structure
126121
127-
<<<<<<< HEAD
128-
Intro <python-packaging/intro>
122+
Intro <package-structure-code/intro>
123+
Python package structure <package-structure-code/python-package-structure>
124+
What are SDIst & Wheel Files? <package-structure-code/python-package-distribution-files-sdist-wheel.md>
125+
Package Build Tools <package-structure-code/python-package-build-tools>
129126
130127
```
131128

132129

130+
```{toctree}
131+
:hidden:
132+
:caption: Documentation
133+
134+
Documentation Overview <documentation/index>
135+
Write User Documentation <documentation/write-user-documentation/intro>
136+
Core GitHub Repository Files <documentation/repository-files/intro>
137+
Documentation Tools & Hosting <documentation/hosting-tools/intro>
138+
```
139+
133140

134141
```{toctree}
135142
:hidden:
136143
:caption: CI and Testing
137144
138-
Intro <ci-and-testing/intro>
139-
=======
140-
Intro <package-structure-code/intro>
141-
142-
Python package structure <package-structure-code/python-package-structure>
143-
What are SDIst & Wheel Files? <package-structure-code/python-package-distribution-files-sdist-wheel.md>
144-
Package Build Tools <package-structure-code/python-package-build-tools>
145145
Package Versions <package-structure-code/python-package-versions>
146-
package-structure-code/overview
147-
package-structure-code/collaboration
148146
Code Style & Format <package-structure-code/code-structure-style>
149-
>>>>>>> e8b229d (Add: package structure and build tools)
150147
```
151148

152149

package-structure-code/intro.md

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,10 @@
11
# Python package structure information
22

33
If you plan to submit a package for review to pyOpenSci and are looking for
4-
some guidance on package structure, code formats and style, then this section is for you.
4+
some guidance on package structure, code formats and style, then this section
5+
is for you.
56

6-
## Guidelines for pyOpenSci's packaging recommendations
7-
8-
<!-- Might belong on the LANDING page for this entire guide?-->
9-
10-
There are some differing opinions on what Python package structure should
11-
look like and what tools to use across the Python ecosystem.
12-
13-
In this guide, we have made decisions around suggested standards and required
14-
standards, based upon the commonly used approaches in the scientific Python
15-
community. Our goal is to help standardize packaging across this ecosystem.
16-
17-
In some cases the suggestions here may diverge from those in the non-scientific parts of the Python ecosystem.
18-
19-
```{note}
20-
The suggestions for package layout in this section are made with the
21-
intent of being helpful; they are not specific requirements for your
22-
package to be reviewed and accepted into our ecosystem.
23-
```
24-
25-
In all cases, we try to align our suggestions with the most current, accepted
26-
[PEP's (Python Enhancement Protocols)](https://peps.python.org/pep-0000/) and the [scientific-python community specs](https://scientific-python.org/specs/).
7+
<!-- TODO: move this either to the top of this section or the landing page?-->
278

289
```{note}
2910
Have a look at the
@@ -35,6 +16,39 @@ anyone who is just getting started with creating a Python package.
3516
In general these are basic items that should be in any open software repository.
3617
```
3718

19+
## Guidelines for pyOpenSci's packaging recommendations
20+
21+
<!-- Might belong on the LANDING page for this entire guide?-->
22+
23+
Python is a flexible programming language that is used across numerous
24+
disciplines and domains. Python is so flexible that it is one of the few
25+
languages that can be used to wrap around other languages.
26+
27+
If you are building a pure Python package, then your packaging setup can be
28+
simple. However, some scientific packages have complex requirements as they may
29+
need to support extensions or tools written in other languages such as C or C++.
30+
31+
To support the many different uses of Python, there are many ways to create a
32+
Python package.
33+
34+
The ecosystem is dynamic, and constantly evolving to support
35+
the numerous needs that developers (and scientists) have using Python.
36+
37+
This dynamic yet flexible environment is what many love about Python.
38+
39+
## What you will learn here
40+
41+
In this section of our Python packaging guide, we try to:
42+
43+
* Provide an overview of the options available to you when packaging your tool
44+
* Suggest tools and approaches that both meet your needs and also support existing standards.
45+
* Suggest tools and approaches that will allow you to expand upon a workflow that may begin as a pure Python tool and evolve into a tool that requires addition layers of complexity in the packaging build.
46+
* Align our suggestions with the most current, accepted
47+
[PEPs (Python Enhancement Protocols)](https://peps.python.org/pep-0000/) and the [scientific-python community SPECs](https://scientific-python.org/specs/).
48+
* In an effort to maintain consistency withint our community , we also align with existing best practices being implemented by developers of core Scientific Python packages such as numpy, scipy and others.
49+
50+
51+
3852

3953
<!--
4054

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

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,50 @@
11
# Python Package Build Tools
22

3+
<!--TODO Add examples of builds using each of the tools below? -->
4+
35
Below, we discuss some of the tools that are commonly used
46
to build Python packages. This page is intended to help
57
maintainers select a build tool to use.
68

79
## Tools to build python packages
810

9-
There are a suite of build tools that you can use to create your Python
10-
package's **SDist** and *Wheel* distributions.
11+
There are several different build tools that you can use to create your Python
12+
package's **SDist** and **Wheel** distributions.
1113
To better understand your options, it's important to first understand the
1214
difference between a
1315
build tool front-end and build backend.
1416

1517
## Build front-end vs. build backend tools for Python packaging
1618

1719
### Build back-ends
18-
Every tool has a back-end
19-
build tool that actually builds the package and creates associated
20-
(SDist and wheel) distribution files. Some of the tools below such as **Flit**
21-
and **PDM** only support pure Python package builds that do not have a
22-
compilation or other additional build step. These types of tools are ideal if
23-
you have a pure Python project.
20+
Most packaging tools have a back-end
21+
build tool that builds the package and creates associated
22+
(SDist and wheel) distribution files. Some tools, such as **Flit**
23+
and **Hatch**, only support pure-Python package builds. A pure-Python build refers
24+
to a package build that does not have extensions that are written in another
25+
programming language (such as `C` or `C++`). These non-pure Python builds often
26+
have additional code compilation steps.
27+
28+
```{note}
29+
**PDM** does have some support for `C`/[`Cython`](https://cython.org/) extensions. [Click here to
30+
learn more.](https://pdm.fming.dev/latest/pyproject/build/#build-platform-specific-wheels
31+
)
32+
```
2433

25-
Other tools such as **Hatch** and **setuptools** support more complex builds
26-
with custom steps.
34+
There are, however back-ends such as and **setuptools.build**, **meson.build**
35+
and **scikit-build** that support complex builds with custom steps. If your
36+
build is particularly complex (ie you have more than a few `C`/`C++`
37+
extensions), we suggest you consider using **meson.build** or **scikit-build**.
2738

2839
### Build front-ends
2940
Each tool discussed below has a front-end interface that you can use to perform
3041
different types of Python packaging tasks.
42+
3143
For instance, you can use **Flit**, **Hatch** and **PDM** to both build your
3244
package and to publish your package to PyPI (or test PyPI). Setuptools,
3345
on the other hand requires you to use **twine** to push to PyPI.
3446

35-
Using a tool like **Flit**, **Hatch** or **PDM** can makes your workflow
36-
commands (and package requirements) consistent and simple.
47+
Using a tool like **Flit**, **Hatch** or **PDM** will simplify your workflow.
3748

3849
Example to build your package with **Flit**:
3950

@@ -53,21 +64,16 @@ twine check dist/*
5364
twine upload -r testpypi dist/*
5465
```
5566

56-
<!-- In the Python package build space **setuptools** is the original tool (i.e.
57-
the OG) of build tools. With a tool like `setuptools` you have the flexibility
58-
to publish python pure python packages and packages with custom build steps.
59-
However, you will also need to use other tools such as **twine** -->
67+
However each tool has different features and limits on the types of packaging
68+
steps that it supports.
69+
Below we describe the broader ecosystem of Python package build tools.
70+
We also highlight the benefits and potential limitations presented by each tool.
6071

6172
## An ecosystem of Python build tools
6273

6374
Below we introduce several of the most commonly used Python packaging build
6475
tools (see chart below).
6576

66-
Each tool has different features. There is no right or wrong tool to use as far
67-
as pyOpenSci is concerned. We are just trying to help you find the tool that
68-
works best for your workflow.
69-
70-
7177
:::{figure-md} fig-target
7278

7379
<img src="../images/python-package-tools-2022-survey-pypa.png" alt="Graph showing the results of the 2022 PyPA survey of Python packaging tools. On the x axis is percent response and on the y axis are the tools." width="700px">

0 commit comments

Comments
 (0)