# claim-or-update-a-pypi-name

Before you upload: check a PyPI/TestPyPI name (PEP 503 normalization, PEP 508 syntax, taken or free) and plan the next version (refuses versions that exist, were deleted, or sort older than the latest).

- **Space:** package-publishing-public (https://github.com/Tech-Realm/space-package-publishing-public/tree/main/claim-or-update-a-pypi-name)
- **Level:** L2 (as the registry reports it)
- **Keys it needs (names only):** PYPI_TOKEN
- **Tools:** python3
- **Routes:** json-api, claim-by-upload; checks: 5
- **Uses:** new (no recorded use yet)
- **Install:** `logicpacks pack use package-publishing-public/claim-or-update-a-pypi-name` or MCP `get_pack package-publishing-public/claim-or-update-a-pypi-name`
- **Files:** CHANGELOG.md, code/pypi_name.py, outcome/EVIDENCE.md, outcome/checks.yaml, outcome/fixtures/cases.json, outcome/results.json, pack.yaml, refs/refs.yaml, spec/SPEC.md, spec/source.md

## Purpose (spec/SPEC.md)

Decide whether a package name can be claimed on PyPI (or TestPyPI), and whether a planned version can be uploaded,
before running the publish pack.

## Goal

`pypi_name.py status NAME` says taken or available (normalized), and `pypi_name.py plan NAME VERSION` says ok, or
refuses with the reason and the next usable version.

## Steps

1. Syntax: `python3 code/pypi_name.py valid NAME` (letters, digits, `. _ -`, start and end alphanumeric).
2. Normalize: `python3 code/pypi_name.py normalize NAME`. PyPI treats `Foo_Bar.baz` and `foo-bar-baz` as one name.
3. Look up: `python3 code/pypi_name.py status NAME` (add `--test` for test.pypi.org; the two indexes are separate,
   so claim the TestPyPI name too if you rehearse there).
4. Claim a free name: the first successful upload claims it (publish-python-package-to-pypi), or create a pending
   trusted publisher on pypi.org (GitHub Actions OIDC) to reserve it without a token.
5. Update a name you own: `python3 code/pypi_name.py plan NAME VERSION`; if refused, `python3 code/pypi_name.py bump
   <latest> patch` and bump pyproject + `__version__`.
6. A taken but abandoned name: PEP 541 request on the pypi/support tracker; there is no other transfer path.

## Edge cases

- "Available" from the JSON API is not a guarantee: PyPI blocks names too similar to existing projects
  (confusables) and prohibited names; only the upload proves the claim.
- The `releases` map keeps versions whose files were deleted. Those versions can never be uploaded again.
- An upload with a version lower than the latest is allowed, but installers keep resolving the latest, so the plan
  refuses it unless you mean a backport.
- The JSON API is CDN-cached: a version uploaded a minute ago may still look missing.

## Don'ts

- Don't register throwaway names to squat them (PyPI terms; PEP 541 removes them).
- Don't delete a release to "fix" it: the version number is burned. Upload a .post or patch release.



---

Canonical URL: https://logicpacks.io/packs/package-publishing-public/claim-or-update-a-pypi-name

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](/llms.txt). Plain facts: [/about.md](/about.md). Safety: [/safety.md](/safety.md).
