Skip to content

Commit 6a0f79d

Browse files
authored
simplify test of example package
1 parent 376e716 commit 6a0f79d

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

source/tutorials/packaging-projects.rst

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ To create this project locally, create the following file structure:
2525
Once you create this structure, you'll want to run all of the commands in this
2626
tutorial within the top-level folder - so be sure to ``cd packaging_tutorial``.
2727

28-
Next edit :file:`example_pkg/__init__.py` and insert the following code:
29-
30-
.. code-block:: python
31-
32-
test_string = "hello"
33-
34-
We'll use this later in the tutorial to verify that the package installed correctly.
35-
3628
.. _Python documentation for packages and modules:
3729
https://docs.python.org/3/tutorial/modules.html#packages
3830

@@ -292,25 +284,21 @@ something like this:
292284
293285
.. note:: This example uses ``--index-url`` flag to specify TestPyPI instead of live PyPI. Additionally, it specifies ``--no-deps``. Since TestPyPI doesn't have the same packages as the live PyPI, it's possible that attempting to install dependencies may fail or install something unexpected. While our example package doesn't have any dependencies, it's a good practice to avoid installing dependencies when using TestPyPI.
294286

295-
You can test that it was installed correctly by importing the module and
296-
referencing the ``name`` property you put in :file:`__init__.py` earlier.
297-
287+
You can test that it was installed correctly by importing the package.
298288
Run the Python interpreter (make sure you're still in your virtualenv):
299289

300290
.. code-block:: bash
301291
302292
python
303293
304-
And then import the module and print out the ``name`` property. This should be
305-
the same regardless of what you name you gave your :term:`distribution package`
306-
in :file:`setup.py` (in this case, ``example-pkg-YOUR-USERNAME-HERE``) because your :term:`import package` is ``example_pkg``.
294+
and from the interpreter shell import the package:
307295

308296
.. code-block:: python
309297
310298
>>> import example_pkg
311-
>>> example_pkg.test_string
312-
'hello'
313299
300+
Note that the :term:`import package` is ``example_pkg`` regardless of what name you gave your :term:`distribution package`
301+
in :file:`setup.py` (in this case, ``example-pkg-YOUR-USERNAME-HERE``).
314302

315303
Next steps
316304
----------

0 commit comments

Comments
 (0)