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

Re-enable mypy checks for samples #1060

Open
parthea opened this issue Jan 11, 2024 · 8 comments
Open

Re-enable mypy checks for samples #1060

parthea opened this issue Jan 11, 2024 · 8 comments
Assignees
Labels
api: pubsub Issues related to the googleapis/python-pubsub API. samples Issues that are directly related to samples. type: cleanup An internal cleanup or hygiene concern.

Comments

@parthea
Copy link
Contributor

parthea commented Jan 11, 2024

See the following code which shows that the mypy_samples check is disabled

# "mypy_samples", # TODO: uncomment when the check passes

@parthea parthea added the type: cleanup An internal cleanup or hygiene concern. label Jan 11, 2024
@product-auto-label product-auto-label bot added api: pubsub Issues related to the googleapis/python-pubsub API. samples Issues that are directly related to samples. labels Jan 11, 2024
@kitokirti
Copy link

HI @parthea , I would like to work on this. Please assign this to me.

@kitokirti
Copy link

kitokirti commented Jan 22, 2024

Hi @parthea , for the mypy checks to happen, I need to uncomment - "mypy_samples" . Are there any changes we are looking forward in noxfile.py?

@parthea
Copy link
Contributor Author

parthea commented Jan 22, 2024

No, I think that's it for noxfile.py. Uncomment mypy_samples in noxfile.py and ensure that all of the mypy checks pass.

@kitokirti
Copy link

Could you please guide me with testing part? Or is there any doc I can go through.

@parthea
Copy link
Contributor Author

parthea commented Jan 22, 2024

The CONTRIBUTING guide has some information on running tests.

Use nox to run tests

Make this change to noxfile.py

(py3816) partheniou@partheniou-vm-3:~/git/python-pubsub$ git diff
diff --git a/noxfile.py b/noxfile.py
index 3f9db8b..cb2476d 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -76,8 +76,7 @@ nox.options.sessions = [
     "lint_setup_py",
     "blacken",
     "mypy",
-    # https://github.com/googleapis/python-pubsub/pull/552#issuecomment-1016256936
-    # "mypy_samples",  # TODO: uncomment when the check passes
+    "mypy_samples",
     "docs",
     "format",
 ]

Then run nox -s mypy_samples

