molt yank
Check a released version and print the exact steps to yank it on PyPI (PEP 592).
molt yankdoes not yank for you. PyPI provides no supported way for a tool to yank a release: it is a web-UI action, there is no API endpoint, and an upload token does not grant it. Somolt yankdoes the part it can: verify the version, tell you whether it is already yanked, and hand you the exact URL and steps. You complete the yank in your browser. See The manual step.
Synopsis
Description
PyPI is immutable: a published version cannot be deleted or overwritten. But PEP 592 lets you yank it. A yanked version is still installable by an exact pin that already depends on it, so nothing that already resolved to it breaks -- but resolvers stop selecting it for new installs. It is the correct response to a release that is broken but must remain downloadable for reproducibility.
molt yank is the guided front end to that. It reads the index's public JSON API and reports:
- whether
<package>exists and<version>is actually on the index, - whether that version is already yanked, and the reason recorded on it,
- the release-management URL and the steps to complete the yank, with your
--reasontext ready to paste.
It contacts only the public read API, so it needs no credentials and changes nothing. Run it before you go clicking -- it catches the typo'd version number that would otherwise have you yanking the wrong release.
The manual step
PEP 592 specifies how installers read a yank, through the data-yanked attribute in the Simple API. It leaves it to each index to decide how a maintainer sets one. PyPI implements setting it as a web form on the release-management page only:
- there is no documented API endpoint for yanking,
twinehas no yank command,- PyPI API tokens are scoped to uploads, so the credential your CI already holds could not perform a yank even if an endpoint existed. Project management requires a logged-in session with 2FA,
- only a project Owner may yank; a Maintainer cannot.
Molt does not drive an undocumented HTML form with your account password to work around that. Some third-party indexes, such as devpi and Artifactory, do expose yank APIs; molt yank reports on those indexes but does not complete the yank on them either.
Options
molt yank takes no --dry-run: it never mutates, so every run is already a dry run. It takes no --yes either -- there is nothing to confirm.
Exit codes
Examples
Check a broken patch and get the steps, with the reason ready to paste:
Check the steps to un-yank once the record is corrected:
Check a version on another index:
See also
- Yanking a release -- when to yank, and when to release a fix instead.
- molt publish.