Skip to content

Commit 0451cc0

Browse files
alchemysttheacodes
authored andcommitted
Elaborate on how the tutorial differs from the real packaging process (#602)
* Elaborate on how the tutorial differs from the real packaging process * Reword username instruction for package name * Revert incorrect change and reword username instructions * Fix newline in bullet * Re-flow paragraphs
1 parent 1e5db9e commit 0451cc0

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

source/tutorials/packaging-projects.rst

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ code in there:
3333
name = "example_pkg"
3434
3535
This is just so that you can verify that it installed correctly later in this
36-
tutorial.
36+
tutorial and is not used by PyPI.
3737

3838
.. _Python documentation for packages and modules:
3939
https://docs.python.org/3/tutorial/modules.html#packages
@@ -63,7 +63,7 @@ Creating setup.py
6363
about your package (such as the name and version) as well as which code files
6464
to include.
6565

66-
Open :file:`setup.py` and enter the following content. You **should** update the package name to include your username (for example, ``example-pkg-theacodes``. You can personalize the other values if you'd like:
66+
Open :file:`setup.py` and enter the following content. Update the package name to include your username (for example, ``example-pkg-theacodes``), this ensures that you have a unique package name and that your package doesn't conflict with packages uploaded by other people following this tutorial.
6767

6868
.. code-block:: python
6969
@@ -95,7 +95,7 @@ minimal set:
9595

9696
- ``name`` is the *distribution name* of your package. This can be any name as long as only
9797
contains letters, numbers, ``_`` , and ``-``. It also must not already
98-
taken on pypi.org. **Be sure to update this with your username,** as this ensures you won't run into any name collisions when you upload the package.
98+
taken on pypi.org. **Be sure to update this with your username,** as this ensures you won't try to upload a package with the same name as one which already exists when you upload the package.
9999
- ``version`` is the package version see :pep:`440` for more details on
100100
versions.
101101
- ``author`` and ``author_email`` are used to identify the author of the
@@ -115,7 +115,7 @@ minimal set:
115115
Instead of listing each package manually, we can use :func:`find_packages`
116116
to automatically discover all packages and subpackages. In this case, the
117117
list of packages will be `example_pkg` as that's the only package present.
118-
- ``classifiers`` tell the index and :ref:`pip` some additional metadata
118+
- ``classifiers`` gives the index and :ref:`pip` some additional metadata
119119
about your package. In this case, the package is only compatible with Python
120120
3, is licensed under the MIT license, and is OS-independent. You should
121121
always include at least which version(s) of Python your package works on,
@@ -321,12 +321,20 @@ Next steps
321321

322322
Keep in mind that this tutorial showed you how to upload your package to Test
323323
PyPI, which isn't a permanent storage. The Test system occasionally deletes
324-
packages and accounts. If you want to upload your package to the real Python
325-
Package Index you can do it by registering an account on https://pypi.org and
326-
following the same instructions, however, use ``twine upload dist/*`` to upload
327-
your package and enter your credentials for the account you registered on the
328-
real PyPI. You can install your package from the real PyPI using
329-
``pip install [your-package]``.
324+
packages and accounts. It is best to use Test PyPI for testing and experiments like this tutorial.
325+
326+
When you are ready to upload a real package to the Python Package Index you can
327+
do much the same as you did in this tutorial, but with these important
328+
differences:
329+
330+
* Choose a memorable and unique name for your package. You don't have to append
331+
your username as you did in the tutorial.
332+
* Register an account on https://pypi.org - note that these are two separate
333+
servers and the login details from the test server are not shared with the
334+
main server.
335+
* Use ``twine upload dist/*`` to upload your package and enter your credentials
336+
for the account you registered on the real PyPI.
337+
* Install your package from the real PyPI using ``pip install [your-package]``.
330338

331339
At this point if you want to read more on packaging Python libraries here are
332340
some things you can do:

0 commit comments

Comments
 (0)