Why do PEP 561 and typeshed naming conventions conflict?

Here’s something I noticed a while ago that’s puzzled me ever since. For stub-only packages published as a separate distribution/project from the runtime package, there’s two things that need to indicate that relationship: the installed package’s name and the distribution’s name.

  • PEP 561 standardizes the package name as pkgname-stubs.

  • For dist name, I guess there’s no equivalent “official” standard, but typeshed uses types-distname for the stub projects it publishes. I’ve seen other choices, like some mypy-distname.

I know there’s no technical requirement for package and dist names to match, but I think it’s generally recommended unless there’s a reason not, and in this case it seems like it would be more intuitive. Is the disagreement just an accident?

Typeshed chose this convention in the anticipation that PyPI would add namespace support and typeshed could reserve the types namespace. Unfortunately, that didn’t happen.

2 Likes

We recently updated the spec to attempt to clarify this: Distributing type information — typing documentation

Some more discussion at:

1 Like

Thank you both for your explanations; that makes sense. I suppose you’re right that it’s difficult to change now. I missed the discussion thread about this and that line in the docs, sorry for making you answer again :sweat_smile:

1 Like