feat: add httpx transport and async compute engine credentials#1908
feat: add httpx transport and async compute engine credentials#1908google-labs-jules[bot] wants to merge 1 commit intomainfrom
Conversation
This commit adds a new async transport adapter using `httpx` and implements asynchronous Compute Engine credentials and metadata service interaction. Key changes: - Added `google.auth.transport._httpx_requests.py`: Async transport adapter using `httpx`. - Added `google.auth.compute_engine._credentials_async.py`: Async credentials for Compute Engine. - Added `google.auth.compute_engine._metadata_async.py`: Async interaction with GCE metadata server (transport-agnostic). - Updated `setup.py` to include `httpx` extra. - Added comprehensive unit tests in `tests_async/`. The implementation ensures proper decoupling of metadata logic from the transport layer and correctly handles `AuthorizedSession` lifecycle and concurrency.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
NOTE: closing this temporarily to support the migration to the python mono-repo. Once this repo is safely merged, this should be revisited.
Add httpx transport and async compute engine credentials.
This PR builds on the concepts, ideas, and code found in PR googleapis/google-auth-library-python#1255. There were some fundamental issues with the previous PR and we attempt to address those issues here. See this comment from the other PR:
httpx(_metadata_async.pyimports explicitly fromgoogle.auth.transport._httpx_requests). This breaks the transport agnostic design of the library. If a user wanted to useaiohttpwith async compute engine credentials, they would be unable to do so easily with this design._metadata_async.pyimplements a reasonable Request protocol that should accept any valid async request callable (such asaiohttp), not justhttpx.datetime.datetime.utcnow()which has been deprecated (in Python 3.12) and replace them withgoogle.auth._helpers.utcnow().Supports closure of Issue googleapis/google-cloud-python#15134
PR created automatically by Jules for task 5612836208709637744 started by @chalmerlowe