Quick fix, just run these commands if Twine refuses to install on PyPy on Windows due to a weird error about the nh3 package needing the non-PyPI dependency, Rust:

REM on Windows
pip install -v "readme-renderer < 42.0"  & REM https://github.com/pypa/twine/issues/1015
pip install twine
# on Mac and Linux
pip install -v "readme-renderer < 42.0"  # https://github.com/pypa/twine/issues/1015
pip install twine

This won't pollute your registry or any other folders than the current one with an installation of rust or rustc or cargo or the rust updater or the rust updater installer or whatever other weird litter the kids are advocating for your system these days

Alternatively, if you really need some feature of readme-renderer >= 42.0, here's a less simple workaround that provides all the same guarantees as the previous one:

REM on Windows
REM https://github.com/pypa/twine/issues/1015
REM https://github.com/pypa/readme_renderer/blob/42.0/pyproject.toml#L10
REM https://github.com/messense/nh3/blob/v0.2.15/.github/workflows/CI.yml#L58
REM https://github.com/rust-lang/rust-forge/issues/225
REM https://github.com/rust-lang/rust/issues/116028
REM https://github.com/rust-lang/cargo/issues/1734

set /p="Download TGZ from https://forge.rust-lang.org/infra/other-installation-methods.html#standalone-installers then press Enter"
msiexec /a "%USERPROFILE%\Downloads\rust-1.75.0-x86_64-pc-windows-msvc.msi" /qb TARGETDIR="%cd%"
cmd /C set ^"PATH=%cd%\Rust\bin;%PATH%^" ^& set ^"CARGO_TARGET_DIR=%cd%\Rust\.cargo^" ^& python -m pip install -v twine
# on Linux
# https://github.com/pypa/twine/issues/1015
# https://github.com/pypa/readme_renderer/blob/42.0/pyproject.toml#L10
# https://github.com/messense/nh3/blob/v0.2.15/.github/workflows/CI.yml#L58
# https://github.com/rust-lang/rust-forge/issues/225
# https://github.com/rust-lang/rust/issues/116028
# https://github.com/rust-lang/cargo/issues/1734

read -p "Download MSI from https://forge.rust-lang.org/infra/other-installation-methods.html#standalone-installers then press Enter"
tar x -zf "$HOME/Downloads/rust-1.75.0-x86_64-unknown-linux-gnu.tar.gz"
PATH="$PWD/rust-1.75.0-x86_64-unknown-linux-gnu/rustc/bin:$PWD/rust-1.75.0-x86_64-unknown-linux-gnu/cargo/bin:$PATH" python -m pip install -v twine

Leave a Reply

Your email address will not be published. Required fields are marked *

Warning: This site uses Akismet to filter spam. Until or unless I can find a suitable replacement anti-spam solution, this means that (per their indemnification document) all commenters' IP addresses will be sent to Automattic, Inc., who may choose to share such with 3rd parties.
If this is unacceptable to you, I highly recommend using an anonymous proxy or public Wi-Fi connection when commenting.