What is the best way to check if a PyPI package name is taken?

Viewed 1121

What is the best way to check if a PyPI package name is taken?

Several times now I have searched pypi for a package and received no results. Then I have taken the time to create a package with a name seemingly not taken, only to receive an error when I deploy. Is there a better way to check package name availability?

2 Answers

As far as I know it seems that is trial and error situation. Nevertheless you can always try pip install <name_package> to see if the name is already taken.

If you are interesting in deploying your package and don't facing up indexes errors from PyPi, you can always try out to deploy your code to TestPyPi. You will have to replace this first command:

python -m twine upload --repository pypi dist/*

by

python -m twine upload --repository testpypi dist/*

I just made a python package for that same use, it's called pkg_name_validator.

To install it, just run

pip install pkg_name_validator

Using it is as simple as using python -m, like so:

python -m pkg_name_validator <package name to validate>

And if you need any help, just run:

python -m pkg_name_validator -h
Related