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

Argument of type "type[SyncTransport]" cannot be assigned to parameter "transport" of type "Transport" in function "__init__" #929

Closed
AdeelK93 opened this issue Aug 7, 2024 · 1 comment · Fixed by #930
Labels
api: logging Issues related to the googleapis/python-logging API.

Comments

@AdeelK93
Copy link

AdeelK93 commented Aug 7, 2024

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • OS type and version:
  • Python version: python --version 3.12.4
  • pip version: pip --version 24.1.2
  • google-cloud-logging version: pip show google-cloud-logging 3.11.0
  • pyright version: 1.1.374

Steps to reproduce

Same as #901 - but, now there's a type error even if you don't provide a Transport in 3.11. Previously, omitting the argument wouldn't yield a type error.

Code example

import google.cloud.logging
from google.cloud.logging.handlers import CloudLoggingHandler
from google.cloud.logging.handlers.transports import SyncTransport

client = google.cloud.logging.Client()
handler = CloudLoggingHandler(client, name="LOGGER_NAME", transport=SyncTransport)

Stack trace

image

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/python-logging API. label Aug 7, 2024
@joshtemple
Copy link

For what it's worth, I would actually prefer for Transport to be passed as an instance instead of as a class. Having to create a custom subclass of the Transport class just to adjust the config values for things like grace_period or batch_size (in the case of BackgroundThreadTransport) feels pretty clumsy.

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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants