Conversation
- Refactored `HTTPClientBase` to inherit from `Generic[ClientT, ExecutorT]`, eliminating the weakly typed `HTTPX_CLIENT_CLS` property. - Explicitly defined strict type boundaries for `Client` and `AsyncClient` by overriding generic class methods. - Removed arbitrary `cast()` usages across synchronous and asynchronous `get`/`post` request chains. - Removed redundant and unused `pass` statements from several JSON models to improve codebase cleanliness and cohesion (`users.py`, `studies.py`, `base.py`). Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Refactored `HTTPClientBase` to inherit from `Generic[ClientT, ExecutorT]`, eliminating the weakly typed `HTTPX_CLIENT_CLS` property. - Explicitly defined strict type boundaries for `Client` and `AsyncClient` by overriding generic class methods. - Removed arbitrary `cast()` usages across synchronous and asynchronous `get`/`post` request chains. - Removed redundant and unused `pass` statements from several JSON models to improve codebase cleanliness and cohesion (`users.py`, `studies.py`, `base.py`). - Ran `isort` and `black` to ensure formatting passes CI tests. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
- Removed `Awaitable`, `cast`, and `BaseRequestExecutor` from `async_client.py`. - Removed `cast` and `BaseRequestExecutor` from `client.py`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR reduces technical debt in the SDK’s HTTP layer by introducing a strongly-typed, generic HTTPClientBase that cleanly separates sync vs async client/executor wiring, and performs minor cleanup across several JSON models.
Changes:
- Refactors
HTTPClientBaseto beGeneric[ClientT, ExecutorT]and moves httpx client-class selection to_get_client_class(). - Updates
ClientandAsyncClientto bindHTTPClientBasetohttpx.Client/SyncRequestExecutorandhttpx.AsyncClient/AsyncRequestExecutor, removing redundantcast()usage in request methods. - Removes no-op
passstatements from multiple model classes.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/imednet/core/http_client_base.py |
Introduces generics and abstracts client-class selection for stricter typing across sync/async implementations. |
src/imednet/core/client.py |
Specializes the base client for sync httpx usage and simplifies request return typing. |
src/imednet/core/async_client.py |
Specializes the base client for async httpx usage and simplifies awaited request return typing. |
src/imednet/models/base.py |
Removes redundant pass statements from model definitions. |
src/imednet/models/studies.py |
Removes redundant pass statement from the Study model. |
src/imednet/models/users.py |
Removes redundant pass statements from Role and User models. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR addresses technical debt within the core HTTP client wrapper and multiple JSON models by strictly enforcing SOLID typing mechanics and code cleanliness.
🏗️ Design Change
Migrated the generic wrapper
HTTPClientBasefrom a mixed loosely-typed structure to explicit Generic bounds. The subclassesClientandAsyncClientare now directly associated withhttpx.Client/SyncRequestExecutorandhttpx.AsyncClient/AsyncRequestExecutorrespectively.♻️ DRY Gains
Dropped multiple runtime
cast(httpx.Response)andcast(Awaitable)operations in the base HTTP layer, relying entirely on compile-time type inference. Extinguished several uselesspasslines from existing models.🛡️ Solidity
Strictly separates the underlying HTTP engine context between synchronous and async flow via
Generic[ClientT, ExecutorT].None. The external interface definitions remain completely functional with exactly equivalent runtime footprints.
PR created automatically by Jules for task 14087093377179307493 started by @fderuiter