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

Skeletons / proper typing missing for this kind of code synthesis #11865

Open
doctorpangloss opened this issue Sep 13, 2018 · 3 comments
Open
Assignees
Labels
api: vision Issues related to the Cloud Vision API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@doctorpangloss
Copy link

https://github.com/GoogleCloudPlatform/google-cloud-python/blob/c2a7bffb11425d9c5e98425f8282866a7c7fd634/vision/google/cloud/vision_helpers/decorators.py#L18

Do you think you could commit a valid, simple set of methods that will appear in IDE autocompletes like PyCharm?

It would greatly improve usability of your cloud APIs.

The test is pretty simple:

  1. Open a blank project in PyCharm 2018.
  2. Use a virtualenv with google-vision-api (for example) installed.
  3. Start following a quick start.
  4. Observe no methods can be found on the ImageAnnotatorClient object, for example.

Maybe the equivalent of https://github.com/jbasko/autoboto ?

@diegogr-cit
Copy link

diegogr-cit commented Nov 11, 2019

Hi,

There is some plan to do better support to IDE autocomplete/IntelliSense/lints with those clients? E.g. @_gapic.add_methods on the clients makes this on vscode:

 from google.cloud import pubsub_v1

client = pubsub_v1.SubscriberClient()
client.subscription_path(project_id, sub_id) < (1)
#(1) Instance of 'SubscriberClient' has no 'subscription_path' member

@crwilcox crwilcox transferred this issue from googleapis/google-cloud-python Feb 3, 2020
@product-auto-label product-auto-label bot added the api: vision Issues related to the Cloud Vision API. label Feb 3, 2020
@busunkim96 busunkim96 added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Feb 3, 2020
@danielcressman
Copy link
Contributor

danielcressman commented Oct 6, 2021

This is still an issue. Any of the methods dynamically added to ImageAnnotatorClient by the add_single_feature_methods decorator throw errors in pylint when used:

Code:

    3 from google.cloud import vision
    4
...
   11
   12 image = vision.Image(content=content)
   13
>> 14 response = client.label_detection(image=image)

Error:

(env) [dcressman ~/projects/vision-api-test] pylint test.py
************* Module test
test.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test.py:15:11: E1101: Instance of 'ImageAnnotatorClient' has no 'label_detection' member (no-member)

------------------------------------------------------------------
Your code has been rated at 5.38/10 (previous run: 5.00/10, +0.38)

If this is too difficult/not worth it to fix, can we at least try to call it out explicitly somewhere that pylint will not work out of the box? I figure that may save a lot of people some time.

danielcressman referenced this issue in danielcressman/python-vision Oct 6, 2021
Re: https://github.com/googleapis/python-vision/issues/6, the generated methods on the `ImageAnnotatorClient` class do not play nicely with Pylint. As a workaround, let's add this to the README so that future users have a chance to see this limitation up-front and save themselves some time.
danielcressman referenced this issue in danielcressman/python-vision Oct 6, 2021
Re: https://github.com/googleapis/python-vision/issues/6, the generated methods on the `ImageAnnotatorClient` class do not play nicely with Pylint. As a workaround, let's add this to the README so that future users have a chance to see this limitation up-front and save themselves some time.
danielcressman referenced this issue in danielcressman/python-vision Oct 6, 2021
Re: https://github.com/googleapis/python-vision/issues/6, the generated methods on the `ImageAnnotatorClient` class do not play nicely with Pylint.
As a workaround, let's add this to the README so that future users have a chance to see this limitation up-front and save themselves some time.
danielcressman referenced this issue in danielcressman/python-vision Oct 6, 2021
Re: https://github.com/googleapis/python-vision/issues/6, the generated methods on the `ImageAnnotatorClient` class do not play nicely with Pylint.
As a workaround, let's add this to the README so that future users have a chance to see this limitation up-front and save themselves some time.
parthea referenced this issue in googleapis/python-vision Oct 14, 2021
Re: https://github.com/googleapis/python-vision/issues/6, the generated methods on the `ImageAnnotatorClient` class do not play nicely with Pylint.
As a workaround, let's add this to the README so that future users have a chance to see this limitation up-front and save themselves some time.

Co-authored-by: gcf-merge-on-green[bot] <60162190+gcf-merge-on-green[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
@aribray aribray assigned nicain and yil532 and unassigned aribray Jul 25, 2022
@parthea
Copy link
Contributor

parthea commented Oct 21, 2023

I'm going to transfer this issue to google-cloud-python as we're planning to move the code for google-cloud-vision there in the next 1-2 weeks

@parthea parthea transferred this issue from googleapis/python-vision Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vision Issues related to the Cloud Vision API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

9 participants