(py3816) partheniou@partheniou-vm-3:~/git/python-pubsub$ nox -s mypy_samples
nox > Running session mypy_samples
nox > Creating virtual environment (virtualenv) using python3.8 in .nox/mypy_samples
nox > python -m pip install -e '.[all]'
nox > python -m pip install pytest
nox > python -m pip install mypy==0.910
nox > python -m pip install types-mock types-protobuf types-setuptools
nox > mypy --config-file /usr/local/google/home/partheniou/git/python-pubsub/samples/snippets/mypy.ini --no-incremental samples/
samples/snippets/iam.py:30: error: Skipping analyzing "google.cloud": found module but no type hints or library stubs
samples/snippets/quickstart/sub.py:20: error: Skipping analyzing "google.cloud": found module but no type hints or library stubs
samples/snippets/quickstart/pub.py:19: error: Skipping analyzing "google.cloud": found module but no type hints or library stubs
samples/snippets/quickstart/pub.py:19: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
samples/snippets/utilities/us_states_pb2.py:16: error: Call to untyped function "Default" in typed context
samples/snippets/utilities/us_states_pb2.py:23: error: Name "_STATEPROTO" is not defined
samples/snippets/utilities/us_states_pb2.py:24: error: Name "_STATEPROTO" is not defined
samples/snippets/schema.py:27: error: Skipping analyzing "google.cloud": found module but no type hints or library stubs
samples/snippets/schema.py:34: error: Skipping analyzing "google.cloud.pubsub": found module but no type hints or library stubs
samples/snippets/schema.py:57: error: Returning Any from function declared to return "None"
samples/snippets/schema.py:92: error: Returning Any from function declared to return "None"
samples/snippets/schema.py:123: error: Returning Any from function declared to return "None"
samples/snippets/schema.py:156: error: Returning Any from function declared to return "None"
samples/snippets/publisher.py:30: error: Skipping analyzing "google.cloud": found module but no type hints or library stubs
samples/snippets/publisher.py:224: error: Skipping analyzing "google.cloud.pubsub_v1.types": found module but no type hints or library stubs
samples/snippets/subscriber.py:35: error: Skipping analyzing "google.cloud": found module but no type hints or library stubs
samples/snippets/subscriber.py:107: error: Skipping analyzing "google.cloud.pubsub_v1.types": found module but no type hints or library stubs
samples/snippets/subscriber.py:537: error: Returning Any from function declared to return "Subscription"
samples/snippets/subscriber.py:582: error: Returning Any from function declared to return "Subscription"
samples/snippets/subscriber.py:765: error: Skipping analyzing "google.cloud.pubsub_v1.subscriber": found module but no type hints or library stubs
samples/generated_samples/pubsub_v1_generated_subscriber_update_subscription_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_update_subscription_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_update_subscription_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_update_subscription_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_update_snapshot_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_update_snapshot_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_update_snapshot_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_update_snapshot_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_streaming_pull_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_streaming_pull_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_streaming_pull_sync.py:53: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_streaming_pull_sync.py:58: error: Call to untyped function "request_generator" in typed context
samples/generated_samples/pubsub_v1_generated_subscriber_streaming_pull_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_streaming_pull_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_streaming_pull_async.py:53: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_streaming_pull_async.py:58: error: Call to untyped function "request_generator" in typed context
samples/generated_samples/pubsub_v1_generated_subscriber_seek_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_seek_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_seek_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_seek_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_pull_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_pull_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_pull_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_pull_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_modify_push_config_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_modify_push_config_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_modify_push_config_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_modify_push_config_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_modify_ack_deadline_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_modify_ack_deadline_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_modify_ack_deadline_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_modify_ack_deadline_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_list_subscriptions_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_list_subscriptions_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_list_subscriptions_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_list_subscriptions_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_list_subscriptions_async.py:50: error: "Coroutine[Any, Any, ListSubscriptionsAsyncPager]" has no attribute "__aiter__" (not async iterable)
samples/generated_samples/pubsub_v1_generated_subscriber_list_snapshots_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_list_snapshots_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_list_snapshots_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_list_snapshots_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_list_snapshots_async.py:50: error: "Coroutine[Any, Any, ListSnapshotsAsyncPager]" has no attribute "__aiter__" (not async iterable)
samples/generated_samples/pubsub_v1_generated_subscriber_get_subscription_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_get_subscription_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_get_subscription_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_get_subscription_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_get_snapshot_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_get_snapshot_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_get_snapshot_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_get_snapshot_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_delete_subscription_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_delete_subscription_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_delete_subscription_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_delete_subscription_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_delete_snapshot_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_delete_snapshot_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_delete_snapshot_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_delete_snapshot_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_create_subscription_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_create_subscription_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_create_subscription_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_create_subscription_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_create_snapshot_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_create_snapshot_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_create_snapshot_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_create_snapshot_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_acknowledge_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_acknowledge_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_subscriber_acknowledge_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_subscriber_acknowledge_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_validate_schema_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_validate_schema_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_validate_schema_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_validate_schema_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_validate_message_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_validate_message_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_validate_message_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_validate_message_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_rollback_schema_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_rollback_schema_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_rollback_schema_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_rollback_schema_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_list_schemas_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_list_schemas_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_list_schemas_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_list_schemas_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_list_schemas_async.py:50: error: "Coroutine[Any, Any, ListSchemasAsyncPager]" has no attribute "__aiter__" (not async iterable)
samples/generated_samples/pubsub_v1_generated_schema_service_list_schema_revisions_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_list_schema_revisions_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_list_schema_revisions_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_list_schema_revisions_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_list_schema_revisions_async.py:50: error: "Coroutine[Any, Any, ListSchemaRevisionsAsyncPager]" has no attribute "__aiter__" (not async iterable)
samples/generated_samples/pubsub_v1_generated_schema_service_get_schema_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_get_schema_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_get_schema_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_get_schema_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_delete_schema_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_delete_schema_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_delete_schema_revision_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_delete_schema_revision_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_delete_schema_revision_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_delete_schema_revision_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_delete_schema_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_delete_schema_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_create_schema_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_create_schema_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_create_schema_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_create_schema_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_commit_schema_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_commit_schema_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_schema_service_commit_schema_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_schema_service_commit_schema_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_update_topic_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_update_topic_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_update_topic_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_update_topic_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_publish_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_publish_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_publish_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_publish_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_list_topics_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_list_topics_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_list_topics_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_list_topics_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_list_topics_async.py:50: error: "Coroutine[Any, Any, ListTopicsAsyncPager]" has no attribute "__aiter__" (not async iterable)
samples/generated_samples/pubsub_v1_generated_publisher_list_topic_subscriptions_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_list_topic_subscriptions_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_list_topic_subscriptions_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_list_topic_subscriptions_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_list_topic_subscriptions_async.py:50: error: "Coroutine[Any, Any, ListTopicSubscriptionsAsyncPager]" has no attribute "__aiter__" (not async iterable)
samples/generated_samples/pubsub_v1_generated_publisher_list_topic_snapshots_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_list_topic_snapshots_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_list_topic_snapshots_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_list_topic_snapshots_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_list_topic_snapshots_async.py:50: error: "Coroutine[Any, Any, ListTopicSnapshotsAsyncPager]" has no attribute "__aiter__" (not async iterable)
samples/generated_samples/pubsub_v1_generated_publisher_get_topic_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_get_topic_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_get_topic_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_get_topic_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_detach_subscription_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_detach_subscription_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_detach_subscription_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_detach_subscription_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_delete_topic_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_delete_topic_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_delete_topic_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_delete_topic_async.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_create_topic_sync.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_create_topic_sync.py:37: note: Use "-> None" if function does not return a value
samples/generated_samples/pubsub_v1_generated_publisher_create_topic_async.py:37: error: Function is missing a return type annotation
samples/generated_samples/pubsub_v1_generated_publisher_create_topic_async.py:37: note: Use "-> None" if function does not return a value
samples/snippets/subscriber_test.py:26: error: Skipping analyzing "google.cloud": found module but no type hints or library stubs
samples/snippets/subscriber_test.py:277: error: Skipping analyzing "google.cloud.pubsub_v1.types": found module but no type hints or library stubs
samples/snippets/schema_test.py:24: error: Skipping analyzing "google.cloud": found module but no type hints or library stubs
samples/snippets/schema_test.py:25: error: Skipping analyzing "google.cloud.pubsub": found module but no type hints or library stubs
samples/snippets/schema_test.py:74: error: Returning Any from function declared to return "Schema"
samples/snippets/schema_test.py:80: error: Returning Any from function declared to return "Schema"
samples/snippets/schema_test.py:89: error: Argument 2 to "ensure_schema_exists" has incompatible type "int"; expected "Type"
samples/snippets/schema_test.py:118: error: Argument 2 to "ensure_schema_exists" has incompatible type "int"; expected "Type"
samples/snippets/schema_test.py:134: error: Argument 2 to "ensure_schema_exists" has incompatible type "int"; expected "Type"
samples/snippets/schema_test.py:173: error: Returning Any from function declared to return "Topic"
samples/snippets/schema_test.py:175: error: Returning Any from function declared to return "Topic"
samples/snippets/schema_test.py:191: error: Argument 3 to "ensure_topic_exists" has incompatible type "int"; expected "Encoding"
samples/snippets/schema_test.py:219: error: Argument 3 to "ensure_topic_exists" has incompatible type "int"; expected "Encoding"
samples/snippets/schema_test.py:234: error: Argument 3 to "ensure_topic_exists" has incompatible type "int"; expected "Encoding"
samples/snippets/schema_test.py:386: error: "commit_avro_schema" does not return a value
samples/snippets/schema_test.py:398: error: "commit_avro_schema" does not return a value
samples/snippets/schema_test.py:411: error: "commit_avro_schema" does not return a value
samples/snippets/schema_test.py:457: error: "commit_proto_schema" does not return a value
samples/snippets/schema_test.py:479: error: "commit_proto_schema" does not return a value
samples/snippets/publisher_test.py:24: error: Skipping analyzing "google.cloud": found module but no type hints or library stubs
samples/snippets/iam_test.py:21: error: Skipping analyzing "google.cloud": found module but no type hints or library stubs
samples/snippets/quickstart/quickstart_test.py:24: error: Skipping analyzing "google.cloud": found module but no type hints or library stubs
Found 122 errors in 82 files (checked 83 source files)
nox > Command mypy --config-file /usr/local/google/home/partheniou/git/python-pubsub/samples/snippets/mypy.ini --no-incremental samples/ failed with exit code 1
nox > Session mypy_samples failed.

