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

auth: allow to pass credentials as text #428

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

orsinium
Copy link
Contributor

  1. Allow passing credentials as a pathlib.Path object.
  2. Allow passing credentials as text content instead of a path to a file.
  3. Propagate exceptions for an invalid JSON if it is explicitly passed, not only for IO errors. And all types of exceptions, really, because why not.
  4. Allow CLOUDSDK_CONFIG to be a path to the directory, not only to the file.
  5. Cover it all with tests.

@orsinium orsinium requested a review from a team February 16, 2022 10:15
@orsinium orsinium requested review from eddiedialpad and removed request for a team February 16, 2022 10:15
@orsinium
Copy link
Contributor Author

Wow. Why there are tests on CI for Python 2.7 if the minimal supported version by the package is 3.6? I see zero downloads from Python 2.7 ever. Am I missing something? 🤔

Copy link
Member

@TheKevJames TheKevJames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orsinium ah, yes, the Py2 compatibility here is certainly odd. As mentioned in the readme, this repo actually contains the codebase for two projects: both gcloud-aio-* (which uses asyncio and is thus 3.6+) and gcloud-rest-* (which is py2.7-compatible). You can see there are a few py2 downloads for that project (https://pypistats.org/packages/gcloud-rest-auth); we'll eventually drop support, but for now we have a couple legacy users we're still supporting.

The gcloud-rest-* version of the libraries can be debugged by grabbing 'em from CI here (https://app.circleci.com/pipelines/github/talkiq/gcloud-aio/1693/workflows/021d167d-94c7-4825-a4d9-f8a6b194e50a/jobs/34866/artifacts). The CI job for generating them could also theoretically be run locally, but it's unfortunately complex (https://github.com/talkiq/gcloud-aio/blob/26a34a3a2ed1e22622235e16ee5c9c35a3e745c3/.circleci/config.yml#L142).

I will review this code as soon as I can -- previously, this logic matched behaviour with the google-auth library, so I'll need to make sure all the same cases are covered and any differences are documented clearly.

@TheKevJames TheKevJames removed the request for review from eddiedialpad April 10, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants