Question
Using hyphen/dash in python repository name and package name
I am trying to make my git repository pip-installable. In preparation for that I am restructuring the repo to follow the right conventions. My understanding from looking at other repositories is that I should put all my source code in a package that has the same name as the repository name. E.g. if my repository is called myrepo
, then the source code would all go into a package also called myrepo
.
My repository has a hyphen in it for readability: e.g. my-repo
. So if I wanted to make a package for it with the same name, it would have a hyphen in it as well. In this tutorial it says "don't use hyphens" for python package names. However I've seen well-established packages such as scikit-learn
that have hyphens in their name. One thing that I have noticed though is that in the scikit-learn
repo, the package name is not the same as the repo name and is instead called sklearn
.
I think my discussion above boils down to the following questions:
- When packaging a repo, what is the relationship between the repository's name and the package's name? Is there anything to beware of when having names that don't match?
- Is it okay to have hyphens in package names? What about in repository names?
- If the package name for
scikit-learn
issklearn
, then how come when I install it I dopip install scikit-learn
instead ofpip install sklearn
?