DRAFT - Use httpx as the transport#1046
Draft
da1910 wants to merge 18 commits into
Draft
Conversation
Move the explicit doc/_build/ rule next to Sphinx-related comments so local html/latex output stays ignored; keep _autosummary documented separately. Co-authored-by: Cursor <cursoragent@cursor.com>
Vendor Requests-style CaseInsensitiveDict (Apache-2.0 attribution) for session headers and exception snapshots. Export CaseInsensitiveDict from the public package. Restrict ApiException / ApiClientBase signatures to httpx.Response. Co-authored-by: Cursor <cursoragent@cursor.com>
Introduce urllib3-style retries on a custom httpx.HTTPTransport. Wire TransportConfiguration into httpx.Client construction, WWW-Authenticate collection via httpx.Headers.get_list, and drop the old requests session shims from utilities. Co-authored-by: Cursor <cursoragent@cursor.com>
Require httpx.Client for ApiClient.request paths and deserialization. Rebuild ApiClientFactory on httpx with platform auth (NTLM, Negotiate, OIDC) and fix probe URL handling. Port OIDCSessionFactory to httpx-auth and typed TransportConfiguration round-trips. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace requests-mock with pytest-httpx; align dispatch and multipart tests with httpx.Client.request. Update session, OIDC, exception, and integration tests for httpx responses and factory behaviour. Add retry transport unit tests. Co-authored-by: Cursor <cursoragent@cursor.com>
Remove the requests stack from core dependencies; refresh the lockfile. Add per-module mypy overrides so Windows CI passes without per-import ignores when optional httpx auth extras are present or absent. Co-authored-by: Cursor <cursoragent@cursor.com>
Link the engineering plan from the doc toctree; record vendoring, test strategy, and phased rollout decisions. Co-authored-by: Cursor <cursoragent@cursor.com>
…ctory session headers Updated documentation to specify that the headers in `idp_session_configuration` are not fully respected for IdP HTTP clients, particularly regarding the `Accept` and `Content-Type` headers. Added a test to ensure that the initial probe to the API uses only the factory's session headers, confirming the expected behavior of the `ApiClientFactory`.
Generated clients always used the default; the flag was wired incorrectly to streaming for requests. call_api now always deserializes and raises ApiException with a parsed exception model on error. request() no longer accepts _preload_content. Add brief docstrings on context manager methods for pydocstyle. Co-authored-by: Cursor <cursoragent@cursor.com>
Use a single optional outbound proxy URL and route it through one httpx mount keyed by the API (or IdP) scheme from mount_scheme_url. ApiClientFactory passes api_url; OIDC passes authority or resource URL. Remove per-scheme dict handling and NotImplementedError paths from client init kwargs. Update tests and user guide. Co-authored-by: Cursor <cursoragent@cursor.com>
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| UnusedCode | 3 medium |
| Documentation | 52 minor |
| Security | 43 high |
| CodeStyle | 2 minor |
🟢 Metrics 284 complexity · 70 duplication
Metric Results Complexity 284 Duplication 70
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
- Add .valeignore for Sphinx _build and api/_autosummary output. - Extend ANSYS Vale accept list (httpx, certifi, conda, OpenSSL). - Reword user guide HTTPS/session section for Google rules and spacing. - Fix RetryingHTTPTransport docstrings (numpy style, handle_request). - Split pydocstyle pre-commit: skip D105/D102 on vendored CaseInsensitiveDict. Co-authored-by: Cursor <cursoragent@cursor.com>
…F401 - Remove httpx from intersphinx_mapping (no Sphinx objects.inv on MkDocs site). - Reorder ApiClient class docstring to Parameters, Notes, Examples (GL07). - Remove unused typing.Any import in _exceptions.py. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1046 +/- ##
==========================================
- Coverage 94.79% 93.63% -1.16%
==========================================
Files 7 9 +2
Lines 807 1147 +340
==========================================
+ Hits 765 1074 +309
- Misses 42 73 +31 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Expose AsyncApiClient from the public package, wire async request paths through the existing client stack, and align retry transport and session utilities with async-capable httpx usage. Add unit tests for the async client surface and updated retry behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
Factor Uvicorn apps into fixture_apps with shared /models routes, add server_utils and async_integration helpers, and extend basic, anonymous, and negotiate suites with parametrized GET/POST/PUT/DELETE/HEAD/OPTIONS checks alongside existing PATCH coverage. Co-authored-by: Cursor <cursoragent@cursor.com>
- Added tests to ensure AsyncApiClient correctly rejects sync clients and handles async client closure. - Implemented tests for OIDCSessionFactory to verify audience header handling in API and IDP configurations. - Included checks for proper error handling when invalid HTTP clients are used. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Progress