Skip to content
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

py.typed but no type annotations #849

Open
gawi opened this issue Feb 2, 2024 · 0 comments
Open

py.typed but no type annotations #849

gawi opened this issue Feb 2, 2024 · 0 comments
Assignees
Labels
api: logging Issues related to the googleapis/python-logging API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.

Comments

@gawi
Copy link

gawi commented Feb 2, 2024

google.cloud.logging_v2 contains a py.typed file but the package does not provide type annotations.

Hence, code like this:

from google.cloud.logging import Client
from google.cloud.logging.handlers import CloudLoggingHandler
from google.cloud.logging_v2.handlers.handlers import setup_logging

client = Client()
handler = CloudLoggingHandler(client)
setup_logging(handler)

will trigger this error in Pyright:

test.py:3:55 - error: Type of "setup_logging" is partially unknown
    Type of "setup_logging" is "(handler: Unknown, *, excluded_loggers: Unknown = EXCLUDED_LOGGER_DEFAULTS, log_level: int = logging.INFO) -> None" (reportUnknownVariableType)

My interpretation of the meaning of py.typed is "this package has type annotations that should be use by the type checker for code importing this package".

Is there any plan to provide type annotations?

@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/python-logging API. label Feb 2, 2024
@gkevinzheng gkevinzheng added type: question Request for information or clarification. Not an issue. priority: p3 Desirable enhancement or fix. May not be included in next release. labels Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/python-logging API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants