Skip to content

DRAFT - Use httpx as the transport#1046

Draft
da1910 wants to merge 18 commits into
mainfrom
feat/httpx
Draft

DRAFT - Use httpx as the transport#1046
da1910 wants to merge 18 commits into
mainfrom
feat/httpx

Conversation

@da1910
Copy link
Copy Markdown
Collaborator

@da1910 da1910 commented May 8, 2026

In Progress

da1910 and others added 11 commits May 8, 2026 09:57
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>
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 8, 2026

Not up to standards ⛔

🔴 Issues 43 high · 3 medium · 54 minor

Alerts:
⚠ 100 issues (≤ 0 issues of at least minor severity)

Results:
100 new issues

Category Results
UnusedCode 3 medium
Documentation 52 minor
Security 43 high
CodeStyle 2 minor

View in Codacy

🟢 Metrics 284 complexity · 70 duplication

Metric Results
Complexity 284
Duplication 70

View in Codacy

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.

da1910 and others added 2 commits May 8, 2026 13:12
- 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
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 91.48936% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.63%. Comparing base (e969fbf) to head (6637380).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/ansys/openapi/common/_api_client.py 94.21% 10 Missing ⚠️
src/ansys/openapi/common/_oidc.py 87.32% 9 Missing ⚠️
src/ansys/openapi/common/_retry_transport.py 90.78% 7 Missing ⚠️
src/ansys/openapi/common/_util.py 89.55% 7 Missing ⚠️
src/ansys/openapi/common/_session.py 89.18% 4 Missing ⚠️
src/ansys/openapi/common/_case_insensitive_dict.py 90.90% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot added documentation Improvements or additions to documentation enhancement New features or code improvements dependencies Related with project dependencies maintenance Package and maintenance related labels May 8, 2026
pyansys-ci-bot and others added 4 commits May 8, 2026 12:34
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Related with project dependencies documentation Improvements or additions to documentation enhancement New features or code improvements maintenance Package and maintenance related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants