Importing Python libraries with hyphen in the name

Question:

I create a Python library. It requires a Git repository and a name. I name it my-library and also inside the package folder my-package.

How should I:

  1. install library my-library after I upload it to PyPI?
  2. import the package my-package after I install the library?
Asked By: Bruno Peixoto

||

Answers:

You can name and install it from PyPi as "my-package" but you have to import it as "my_package"

Answered By: Hexye