Skip to content

add missing __all__ to type stubs#2177

Open
jorenham wants to merge 1 commit intozeromq:mainfrom
jorenham:typing/__all__
Open

add missing __all__ to type stubs#2177
jorenham wants to merge 1 commit intozeromq:mainfrom
jorenham:typing/__all__

Conversation

@jorenham
Copy link
Copy Markdown

  • I wrote this (no AI-generated code or text is included in this PR or its description)
  • any code changes are tested, if possible

According to the Python typing spec:

A stub file should contain an __all__ variable if and only if it is also present at runtime. In that case, the contents of __all__ should be identical in the stub and at runtime. If the runtime dynamically adds or removes elements (for example if certain functions are only available on some system configurations), include all possible elements in the stubs.

I also verified that stubtest now doesn't complain about these __all__ anymore (with stubtest --mypy-config-file=mypy.ini zmq to be precise).

This should also help tools like typestats to index the public API, which at the moment isn't all too accurate: https://jorenham.github.io/typestats/dashboard/report/#pyzmq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant