Skip to content

Commit 70421ab

Browse files
authored
Merge pull request #2191 from rgommers/testpypi-usage-warning
Avoid fetching dependencies from TestPyPI
2 parents faf13fd + c634a9b commit 70421ab

1 file changed

Lines changed: 13 additions & 17 deletions

File tree

‎source/guides/using-testpypi.rst‎

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,36 +38,32 @@ your project to appear on the site.
3838
Using TestPyPI with pip
3939
-----------------------
4040

41-
You can tell :ref:`pip` to download packages from TestPyPI instead of PyPI by
42-
specifying the ``--index-url`` flag:
41+
You can use :ref:`pip` to install a wheel that you uploaded to TestPyPI:
4342

4443
.. tab:: Unix/macOS
4544

4645
.. code-block:: bash
4746
48-
python3 -m pip install --index-url https://test.pypi.org/simple/ your-package
47+
python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps --only-binary=:all: your-package
4948
5049
.. tab:: Windows
5150

5251
.. code-block:: bat
5352
54-
py -m pip install --index-url https://test.pypi.org/simple/ your-package
53+
py -m pip install --index-url https://test.pypi.org/simple/ --no-deps --only-binary=:all: your-package
5554
56-
If you want to allow pip to also download packages from PyPI, you can
57-
specify ``--extra-index-url`` to point to PyPI. This is useful when the package
58-
you're testing has dependencies:
55+
The ``--index-url`` flag selects TestPyPI instead of PyPI. The ``--no-deps``
56+
flag prevents installing runtime dependencies, while ``--only-binary=:all:``
57+
requires a wheel, avoiding installation of build dependencies. If your package
58+
has dependencies, install them separately from PyPI before running these commands.
5959

60-
.. tab:: Unix/macOS
61-
62-
.. code-block:: bash
63-
64-
python3 -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ your-package
65-
66-
.. tab:: Windows
67-
68-
.. code-block:: bat
60+
.. warning::
6961

70-
py -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ your-package
62+
TestPyPI is a separate index, and packages there may be missing or unrelated
63+
to packages with the same name on PyPI. Installing dependencies from TestPyPI
64+
could install unintended or malicious packages. Avoid combining the two
65+
indexes with ``--extra-index-url``: pip does not prioritize one index over
66+
the other, so dependencies could still be downloaded from TestPyPI.
7167

7268
Setting up TestPyPI in :file:`.pypirc`
7369
--------------------------------------

0 commit comments

Comments
 (0)