Skip to content

build(deps): Replace httpx with httpx2 (DM-4106) - #2818

Merged
haakonvt merged 15 commits into
masterfrom
replace-httpx-with-httpx2
Sep 8, 2026
Merged

build(deps): Replace httpx with httpx2 (DM-4106)#2818
haakonvt merged 15 commits into
masterfrom
replace-httpx-with-httpx2

Conversation

@haakonvt

@haakonvt haakonvt commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrate SDK from unmaintained httpx to httpx2 to resolve e.g. authlib deprecation warnings.

Changes

  • Dependencies: Replace httpx with httpx2 and pytest-httpx with httpx2-pytest.
  • Pyodide: Clean up legacy pyodide-httpx patches in favor of native httpx2 browser transport (httpx2-jsfetch).

@haakonvt
haakonvt requested review from a team as code owners September 7, 2026 10:08
@haakonvt haakonvt changed the title build(dependencies): Replace httpx with httpx2 (DM-4106) build(deps): Replace httpx with httpx2 (DM-4106) Sep 7, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request migrates the SDK's underlying HTTP library from httpx to httpx2 across the codebase and test suites. A critical issue was found in the Pyodide patching helper where calling get_global_async_httpx_client directly can raise a RuntimeError if no event loop is running, which can be resolved by dynamically wrapping the client getter.

Comment thread cognite/client/utils/_pyodide_helpers.py
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.89922% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.12%. Comparing base (3556792) to head (2fec008).

Files with missing lines Patch % Lines
tests/tests_unit/test_api/test_functions.py 87.69% 8 Missing ⚠️
cognite/client/utils/_pyodide_helpers.py 0.00% 6 Missing ⚠️
tests/tests_unit/test_api/test_relationships.py 78.57% 3 Missing ⚠️
cognite/client/utils/_version_checker.py 0.00% 2 Missing ⚠️
tests/tests_unit/test_api/test_entity_matching.py 84.61% 2 Missing ⚠️
tests/tests_unit/test_api/test_events.py 83.33% 2 Missing ⚠️
cognite/client/_basic_api_client.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2818      +/-   ##
==========================================
+ Coverage   93.09%   93.12%   +0.03%     
==========================================
  Files         516      516              
  Lines       53722    53707      -15     
==========================================
+ Hits        50012    50017       +5     
+ Misses       3710     3690      -20     
Files with missing lines Coverage Δ
cognite/client/_http_client.py 93.42% <100.00%> (ø)
cognite/client/exceptions.py 94.84% <100.00%> (ø)
cognite/client/response.py 75.45% <100.00%> (ø)
cognite/client/utils/_concurrency.py 93.75% <ø> (ø)
cognite/client/utils/_uploading.py 72.30% <100.00%> (ø)
...tests_integration/test_api/test_jupyter_interop.py 100.00% <ø> (ø)
tests/tests_unit/test_api/test_3d.py 100.00% <100.00%> (ø)
tests/tests_unit/test_api/test_agents.py 100.00% <100.00%> (ø)
tests/tests_unit/test_api/test_agents_actions.py 100.00% <100.00%> (ø)
tests/tests_unit/test_api/test_agents_chat.py 100.00% <100.00%> (ø)
... and 44 more

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

audunska
audunska previously approved these changes Sep 7, 2026

@audunska audunska left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I looked very carefully at all the changes, especially fdc026c
Guaranteed to be bug free.

@haakonvt

haakonvt commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

:trollface:

@haakonvt
haakonvt force-pushed the replace-httpx-with-httpx2 branch 2 times, most recently from d80e6d0 to 87b8b79 Compare September 7, 2026 15:21
audunska
audunska previously approved these changes Sep 8, 2026

@audunska audunska left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"I completely understand all the pyodide dependency hacking"

@haakonvt

haakonvt commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

🦄

@haakonvt
haakonvt enabled auto-merge September 8, 2026 08:20
@haakonvt haakonvt self-assigned this Sep 8, 2026
@haakonvt haakonvt added risk-review-ongoing Risk review is in progress waiting-for-team Waiting for the submitter or reviewer of the PR to take an action labels Sep 8, 2026
@haakonvt
haakonvt added this pull request to the merge queue Sep 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 8, 2026
@haakonvt

haakonvt commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

🦄

@haakonvt
haakonvt enabled auto-merge September 8, 2026 08:42
@haakonvt
haakonvt disabled auto-merge September 8, 2026 09:02
@haakonvt
haakonvt added this pull request to the merge queue Sep 8, 2026
Merged via the queue into master with commit deecd07 Sep 8, 2026
34 of 36 checks passed
@haakonvt
haakonvt deleted the replace-httpx-with-httpx2 branch September 8, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk-review-ongoing Risk review is in progress waiting-for-team Waiting for the submitter or reviewer of the PR to take an action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants