Skip to content

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

Open
haakonvt wants to merge 14 commits into
masterfrom
replace-httpx-with-httpx2
Open

build(deps): Replace httpx with httpx2 (DM-4106)#2818
haakonvt wants to merge 14 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.89119% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.13%. Comparing base (e5be404) to head (87b8b79).

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.12%   93.13%   +0.01%     
==========================================
  Files         516      516              
  Lines       53701    53686      -15     
==========================================
- Hits        50008    50001       -7     
+ Misses       3693     3685       -8     
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 4 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 from d80e6d0 to 87b8b79 Compare September 7, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants