Metadata-Version: 2.4
Name: canipypi
Version: 0.1.1
Summary: Check whether PyPI will accept a project name.
Author: canipypi contributors
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/AnswerDotAI/canipypi
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx
Requires-Dist: packaging
Requires-Dist: stdlib-list
Provides-Extra: dev
Requires-Dist: fastship; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# canipypi

Check whether PyPI will accept a project name.

## Usage

```console
$ canipypi unicodemath requests
unicodemath: appears available
requests: conflicts with existing project 'requests'
```

Several names are checked with a single download of the PyPI index. The command exits with status 0 when every name appears available, 1 when a public PyPI rule rejects any of them, and 2 when PyPI cannot be queried.

`pypi_names` caches its download for the life of the process, so repeated `check_name` calls share one fetch of the PyPI index; an explicit project-name collection can also be passed:

```python
from canipypi import check_name, pypi_names

projects = pypi_names()
result = check_name('unicodemath', projects)
result.available
```

`canipypi` checks project-name syntax, conflicts with Python standard-library modules, standard PyPI name normalization, and Warehouse's stricter similarity normalization.

PyPI's explicit prohibited-name list is private. An available result is therefore not a guarantee, and another user may register the name before you do.

## Release management

`release_sizes` returns each release's uploaded bytes. `delete_release` and `prune_releases` use a `fastcdp` Page attached to a signed-in PyPI tab. Cookies and CSRF tokens stay in the browser. Deletion is permanent, and deleted filenames cannot be uploaded again.

```python
from canipypi.manage import release_sizes, delete_release, prune_releases

sizes = release_sizes('my-project')
sum(sizes.values()) / 2**30  # Total GiB
await delete_release(page, 'my-project', '0.1.0')
await prune_releases(page, 'my-project', keep=5)
```

Pruning deletes older versions in version order, retaining the newest five by default. It stops on the first failed deletion. The page must be signed into PyPI with permission to manage the project.
