typeshed-internal / stub_uploader

Scripts and actions to auto-upload typeshed stubs to PyPI
Apache License 2.0
21 stars 16 forks source link

Package names have hyphen #32

Closed jjl-genemod closed 2 years ago

jjl-genemod commented 2 years ago

Hello, I think I've run into an issue due to this project where the packages installed via pip have hyphens in their names, which makes them hard to import.

Repro steps:

  1. Install a given types package, eg pip install types-stripe
  2. Attempt to import the package, eg from stripe_stubs import SubscriptionSchedule

Expected result: We should be able to import the stripe_stubs package without any issue.

Actual result: Python cannot find the package.

Discussion: The core issue is that python cannot import packages with hyphens in the names of the directory inside of the project/system env/lib/python3.X/site-packages folder. Most projects will replace any hyphens with underscores so this problem does not happen.

JelleZijlstra commented 2 years ago

You are not supposed to be able to import from the stub files. They are used only by static type checkers. See PEP 561 for details.