Renaming a Package That Already Has Users

No major registry lets you simply rename a package in place. A rename is really two packages: a new name you publish going forward, and an old name you wind down carefully so nobody is stranded or redirected to something unsafe. This plan sets out the steps, an illustrative timeline, and the traps that make renames go wrong.

Step 1: be sure, and pick the name once

A rename costs every user a change. Do it for a lasting reason, such as a trademark complaint, a name that misleads, or merging several packages, rather than for taste. Then check the new name on every registry you publish to, along with the obvious misspellings, and reserve it in each. On npm, consider a scope you control (@example/widget), which makes impersonation harder.

Step 2: publish under the new name

  1. Change the name in the manifest. In Python, also decide whether the import name changes; if it does, that is a bigger migration than the distribution name.
  2. Publish a first version that is functionally identical to the latest version of the old package. Using the same version number, or the next one, makes the relationship obvious.
  3. Update the README, repository description and documentation to the new name.

Step 3: point the old name at the new one

EcosystemHow to signal the move
npmnpm deprecate old-widget "Renamed to @example/widget"; the message is shown on install
PyPIPublish a final release of the old name whose README explains the move; optionally make it depend on the new package and re-export it
GoAdd a // Deprecated: comment to the old module's module line in go.mod and tag a release
crates.ioPublish a final version with a README notice and mark the old crate's items deprecated

A thin compatibility release of the old name, which depends on and re-exports the new one, lets existing users keep receiving fixes until they switch.

# old name's final pyproject.toml (illustrative)
[project]
name = "old-widget"
version = "3.0.0"
dependencies = ["example-widget>=3.0"]

Illustrative timeline

Traps to avoid

See also package naming conventions and typosquatting package names.

Related pages