Import Mappings

The plugin maps import names to PyPI package names automatically. By default, it converts underscores to dashes (e.g. my_package -> my-package). For packages where the import name differs from the PyPI name, a built-in mapping table is used.

Built-in Mappings

Import Name

PyPI Package

Bio

biopython

Crypto

pycryptodome

IPython

ipython

PIL

pillow

adjustText

adjusttext

attr

attrs

bs4

beautifulsoup4

cv2

opencv-python

dateutil

python-dateutil

gi

pygobject

google

google-api-python-client

mpl_toolkits

matplotlib

pkg_resources

setuptools

resvg

resvg-py

serial

pyserial

skimage

scikit-image

sklearn

scikit-learn

usb

pyusb

wx

wxpython

yaml

pyyaml

Adding Custom Mappings

Use pep723_extra_mappings in pyproject.toml:

[tool.pytest.ini_options]
pep723_extra_mappings =
    myspecial=my-special-pkg

Default Normalization

For imports not in the mapping table, the plugin normalizes by:

  1. Converting underscores to dashes (my_package -> my-package)

  2. Lowercasing (MyPackage -> mypackage)

This matches the most common PyPI naming convention.