Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kmkhr opened this issue Sep 12, 2022 · 3 comments
Closed

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

kmkhr opened this issue Sep 12, 2022 · 3 comments
Assignees
Labels
typing Static typing definition related issues (mypy, pyright, etc.) v2

Comments

@kmkhr
Copy link
Contributor

kmkhr commented Sep 12, 2022

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:

@kmkhr kmkhr added triage Pending triage from maintainers typing Static typing definition related issues (mypy, pyright, etc.) labels Sep 12, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Sep 12, 2022

Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our AWS Lambda Powertools Discord: Invite link

@github-actions github-actions bot added the pending-release Fix or implementation already in dev waiting to be released label Sep 15, 2022
@rubenfonseca rubenfonseca removed the triage Pending triage from maintainers label Sep 19, 2022
@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Sep 19, 2022
@aws-powertools aws-powertools deleted a comment from github-actions bot Sep 20, 2022
@heitorlessa
Copy link
Contributor

Closing as we're wrap to launch V2

@github-actions
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typing Static typing definition related issues (mypy, pyright, etc.) v2
Projects
None yet
Development

No branches or pull requests

4 participants