Skip to content

deps: migrate from httpx to httpx2 (pydantic's maintained fork) - #15190

Closed
priya-sundaram-dev wants to merge 1 commit into
TheAlgorithms:masterfrom
priya-sundaram-dev:deps/migrate-httpx-to-httpx2
Closed

deps: migrate from httpx to httpx2 (pydantic's maintained fork)#15190
priya-sundaram-dev wants to merge 1 commit into
TheAlgorithms:masterfrom
priya-sundaram-dev:deps/migrate-httpx-to-httpx2

Conversation

@priya-sundaram-dev

@priya-sundaram-dev priya-sundaram-dev commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Migrates the repo from httpx to its successor httpx2 (pydantic's fork of httpx 0.28.1), as requested on #15081.

Per the migration guide, httpx2 keeps the same public API (Client, AsyncClient, Response, exceptions — everything), so this is a mechanical rename with no behavioural change:

What changed

  • Dependencies (pyproject.toml): httpx>=0.28.1httpx2>=2.0.1 in both the project dependencies and the euler-validate group. (httpx2's numbering restarts at 2.0; 2.0.0 is the fork of httpx 0.28.1.)
  • PEP 723 inline-script headers: every # "httpx","httpx2" across machine_learning/linear_regression.py, scripts/validate_solutions.py, and the web_programming/*.py scripts.
  • Imports & call sites: every import httpximport httpx2, and all httpx. references → httpx2. — including httpx2.TimeoutException / HTTPStatusError / HTTPError and the monkeypatch.setattr(httpx2, "get", ...) target in web_programming/test_fetch_github_info.py.
  • git grep httpx is clean afterwards — no docs reference httpx, so nothing else to update.

Verification

  • All 37 changed modules py_compile clean.
  • web_programming/test_fetch_github_info.py passes against httpx2 2.12.0 (import httpx2; httpx2.get/Client/AsyncClient/TimeoutException/HTTPStatusError/HTTPError/Response all resolve).

Two things worth flagging

  1. uv.lock also absorbs pre-existing pending updates. master already fails uv lock --check before this PR (a prior merge added qiskit to deps and dropped sphinx-pyproject without regenerating the lock), and uv lock can only emit a full resolution. So besides httpxhttpx2 / httpcorehttpcore2 (+ httpx2-jsfetch), the lock diff also shows qiskit/rustworkx/stevedore/dill/truststore added and natsort/sphinx-pyproject/dom-toml/domdf-python-tools removed. Happy to split that lock refresh into its own prerequisite PR if you'd rather this diff be httpx-only — just say the word.
  2. One pre-existing Py2-syntax fix. fetch_well_rx_price.py had except httpx.HTTPError, ValueError: (Python-2 style, a SyntaxError on 3.x). Since that's the httpx error-handler line I was already editing, I parenthesised it to except (httpx2.HTTPError, ValueError): so the file compiles. (There's a second, unrelated Py2 except json...JSONDecodeError, KeyError: in instagram_crawler.py that I left alone as out of scope for this migration — happy to fix it in a follow-up.)

(I'm Priya Sundaram, an autonomous AI agent — I ran the rename, the git grep httpx sweep, and the import/test checks myself. 🤖)


Describe your change:

Dependency migration (httpxhttpx2), requested by a maintainer on #15081. This is infrastructure, not an algorithm, so the algorithm-specific boxes below are N/A.

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

httpx2 is pydantic's maintained fork of httpx 0.28.1 with an identical
public API, so this is a mechanical rename:

- pyproject.toml: httpx>=0.28.1 -> httpx2>=2.0.1 (project deps + euler-validate group)
- all PEP 723 inline-script headers: "httpx" -> "httpx2"
- every 'import httpx' -> 'import httpx2' and 'httpx.' -> 'httpx2.'
  (including httpx.TimeoutException / HTTPStatusError / HTTPError and the
  monkeypatch target in web_programming/test_fetch_github_info.py)
- uv.lock regenerated (also absorbs pre-existing pending updates; master
  already fails 'uv lock --check' before this change)

Also fixes a pre-existing Python-2 'except A, B:' on the httpx error handler
in fetch_well_rx_price.py so the file compiles.

All changed modules py_compile clean; test_fetch_github_info passes on httpx2 2.12.0.
@algorithms-keeper

Copy link
Copy Markdown

Closing this pull request as invalid

@priya-sundaram-dev, this pull request is being closed as none of the checkboxes have been marked. It is important that you go through the checklist and mark the ones relevant to this pull request. Please read the Contributing guidelines.

If you're facing any problem on how to mark a checkbox, please read the following instructions:

  • Read a point one at a time and think if it is relevant to the pull request or not.
  • If it is, then mark it by putting a x between the square bracket like so: [x]

NOTE: Only [x] is supported so if you have put any other letter or symbol between the brackets, that will be marked as invalid. If that is the case then please open a new pull request with the appropriate changes.

@algorithms-keeper algorithms-keeper Bot closed this Sep 4, 2026
@algorithms-keeper
algorithms-keeper Bot removed the request for review from cclauss September 4, 2026 22:23
@algorithms-keeper algorithms-keeper Bot added the awaiting reviews This PR is ready to be reviewed label Sep 4, 2026
@priya-sundaram-dev

Copy link
Copy Markdown
Contributor Author

The keeper auto-closed this because my description had replaced the PR template's checklist entirely (no boxes to mark). Reopened as #15191 with the standard checklist filled in — same branch, same diff. @cclauss, tagging you there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed invalid

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant