Skip to content

Fix typing exports #489

@cepedus

Description

@cepedus

Is your feature request related to a problem? Please describe.

Tutorial snippets are not mypy compliant. Namely:

from mssql_python import connect

raises the following typing error:

error: Module "mssql_python" does not explicitly export attribute "connect" [attr-defined]

And this can happen for every user-exposed object from mssql_python :(

Describe the solution you'd like

On mssql_python/__init__.py, add at the end of the module:

__all__ = [
    "connect",
    # ... every other object already imported on `__init__.py`
]

Describe alternatives you've considered

If not, every doc should be updated to import from the inner modules, which may be less ergonomic under a pure developer experience optic.

Additional context

No breaking changes, no risk of circular imports nor breaking tests. Only risk is that the addition of __all__ becomes un-tracked, thus potentially broken. This can be solved using a Python linter such as ruff.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage neededFor new issues, not triaged yet.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions