Skip to content

Static typing: Errors when importing top-level modules such as Logger #1511

Description

@kmkhr

Static type checker used

pyright/pylance

AWS Lambda function runtime

3.9

AWS Lambda Powertools for Python version

latest

Static type checker info

"Logger" is not exported from module "aws_lambda_powertools"
Import from "aws_lambda_powertools.logging" instead Pylance reportPrivateImportUsage

Code snippet

from aws_lambda_powertools import Logger

Possible Solution

The following changes need to be made to aws_lambda_powertools/__init__.py.

# re-export it as Logger
from .logging import Logger as Logger # noqa: F401

or

from .logging import Logger # noqa: F401
# include it in __all__
__all__ = ["Logger"]

reference:

Activity

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

Metadata

Metadata

Labels

typingStatic typing definition related issues (mypy, pyright, etc.)v2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions