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: tutorials/publish-pypi.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,10 +27,10 @@ In the previous Python packaging lessons, you've learned:
27
27
In this lesson you will learn how to:
28
28
29
29
- Build your package's source (sdist) and wheel distributions
30
-
- Setup an account on testPyPI (the process is similar for the real PyPI)
31
-
- Publish your package to testPyPI
30
+
- Setup an account on test PyPI (the process is similar for the real PyPI)
31
+
- Publish your package to test PyPI
32
32
33
-
You will do all of your development work in this lesson using Hatch.
33
+
You will do all of your development work in this lesson using [Hatch](https://hatch.pypa.io/latest/).
34
34
35
35
Once your package is on PyPI you can publish it to the conda-forge channel of conda
36
36
using [grayskull](https://conda.github.io/grayskull/).
@@ -46,13 +46,13 @@ You will learn how to publish to conda-forge in the [next lesson](7-publish-cond
46
46
:::
47
47
48
48
:::{figure-md} build-workflow-tutorial
49
-
<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">
49
+
<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. 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">
50
50
51
51
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.
52
52
:::
53
53
54
54
55
-
## Test PyPI.org vs PyPI
55
+
## Test PyPI vs PyPI
56
56
57
57
There are two "warehouses" that you can use to publish
58
58
your Python package.
@@ -61,7 +61,7 @@ your Python package.
61
61
2.**[Real PyPI](https://pypi.org):** This is the PyPI "warehouse" where you can officially publish your Python package. IMPORTANT: only publish your package to PyPI when you are ready for it to be used by others and/or confident that it will become a package that you maintain. PyPI is not a place to practice learning how to publish a Python package.
62
62
63
63
The steps for publishing on test PyPI vs. real PyPI are the same with the
64
-
exception of a different url. Thus, in this lesson you will use testPyPI
64
+
exception of a different url. Thus, in this lesson you will use test PyPI
65
65
to practice and learn.
66
66
67
67
:::{todo}
@@ -78,11 +78,11 @@ There are 4 things that you need to do to publish your Python package
78
78
to PyPI. You need to:
79
79
80
80
1.**Create a package development environment.** You will do this using Hatch.
81
-
1.[**Build your package**](../package-structure-code/python-package-distribution-files-sdist-wheel). Building a package is the process of turning your code into 2 distribution files: an sdist and a wheel. The wheel distribution file is particularly important for users who will `pip install` your package.
81
+
1.[**Build your package**](../package-structure-code/python-package-distribution-files-sdist-wheel). Building a package is the process of turning your code into 2 types of distribution files: sdist and wheel. The wheel distribution file is particularly important for users who will `pip install` your package.
82
82
1.**Create an account on (test) PyPI**: You will need to create a PyPI account and associated token which provides permissions for you to upload your package.
83
83
1.**Publish to PyPI using `hatch publish`**: Once you have completed the above two steps, you are ready to use `hatch` to publish your package!
84
84
85
-
In this lesson you will learn how to publish your package to PyPI you will using [Hatch](https://twine.readthedocs.io/en/stable/).
85
+
In this lesson you will learn how to publish your package to PyPI using [Hatch](https://hatch.pypa.io/latest/).
86
86
In a future lesson, you will learn how to create an automated
87
87
GitHub action workflow that publishes an updated
88
88
version of your package to PyPI every time you create a GitHub release.
@@ -104,7 +104,7 @@ Use Hatch to create your environment.
104
104
```bash
105
105
# This will create a default envt with your package installed in editable mode
106
106
> hatch env create
107
-
# If you have already created an environment this command will return Environment `default` already exists
107
+
# If you have already created an environment this command will return Environment `default` already exists
108
108
```
109
109
110
110
Then view all of the current environments that hatch has access to:
@@ -122,7 +122,7 @@ Then view all of the current environments that hatch has access to:
122
122
Then activate the environment. Note that when you call a shell from a
123
123
Hatch environment, it will automatically install your package into the environment in development or editable mode.
124
124
125
-
```
125
+
```bash
126
126
# Hatch shell can be used to activate your environment
0 commit comments