Skip to content

Avoid fetching dependencies from TestPyPI - #2191

Merged
rgommers merged 1 commit into
pypa:mainfrom
rgommers:testpypi-usage-warning
Nov 17, 2026
Merged

rgommers merged 1 commit into
pypa:mainfrom
rgommers:testpypi-usage-warning

Conversation

@rgommers

@rgommers rgommers commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Use --no-deps and require a wheel to avoid downloading runtime or build dependencies from TestPyPI. Replace mixed-index installation advice with separate dependency installation from PyPI, and explain the risk of unintended or malicious packages.

The packaging tutorial already uses --no-deps and has similar guidance.

Closes gh-1500


📚 Documentation preview 📚: https://python-packaging-user-guide--2191.org.readthedocs.build/en/2191/

Use `--no-deps` and require a wheel to avoid downloading runtime or
build dependencies from TestPyPI. Replace mixed-index installation
advice with separate dependency installation from PyPI, and explain
the risk of unintended or malicious packages.

The packaging tutorial already uses `--no-deps` and has similar
guidance.

Closes pypagh-1500
@rgommers rgommers added type: bug A confirmed bug or unintended behavior component: guides labels Nov 13, 2026
@rgommers
rgommers added this pull request to the merge queue Nov 17, 2026
Merged via the queue into pypa:main with commit 70421ab Nov 17, 2026
10 of 11 checks passed
@rgommers
rgommers deleted the testpypi-usage-warning branch November 17, 2026 09:27
The ``--index-url`` flag selects TestPyPI instead of PyPI. The ``--no-deps``
flag prevents installing runtime dependencies, while ``--only-binary=:all:``
requires a wheel, avoiding installation of build dependencies. If your package
has dependencies, install them separately from PyPI before running these commands.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an existing doc about this to link to, or can an example of pip install --only-deps be added here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@merwok sure, if you think it's necessary. What I'd add is:

(for example, run ``pip install --only-deps .`` from your project directory).

The one hiccup is that it requires pip 26.2, which adds more noise if we explain that. I'm okay with that though; recommending outdated install methods would be worse.

WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it’s useful to explain how to achieve what is recommended!

Wonder how to make this a small parenthese, not a long sentence. The pip docs is cli/pip-install but doesn’t have a version added note, so I wouldn’t want to trap people using older versions.

I like your suggested text better than a link then. Could it be:

(for example, run ``pip install --only-deps .`` from your project directory -- you'll need pip 26.2 or newer).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, I think that works - see gh-2210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: guides type: bug A confirmed bug or unintended behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warn against using pip with test.pypi.org

3 participants