You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: package-structure-code/publish-python-package-pypi-conda.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ Below you will learn more specifics about the differences between PyPI and conda
19
19
:::
20
20
21
21
22
-
:::{figure-md} pypi-conda-channels
22
+
:::{figure-md} upload-conda-forge
23
23
24
24
<imgsrc="../images/publish-python-package-pypi-conda.png"alt="Image showing the progression of creating a Python package, building it and then publishing to PyPI and conda-forge. You take your code and turn it into distribution files (sdist and wheel) that PyPI accepts. then there is an arrow towards the PyPI repository where ou publish both distributions. From PyPI if you create a conda-forge recipe you can then publish to conda-forge. "width="700px">
Copy file name to clipboardExpand all lines: package-structure-code/python-package-distribution-files-sdist-wheel.md
+1-2
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,14 @@
1
1
# Learn about Building a Python Package
2
2
3
3
4
-
:::{figure-md} pypi-conda-channels
4
+
:::{figure-md} pypi-conda-overview
5
5
6
6
<imgsrc="../images/publish-python-package-pypi-conda.png"alt="Image showing the progression of creating a Python package, building it and then publishing to PyPI and conda-forge. You take your code and turn it into distribution files (sdist and wheel) that PyPI accepts. then there is an arrow towards the PyPI repository where ou publish both distributions. From PyPI if you create a conda-forge recipe you can then publish to conda-forge. "width="700px">
7
7
8
8
Once you have published both package distributions (the source distribution and the wheel) to PyPI, you can then publish to conda-forge. conda-forge requires an source distribution on PyPI in order to build your package on conda-forge. You do not need to rebuild your package to publish to conda-forge.
9
9
:::
10
10
11
11
You need to build your Python package in order to publish it to PyPI (or a conda channel). 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.
Copy file name to clipboardExpand all lines: tests/run-tests.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Python versions.
16
16
17
17
18
18
19
-
###Tools to run your tests
19
+
## Tools to run your tests
20
20
21
21
There are three categories of tools that will make is easier to setup
22
22
and run your tests in various environments:
@@ -80,7 +80,7 @@ extensions that can be used to add functionality such as:
80
80
-[pytest-cov](https://pytest-cov.readthedocs.io/en/latest/) allows you to analyze the code coverage of your package during your tests, and generates a report that you can [upload to codecov](https://codecov.io/).
Copy file name to clipboardExpand all lines: tutorials/1-installable-code.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -414,8 +414,10 @@ Python versions your package supports. While this won't impact your package buil
414
414
Also because we are assuming you're creating a pure Python package, you can remove the following classifiers:
415
415
416
416
```toml
417
+
classifiers = [
417
418
"Programming Language :: Python :: Implementation :: CPython",
418
419
"Programming Language :: Python :: Implementation :: PyPy",
420
+
]
419
421
```
420
422
421
423
Your new pyproject.toml file should now look something like this:
@@ -480,7 +482,7 @@ While you can do this using hatch, we are going to use pip for this lesson, so y
480
482
481
483
:::{todo}
482
484
Add this back in when the lesson is published
483
-
- Activate the Python environment that you wish to use. If you need help with working with virtual environments [check out this lesson](extras/1-create-environment.md).
485
+
- Activate the Python environment that you wish to use. If you need help with working with virtual environments check out this lesson (add link).
484
486
:::
485
487
486
488
```bash
@@ -613,13 +615,11 @@ In the upcoming lessons you will:
613
615
* Add more metadata to your `pyproject.toml` file to support PyPI publication.
614
616
* learn how to publish to **conda-forge** from **PyPI**.
615
617
616
-
617
618
* Add a [README file](add-readme.md) and [LICENSE](add-license-coc.md) to your package
618
-
* [Add more metadata to your `pyproject.toml`](5-pyproject-toml.md) file to support PyPI publication.
619
+
* [Add more metadata to your `pyproject.toml`](pyproject-toml.md) file to support PyPI publication.
619
620
* [Learn how to build your package distribution](publish-pypi) files (**sdist** and **wheel**) and publish to **test PyPI**.
620
621
* Finally you will learn how to [publish to **conda-forge**](publish-conda-forge) from **PyPI**.
Copy file name to clipboardExpand all lines: tutorials/add-license-coc.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -153,7 +153,7 @@ You can use your code of conduct as a tool that can be referenced when moderatin
153
153
If you are unsure of what language to add to your `CODE_OF_CONDUCT`
154
154
file, we suggest that you adopt the [contributor covenant language](https://www.contributor-covenant.org/version/2/1/code_of_conduct/) as a starting place.
Copy file name to clipboardExpand all lines: tutorials/intro.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -290,7 +290,7 @@ You can install a Python package into a Python environment in the same way
290
290
you might install NumPy or Pandas. Installing your package into an environment
291
291
allows you to access it from any code run with that specific Python environment activated.
292
292
293
-
:::{figure-md} packages-environment
293
+
:::{figure-md} packages-environment-install
294
294
295
295
<imgsrc="../images/tutorials/environment-package-install.png"alt="Diagram showing the steps associated with creating a package and then installing it. The first arrow says your package and the second says pip install package. The second arrow leads to a box that represents a Python environment that already has some packages installed such as Pandas and NumPy. Your package will also get installed into that same environment when you pip install it."width="700px">
296
296
@@ -315,11 +315,11 @@ Then you can create a conda-forge recipe using the [Grayskull](https://github.co
315
315
316
316
[You will learn more about the conda-forge publication process here.](publish-conda-forge.md)
<imgsrc="../images/tutorials/publish-package-pypi-conda.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">
320
320
321
321
In the image above, you can see the steps associated with publishing
322
-
your package on PyPI and conda-forge. Note that the distribution files that PyPI requires are the [sdist](#python-source-distribution) and [wheel](#python-wheel) files. Once you are ready to make your code publicly installable, you can publish it on PyPI. Once your code is on PyPI it is straight forward to then publish to conda-forge. You create a recipe using the Grayskull package and then you open a pr in the conda-forge recipe repository. You will learn more about this process in the [conda-forge lesson](#).
322
+
your package on PyPI and conda-forge. Note that the distribution files that PyPI requires are the [sdist](#python-source-distribution) and [wheel](#python-wheel) files. Once you are ready to make your code publicly installable, you can publish it on PyPI. Once your code is on PyPI it is straight forward to then publish to conda-forge. You create a recipe using the Grayskull package and then you open a pr in the conda-forge recipe repository. You will learn more about this process in the [conda-forge lesson](/tutorials/publish-conda-forge).
Copy file name to clipboardExpand all lines: tutorials/publish-conda-forge.md
-4
Original file line number
Diff line number
Diff line change
@@ -372,10 +372,6 @@ Below we break down each element of that list.
372
372
>
373
373
> -[x] Package does not ship static libraries. If static libraries are needed, [follow CFEP-18](https://github.com/conda-forge/cfep/blob/main/cfep-18.md).
374
374
375
-
:::{note}
376
-
377
-
:::
378
-
379
375
**Translation:** A static library refers to a copy of a package built into your package. If your package is a pure Python package, then you can check that your package does not ship static libraries as this does not apply to you.
380
376
381
377
The pyOpenSci tutorials are all pure Python and as such do not use static libraries in a linked or shipped (included in the package distribution) format.
Copy file name to clipboardExpand all lines: tutorials/publish-pypi.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -227,7 +227,7 @@ Show them how to do this
227
227
2. update the module repository directory to be the same
228
228
:::
229
229
230
-
:::{figure-md} build-workflow-tutorial
230
+
:::{figure-md} test-pypi-search
231
231
<imgsrc="../images/tutorials/testpypi-search.png"alt="This is a screenshot of the test PyPI website. At the top in the search bar, you can see the search for pyosPackage. The search return says there were no results for pyosPackage Did you mean probpackage"width="700px">
232
232
233
233
Before you try to upload to test PyPI, check to see if the name of your package is already taken. You can do that using
Copy file name to clipboardExpand all lines: tutorials/pyproject-toml.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Make your Python package PyPI ready - pyproject.toml
2
2
3
-
In [the installable code lesson](2-installable-code), you learned how to add the bare minimum information to a `pyproject.toml` file to make it installable. You then learned how to [publish a bare minimum version of your package to PyPI](publish-pypi.md).
3
+
In [the installable code lesson](1-installable-code), you learned how to add the bare minimum information to a `pyproject.toml` file to make it installable. You then learned how to [publish a bare minimum version of your package to PyPI](publish-pypi.md).
- What build backend to use to build your package (we are using `hatchling` in this tutorial but there are [many others to chose from](build-backend-options)).
79
+
- What build backend to use to build your package (we are using `hatchling` in this tutorial but there are [many others to choose from](/package-structure-code/python-package-build-tools)).
80
80
- How and where to retrieve your package's version:
81
81
-**statically** where you declare the version `version = "0.1.0"` or
82
82
-**dynamically** where the tool looks to the most recent tag in your history to determine the current version.
@@ -94,7 +94,7 @@ repository to quickly understand your package's structure such as:
94
94
Finally, the pyproject.toml file is also often used to configure tools such as static type checkers (e.g. mypy) and code formatters/linters (e.g. black, ruff).
95
95
96
96
:::{tip}
97
-
Check out the [PyPA documentation](https://packaging.python.org/en/latest/tutorials/packaging-projects/#creating-pyproject-toml) if you are interested in setting build configurations for other tools.
97
+
Check out the [PyPA documentation](https://packaging.python.org/en/latest/tutorials/packaging-projects/#choosing-a-build-backend) if you are interested in setting build configurations for other tools.
98
98
99
99
Note that some build tools may deviate in how they store project metadata. As such you may want to refer to their documentation if you decide to use a tool other than Hatch and hatchling. We have selected hatchling and hatch as our tool of choice for this tutorial as it adheres to PyPA rules and guidelines.
100
100
@@ -328,7 +328,7 @@ resolving a Python environment more challenging. As such only
328
328
pin dependencies to a specific version if you absolutely need to
329
329
do so.
330
330
331
-
One build tool that you should be aware of that pins dependencies to an upper bound by default is Poetry. [Read more about how to safely add dependencies with Poetry, here.](../package-structure-code/python-package-build-tools.html#challenges-with-poetry)
331
+
One build tool that you should be aware of that pins dependencies to an upper bound by default is Poetry. [Read more about how to safely add dependencies with Poetry, here.](challenges-with-poetry)
0 commit comments