Skip to content

Explicitly re-export types in models/__init__.py #540

Closed
@johnthagen

Description

@johnthagen

Describe the bug

In the generated client, the models/__init__.py looks something like:

""" Contains all the data models used in inputs/outputs """

from .type import Type

This makes it convenient to do:

from models import Type

But this is missing adding the types to __all__ to properly mark them as exported:

""" Contains all the data models used in inputs/outputs """

from .type import Type

__all__ = ["Type"]

Without this, mypy --strict throws the following errors:

error: Module "pcb_dr_api_client.models" does not explicitly export attribute "Type"; implicit reexport disabled

See: https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport

Expected behavior

No errors in usage when mypy --strict is used for this kind of import.

Desktop (please complete the following information):

  • OS: macOS 10.15.7
  • Python Version: 3.9.8
  • openapi-python-client version: 0.10.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions