GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add py.typed files to released packages · Issue #79 · googleapis/python-secret-manager

This repository was archived by the owner on Sep 5, 2023. It is now read-only.
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Add py.typed files to released packages #79

Copy link
Copy link
Closed
Closed
Add py.typed files to released packages#79
Copy link
Labels
api: secretmanagerIssues related to the googleapis/python-secret-manager API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Description

@martin1keogh
martin1keogh
opened on Feb 1, 2021
Issue body actions

Is your feature request related to a problem? Please describe.
The current package does not include the google/cloud/secretmanager/py.typed file. As such, mypy (and other type checkers) consider this package to be untyped (as specified in PEP 561):

# venv & package install
$ python3 -m venv venv && source venv/bin/activate
$ pip install google-cloud-secret-manager mypy
...
Successfully installed cachetools-4.2.1 certifi-2020.12.5 chardet-4.0.0 google-api-core-1.25.1 google-auth-1.24.0 google-cloud-secret-manager-2.2.0 googleapis-common-protos-1.52.0 grpc-google-iam-v1-0.12.3 grpcio-1.35.0 idna-2.10 libcst-0.3.16 mypy-0.800 mypy-extensions-0.4.3 proto-plus-1.13.0 protobuf-3.14.0 pyasn1-0.4.8 pyasn1-modules-0.2.8 pytz-2021.1 pyyaml-5.4.1 requests-2.25.1 rsa-4.7 six-1.15.0 typed-ast-1.4.2 typing-extensions-3.7.4.3 typing-inspect-0.6.0 urllib3-1.26.3

# no py.typed file in google/cloud/secretmanager
$ find . -iname "py.typed" 
./venv/lib/python3.8/site-packages/mypy/py.typed
./venv/lib/python3.8/site-packages/libcst/py.typed

# mypy complains about the untyped library
$ echo "from google.cloud.secretmanager import SecretManagerServiceClient" >> main.py
$ mypy main.py 
main.py:1: error: Skipping analyzing 'google.cloud.secretmanager': found module but no type hints or library stubs
main.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

# adding the py.typed file in both secretmanager/ and secretmanager_v1/ , mypy doesn't complain anymore
$ touch venv/lib/python3.8/site-packages/google/cloud/secretmanager{,_v1}/py.typed
$ mypy main.py                                                                    
Success: no issues found in 1 source file

# dummy test case to check mypy finds errors
$ echo "SecretManagerServiceClient.parse_secret_path(1)" >> main.py
$ mypy main.py 
main.py:2: error: Argument 1 to "parse_secret_path" of "SecretManagerServiceClient" has incompatible type "int"; expected "str"
Found 1 error in 1 file (checked 1 source file)

Describe the solution you'd like
Have the packages on pypi contain

  • google/cloud/secretmanager/py.typed
  • google/cloud/secretmanager_v1/py.typed
  • google/cloud/secretmanager_v1beta/py.typed

Describe alternatives you've considered
Have mypy ignore those imports, but it's a bit of a shame since they're typed.

Versions
python: 3.8.5
pip: 20.0.2
google-cloud-secret-manager: 2.2.0
mypy: 0.800

Thanks

Reacted by Yurii Serhiichuk

Activity

Next
  1. product-auto-label
    added
    api: secretmanagerIssues related to the googleapis/python-secret-manager API.
    on Feb 1, 2021
  2. busunkim96
    added a commit that references this issue on Feb 1, 2021

    chore(python): include py.typed files in release

    880b376
  3. busunkim96
    added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    on Feb 1, 2021
  4. gcf-merge-on-green
    added a commit that references this issue on Feb 6, 2021

    chore(python): include py.typed files in release (#934)

    3336657
  5. yoshi-automation
    added 11 commits that reference this issue on Feb 6, 2021

    chore(python): include py.typed files in release

    dc8f975

    chore(python): include py.typed files in release

    757e64f

    chore(python): include py.typed files in release

    b0ea616

    chore(python): include py.typed files in release

    ed31d97

    chore(python): include py.typed files in release

    7355037

    chore(python): include py.typed files in release

    59d4d2d

    chore(python): include py.typed files in release

    6e2c813

    chore(python): include py.typed files in release

    c5daed8

    chore(python): include py.typed files in release

    a3599bb

    chore(python): include py.typed files in release

    ef1df2f

    chore(python): include py.typed files in release

    e81cf89
  6. 117 remaining items

  7. yoshi-automation
    added a commit that references this issue on Apr 20, 2021

    chore(python): include py.typed files in release

    da6e039
  8. nicain
    added a commit that references this issue on Nov 2, 2022

    chore: update templates (#97)

    722b954
  9. ivanmkc
    added 2 commits that reference this issue on Nov 3, 2022

    chore: Updating resources and configuration for presubmits and test e…

    f27bb24

    chore: Updating resources and configuration for presubmits and test e…

    abebafd
  10. holtskinner
    added 2 commits that reference this issue on Jan 3, 2023

    chore: update templates (#97)

    37ea57c

    chore: update templates (#97)

    3fea6b4
  11. dandhlee
    added a commit that references this issue on Jan 5, 2023

    chore: update templates (#97)

    13c1178
  12. meredithslota commented on Apr 3, 2023

    @meredithslota
    meredithslota
    on Apr 3, 2023
    Contributor
    More actions

    These have been included (see linked issues) and are here:
    https://github.com/googleapis/python-secret-manager/blob/main/google/cloud/secretmanager/py.typed
    https://github.com/googleapis/python-secret-manager/blob/main/google/cloud/secretmanager_v1/py.typed
    https://github.com/googleapis/python-secret-manager/blob/main/google/cloud/secretmanager_v1beta1/py.typed

    Closing out, thank you for filing!

  13. meredithslota
    closed this as completedon Apr 3, 2023
  14. parthea
    added 6 commits that reference this issue on Jun 4, 2023

    test: use constraints files to test lower bounds (#41)

    235417b

    feat: add state field in resources (#8)

    ff2495d

    chore: update templates (#97)

    46ed74d

    chore: Updating resources and configuration for presubmits and test e…

    7da0d9b

    chore: update templates (#41)

    77bc8ed

    chore: update templates (#81)

    39d7af5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: secretmanagerIssues related to the googleapis/python-secret-manager API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.