@kitokirti
Copy link

kitokirti commented Jan 31, 2024

Hi @parthea , I have tried to solve 118 errors out of which i am struggling with 4 errors -

google/cloud/pubsub_v1/subscriber/scheduler.py:165: error: Value of type "Iterable[Any]" is not indexable  [index]
google/cloud/pubsub_v1/subscriber/futures.py:107: error: Incompatible default for argument "timeout" (default has type "str", argument has type "Optional[float]")  [assignment]
google/cloud/pubsub_v1/publisher/futures.py:48: error: Argument 1 of "result" is incompatible with supertype "Future"; supertype defines the argument type as "Optional[float]"  [override]
google/cloud/pubsub_v1/publisher/futures.py:48: note: This violates the Liskov substitution principle
google/cloud/pubsub_v1/publisher/futures.py:48: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
google/cloud/pubsub_v1/publisher/futures.py:48: error: Incompatible default for argument "timeout" (default has type "None", argument has type "Union[int, float]")  [assignment]
google/cloud/pubsub_v1/publisher/futures.py:48: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
google/cloud/pubsub_v1/publisher/futures.py:48: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase

Any suggestions on this would be highly appreciated.

@parthea
Copy link
Contributor Author

parthea commented Jan 31, 2024

@kitokirti , Please could you open a draft PR with your work in progress changes?

@kitokirti
Copy link

Hi @parthea , I have created a draft PR -
#1069

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/python-pubsub API. samples Issues that are directly related to samples. type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
Development

No branches or pull requests

5 participants