|
1 | 1 | # Publish your Python package to PyPI
|
2 | 2 |
|
3 | 3 | :::{todo}
|
4 |
| - |
5 | 4 | - emphasize that we recommended the trusted publisher GitHub action for most maintainers
|
6 | 5 | - Make sure they add /dist to their .gitignore file. We have not discussed GitHub workflows anywhere yet. Where does that fit?
|
7 | 6 | - https://hatch.pypa.io/latest/intro/#existing-project <- hatch will migrate from setup.py for you - if we go with hatch then we may want to add this to the installable code lesson
|
8 |
| -- Should we install hatch with pipx? |
| 7 | +::: |
| 8 | + |
9 | 9 |
|
10 | 10 | ```bash
|
11 | 11 | pipx install hatch
|
@@ -38,13 +38,8 @@ using [Grayskull](https://conda.github.io/grayskull/).
|
38 | 38 |
|
39 | 39 | You will learn how to publish to conda-forge in a future lesson.
|
40 | 40 |
|
41 |
| -:::{todo} |
42 |
| -Fix this link once the lesson is published. |
| 41 | +You will learn how to publish to conda-forge in the [next lesson](publish-conda-forge). |
43 | 42 |
|
44 |
| -You will learn how to publish to conda-forge in the [next lesson](7-publish-conda-forge.md). |
45 |
| -::: |
46 |
| - |
47 |
| -::: |
48 | 43 |
|
49 | 44 | :::{figure-md} build-workflow-tutorial
|
50 | 45 | <img src="../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. An arrow to the right takes you to a build distribution files box. Another arrow to the right takes you to a publish to PyPI box which has an arrow containing sdist and wheel that notes those files go to PyPI for hosting. From PyPI is an arrow containing sdist since you can then connect to conda-forge for an automated build that sends distributions from PyPI to conda-forge." width="700px">
|
@@ -191,10 +186,8 @@ You can learn more about
|
191 | 186 | building in the [build page of our packaging guide](../package-structure-code/python-package-distribution-files-sdist-wheel).
|
192 | 187 | :::
|
193 | 188 |
|
194 |
| -:::{todo} |
195 | 189 | The sdist is important if you wish to [publish
|
196 |
| -your package to conda-forge](7-publish-conda-forge) which you will learn about in a later lesson. |
197 |
| -::: |
| 190 | +your package to conda-forge](publish-conda-forge). You will learn about this in a later lesson. |
198 | 191 |
|
199 | 192 | :::{todo}
|
200 | 193 | ➜ hatch build
|
@@ -232,7 +225,7 @@ Show them how to do this
|
232 | 225 |
|
233 | 226 | 1. update the project-name in the pyproject.toml file
|
234 | 227 | 2. update the module repository directory to be the same
|
235 |
| - ::: |
| 228 | +::: |
236 | 229 |
|
237 | 230 | :::{figure-md} build-workflow-tutorial
|
238 | 231 | <img src="../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">
|
@@ -361,14 +354,12 @@ testPyPI as a permanent way to install your package. Test PyPi is a perfect plac
|
361 | 354 | In this lesson you are using Hatch and hatchling to create, build and publish your Python Package. [Click here to learn about other packaging tools in the ecosystem.](../package-structure-code/python-package-build-tools.md)
|
362 | 355 | :::
|
363 | 356 |
|
364 |
| - |
365 |
| -<!-- TODO: venv will always be different for windows - do we need a third tab?? Also is conda different on windows? i forget --> |
366 |
| - |
367 |
| -<!--TODO: teach them to setup trusted publisher for actions... in the actions lesson |
| 357 | +:::{todo} |
| 358 | +teach them to setup trusted publisher for actions... in the actions lesson |
368 | 359 | https://pypi.org/help/#twofa
|
369 | 360 |
|
370 | 361 | from PyPI: https://pypi.org/help/#apitoken - You can create a token for an entire PyPI account, in which case, the token will work for all projects associated with that account. Alternatively, you can limit a token's scope to a specific project.
|
371 |
| - --> |
| 362 | +::: |
372 | 363 |
|
373 | 364 | ## Package-specific token vs trusted publisher
|
374 | 365 |
|
|
0 commit comments