@@ -77,14 +77,9 @@ Creating a test directory
7777Creating pyproject.toml
7878-----------------------
7979
80- :file: `pyproject.toml ` is the file that tells build tools (like ``pip `` and
81- ``build ``) what system you are using and what is required for building. The
82- default if this file is missing is to assume a classic setuptools build system,
83- but it is better to be explicit; if you have a :file: `pyproject.toml ` file, you
84- will be able to rely on ``wheel `` and other packages being present.
85-
86- This file should be ideal for most setuptools projects:
87-
80+ :file: `pyproject.toml ` tells build tools (like :ref: `pip ` and :ref: `build `)
81+ what is required to build your project. This tutorial uses :ref: `setuptools `,
82+ so open :file: `pyproject.toml ` and enter the following content:
8883
8984.. code-block :: toml
9085
@@ -100,12 +95,13 @@ This file should be ideal for most setuptools projects:
10095package. Listing something here will *only * make it available during the build,
10196not after it is installed.
10297
103- ``build-system.build-backend `` is technically optional, but you will get
104- ``setuptools.build_meta:__legacy__ `` instead if you forget to include it, so
105- always include it. If you were to use a different build system, such as
106- :ref: `flit ` or `poetry `_, those would go here, and the configuration details
107- would be completely different than the setuptools configuration described
108- below. See :pep: `517 ` and :pep: `518 ` for background and details.
98+ ``build-system.build-backend `` is the name of Python object that will be used to
99+ perform the build. If you were to use a different build system, such as
100+ :ref: `flit ` or :ref: `poetry `, those would go here, and the configuration details
101+ would be completely different than the :ref: `setuptools ` configuration described
102+ below.
103+
104+ See :pep: `517 ` and :pep: `518 ` for background and details.
109105
110106
111107Configuring metadata
@@ -165,8 +161,9 @@ be required, but can be omitted with newer versions of setuptools and pip.
165161
166162 There are a `variety of metadata and options
167163 <https://setuptools.readthedocs.io/en/latest/userguide/declarative_config.html> `_
168- supported here. This is in configparser format; do not place quotes around values.
169- This example package uses a relatively minimal set of metadata:
164+ supported here. This is in :doc: `configparser <python:library/configparser >`
165+ format; do not place quotes around values. This example package uses a
166+ relatively minimal set of ``metadata ``:
170167
171168 - ``name `` is the *distribution name * of your package. This can be any name as
172169 long as it only contains letters, numbers, ``_ `` , and ``- ``. It also must not
@@ -198,7 +195,7 @@ be required, but can be omitted with newer versions of setuptools and pip.
198195 your package will work on. For a complete list of classifiers, see
199196 https://pypi.org/classifiers/.
200197
201- In the options category, we have controls for setuptools itself:
198+ In the `` options `` category, we have controls for setuptools itself:
202199
203200 - ``package_dir `` is a mapping of package names and directories.
204201 An empty package name represents the "root package" --- the directory in
@@ -212,7 +209,7 @@ be required, but can be omitted with newer versions of setuptools and pip.
212209 to use. In this case, the list of packages will be ``example_pkg `` as
213210 that's the only package present.
214211 - ``python_requires `` gives the versions of Python supported by your
215- project. Installers like pip will look back though older versions of
212+ project. Installers like :ref: ` pip ` will look back though older versions of
216213 packages until it finds one that has a matching Python version.
217214
218215 There are many more than the ones mentioned here. See
@@ -303,7 +300,7 @@ be required, but can be omitted with newer versions of setuptools and pip.
303300 subpackages under ``package_dir ``. In this case, the list of packages will
304301 be ``example_pkg `` as that's the only package present.
305302 - ``python_requires `` gives the versions of Python supported by your
306- project. Installers like pip will look back though older versions of
303+ project. Installers like :ref: ` pip ` will look back though older versions of
307304 packages until it finds one that has a matching Python version.
308305
309306 There are many more than the ones mentioned here. See
@@ -367,14 +364,14 @@ Including other files
367364---------------------
368365
369366The files listed above will be included automatically in your
370- :term: `source distribution <Source Distribution (or "sdist")> `. If you want to control what goes in this
371- explicitly, see :ref: `Using MANIFEST.in `.
367+ :term: `source distribution <Source Distribution (or "sdist")> `. If you want to
368+ control what goes in this explicitly, see :ref: `Using MANIFEST.in `.
372369
373370The final :term: `built distribution <Built Distribution> ` will have the Python
374371files in the discovered or listed Python packages. If you want to control what
375372goes here, such as to add data files, see
376- :std: doc: `Including Data Files <setuptools:userguide/datafiles >`
377- from the :std: doc: `setuptools docs <setuptools:index >`.
373+ :doc: `Including Data Files <setuptools:userguide/datafiles >`
374+ from the :doc: `setuptools docs <setuptools:index >`.
378375
379376.. _generating archives :
380377
@@ -385,7 +382,7 @@ The next step is to generate :term:`distribution packages <Distribution
385382Package> ` for the package. These are archives that are uploaded to the Python
386383Package Index and can be installed by :ref: `pip `.
387384
388- Make sure you have the latest version of PyPA's `` build ` ` installed:
385+ Make sure you have the latest version of PyPA's :ref: ` build ` installed:
389386
390387.. tab :: Unix/macOS
391388
@@ -445,14 +442,13 @@ Uploading the distribution archives
445442
446443Finally, it's time to upload your package to the Python Package Index!
447444
448- The first thing you'll need to do is register an account on Test PyPI , which
445+ The first thing you'll need to do is register an account on TestPyPI , which
449446is a separate instance of the package index intended for testing and
450447experimentation. It's great for things like this tutorial where we don't
451448necessarily want to upload to the real index. To register an account, go to
452449https://test.pypi.org/account/register/ and complete the steps on that page.
453450You will also need to verify your email address before you're able to upload
454- any packages. For more details on Test PyPI, see
455- :doc: `/guides/using-testpypi `.
451+ any packages. For more details, see :doc: `/guides/using-testpypi `.
456452
457453To securely upload your project, you'll need a PyPI `API token `_. Create one at
458454https://test.pypi.org/manage/account/#api-tokens, setting the "Scope" to "Entire
@@ -515,8 +511,8 @@ Installing your newly uploaded package
515511--------------------------------------
516512
517513You can use :ref: `pip ` to install your package and verify that it works.
518- Create a new :ref: `virtualenv ` (see :doc: ` /tutorials/installing-packages ` for
519- detailed instructions) and install your package from TestPyPI:
514+ Create a :ref: `virtual environment < Creating and using Virtual Environments >`
515+ and install your package from TestPyPI:
520516
521517.. tab :: Unix/macOS
522518
@@ -532,7 +528,7 @@ detailed instructions) and install your package from TestPyPI:
532528
533529 Make sure to specify your username in the package name!
534530
535- pip should install the package from Test PyPI and the output should look
531+ pip should install the package from TestPyPI and the output should look
536532something like this:
537533
538534.. code-block :: text
@@ -550,21 +546,21 @@ something like this:
550546 installing dependencies when using TestPyPI.
551547
552548You can test that it was installed correctly by importing the package.
553- Run the Python interpreter (make sure you're still in your virtualenv) :
549+ Make sure you're still in your virtual environment, then run Python :
554550
555551.. tab :: Unix/macOS
556552
557553 .. code-block :: bash
558554
559- python3
555+ python3
560556
561557 .. tab :: Windows
562558
563559 .. code-block :: bash
564560
565- py
561+ py
566562
567- and from the interpreter shell import the package:
563+ and import the package:
568564
569565.. code-block :: python
570566
@@ -583,7 +579,7 @@ Next steps
583579
584580Keep in mind that this tutorial showed you how to upload your package to Test
585581PyPI, which isn't a permanent storage. The Test system occasionally deletes
586- packages and accounts. It is best to use Test PyPI for testing and experiments
582+ packages and accounts. It is best to use TestPyPI for testing and experiments
587583like this tutorial.
588584
589585When you are ready to upload a real package to the Python Package Index you can
@@ -607,8 +603,5 @@ some things you can do:
607603* Read more about using :ref: `setuptools ` to package libraries in
608604 :doc: `/guides/distributing-packages-using-setuptools `.
609605* Read about :doc: `/guides/packaging-binary-extensions `.
610- * Consider alternatives to :ref: `setuptools ` such as :ref: `flit `, `hatch `_,
611- and `poetry `_.
612-
613- .. _hatch : https://github.com/ofek/hatch
614- .. _poetry : https://python-poetry.org
606+ * Consider alternatives to :ref: `setuptools ` such as :ref: `flit `, :ref: `hatch `,
607+ and :ref: `poetry `.
0 commit comments