Skip to content

fix: declare the public exports of the msgraph package - #1594

Open
Max Azatian (HardMax71) wants to merge 1 commit into
microsoftgraph:mainfrom
HardMax71:fix/explicit-exports
Open

Max Azatian (HardMax71) wants to merge 1 commit into
microsoftgraph:mainfrom
HardMax71:fix/explicit-exports

Conversation

@HardMax71

Copy link
Copy Markdown

msgraph/__init__.py imports GraphServiceClient and GraphRequestAdapter but has no __all__ (L5-L6). The package ships py.typed, so mypy checks it, and --strict turns on --no-implicit-reexport. The import from the docs snippets then fails: Module "msgraph" does not explicitly export attribute "GraphServiceClient" [attr-defined].

This adds __all__ with GraphRequestAdapter, GraphServiceClient and VERSION. A star import now gives exactly these three names. Before, it also picked up the submodules generated, graph_request_adapter and graph_service_client.

Validation: with msgraph-sdk 1.64.0, mypy --strict on from msgraph import GraphRequestAdapter, GraphServiceClient reports two attr-defined errors, and with this change it passes. pylint msgraph/__init__.py --disable=W --rcfile=.pylintrc rates it 10.00/10.

@HardMax71
Max Azatian (HardMax71) requested a review from a team as a code owner October 16, 2026 21:26

This branch has not been deployed

No deployments
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