How to determine if a Python (import) package name is taken?

For example, these two packages on PyPI have different distribution package name, but the same import name: jupyter-scatter · PyPI and jscatter · PyPI

How can a package author avoid this? In the simple case, they look up similar names on PyPI and parse through the docs for an import statement

It cannot be determined in general. The import name jscatter can be “taken” just by having a in the current working directory. Or another package can install a custom import hook and take the name (like setuptools does for distutils).

If the distribution name = your import name is not taken on PyPI and googling for python your_import_name doesn’t give any relevant results then you’re probably good to go ahead and use that name without much problem.