Skip to content

Commit

Permalink
Explicitly re-export all the names in __init__
Browse files Browse the repository at this point in the history
mypy is pretty strict about "if you say py.typed, you better mean it,"
including re-export requirements.

I was running some external code that uses tricycle with `mypy
--strict`, and it was complaining that the names in tricycle weren't
found (when trying to reference them like `import tricycle;
tricycle.Foo`) and then that they weren't explicitly
re-exported (when referencing them as `from tricycle import Foo`)

With this change, there are no complaints!
  • Loading branch information
tjstum committed Jan 7, 2022
1 parent e82d0df commit da67346
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions newsfragments/14.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tricycle now explicitly re-exports all names, improving PEP-561 compliance and
allowing type checkers that enforce export strictness (including mypy with
``--no-implicit-reexport``) to check code using tricycle
13 changes: 8 additions & 5 deletions tricycle/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from ._version import __version__

from ._rwlock import RWLock
from ._streams import BufferedReceiveStream, TextReceiveStream
from ._multi_cancel import MultiCancelScope
from ._service_nursery import open_service_nursery
from ._meta import ScopedObject, BackgroundObject
from ._rwlock import RWLock as RWLock
from ._streams import (
BufferedReceiveStream as BufferedReceiveStream,
TextReceiveStream as TextReceiveStream,
)
from ._multi_cancel import MultiCancelScope as MultiCancelScope
from ._service_nursery import open_service_nursery as open_service_nursery
from ._meta import ScopedObject as ScopedObject, BackgroundObject as BackgroundObject

# watch this space...

Expand Down

0 comments on commit da67346

Please sign in to comment.