Migrating to HTTPX2

(github.com)

159 points by tosh6 hours ago

22 comments

  • simonw6 hours ago
    Anthropic made the same change a few weeks after OpenAI did: <a href="https:&#x2F;&#x2F;github.com&#x2F;anthropics&#x2F;anthropic-sdk-python&#x2F;releases&#x2F;tag&#x2F;v1.0.0" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;anthropics&#x2F;anthropic-sdk-python&#x2F;releases&#x2F;...</a><p>The problem with httpx as a dependency is that it&#x27;s currently working towards a 1.0 release which will be full of breaking changes.<p>The httpx2 project is essentially a fork that promises <i>not</i> to break the existing API, which makes it a more stable dependency to build against.<p>I wrote a pretty long comment about my concerns for the breaking 1.0 version last year - <a href="https:&#x2F;&#x2F;github.com&#x2F;encode&#x2F;httpx&#x2F;discussions&#x2F;3344#discussioncomment-14170874" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;encode&#x2F;httpx&#x2F;discussions&#x2F;3344#discussionc...</a> - in that comment I recommended the HTTPX project release their 1.0 as a package called httpx2 instead, but a year later we now have an httpx2 (released by a different maintainer) that <i>keeps</i> the old API.
    • Aurornis4 hours ago
      &gt; The problem with httpx as a dependency is that it&#x27;s currently working towards a 1.0 release which will be full of breaking changes.<p>The httpx maintainer closed off access to issues and discussions on the repo, has been ignoring PRs, and hasn’t updated it in a half a year.<p>I don’t think there is any reason to consider httpx as a viable project any more. The Pydantic httpx fork has taken its place.
      • simonw4 hours ago
        HTTPX stable hasn&#x27;t had a release since December 2024, but there have been two dev releases of the 1.0 branch this month (after a gap since September 2025.)<p>Unfortunately that 1.0 work is happening in a private repository.<p><a href="https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;httpx&#x2F;#history" rel="nofollow">https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;httpx&#x2F;#history</a>
        • Aurornis4 hours ago
          &gt; Unfortunately that 1.0 work is happening in a private repository.<p>That’s even more reason to consider it non-viable.<p>There is no reason to encourage or support this type of behavior in a project. It is their right to do with it as they please, but I’m not interested in a project that functions like this. The forks are continuing to operate like true community projects.
          • jgalt2122 hours ago
            Maybe they don&#x27;t feel like sharing their work with the AI bot scrapers until the work is complete.
            • Aurornis52 minutes ago
              For the users of the project, the reasons don’t matter. They’re free to do as they want for any reason they choose.<p>Users of the project can (and have been) moving to forks that are operated as open, community projects in the continued spirit of the project’s original intention.<p>For what it’s worth, the maintainer has stated their reasons and they are not related to AI or scraper bots.
              • jgalt21227 minutes ago
                &gt; I don&#x27;t want to continue allowing an online environment with such an absurdly skewed gender representation. I find it intensely unwelcoming, and it&#x27;s not reflective of the type of working environments I value.<p>I have no idea what that means other this person might not be the easier to work with, or get along with.
            • tredre31 hour ago
              That is a legitimate feeling, but to spite the trillion dollars company he also hurts thousands of regular developers.<p>He doesn&#x27;t owe those developers anything, of course, but likewise they do not owe him loyalty and thus since an open fork exists, his project will die.<p>Killing the project is also his right, but people also have a right to be upset by his passive aggressive behavior. Just announce that you&#x27;re shutting down the project and move on, don&#x27;t waste our time.
      • giov427 minutes ago
        unbelievable, how can a single person affect negatively FOSS so much?<p>I mean really, closing repos? excluding maintainers? committing only on private repos?<p>This type of behavior should be moderated and banned from any FOSS activity to avoid exactly this situation of becoming a liability.<p>I&#x27;ve never seen a open source project page without a github link or a git clone ref like this <a href="https:&#x2F;&#x2F;www.encode.io&#x2F;hx&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.encode.io&#x2F;hx&#x2F;</a> it is so ridiculous, wasn&#x27;t that stuff on github? and isn&#x27;t it anyway there due to over 1k forks?<p>what&#x27;s the advantage of having this behavior? I see it only damaging towards the person, the project and the community.
    • superze4 hours ago
      The issue with httpx is that it has an obnoxious and toxic maintainer.
      • portly4 hours ago
        What happened?
        • t098i33 hours ago
          Read for yourself: <a href="https:&#x2F;&#x2F;github.com&#x2F;encode&#x2F;httpx&#x2F;discussions&#x2F;3784" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;encode&#x2F;httpx&#x2F;discussions&#x2F;3784</a><p>They also effectively killed off MkDocs: <a href="https:&#x2F;&#x2F;github.com&#x2F;mkdocs&#x2F;mkdocs&#x2F;discussions&#x2F;3677" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mkdocs&#x2F;mkdocs&#x2F;discussions&#x2F;3677</a>
          • tescreal2 hours ago
            That&#x27;s easily the strangest self-destruction I&#x27;ve ever seen. &quot;Skewed gender representation&quot;? Not sure how that matters or what the intended effect of salting the earth here was.
          • mock-possum2 hours ago
            I feel like that hardly answers anything
          • bjork15 minutes ago
            Can’t understand how so many otherwise cognitively able people refuse to acknowledge gender dysphoria as the mental illness it (often) is. As a non-US person, is this what woke means?
        • beanjuiceII4 hours ago
          was probably chewing bubble gum on the wrong sidewalk
          • jatora4 hours ago
            this made me laugh even though i dont think i even get it. can you explain this please lol
            • beanjuiceII4 hours ago
              people think other people are &#x27;toxic&#x27; for the silliest of things most times; and this person is saying some maintainer is toxic to put it out there but provides no information as to why.. so i figured my context is as good as theirs
              • nozzlegear1 hour ago
                &gt; <i>people think other people are &#x27;toxic&#x27; for the silliest of things most times</i><p>Do they?
    • networked5 hours ago
      So I guess HTTPX2 (<a href="https:&#x2F;&#x2F;github.com&#x2F;pydantic&#x2F;httpx2" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pydantic&#x2F;httpx2</a>) is winning out over HTTPXYZ (<a href="https:&#x2F;&#x2F;codeberg.org&#x2F;httpxyz&#x2F;httpxyz" rel="nofollow">https:&#x2F;&#x2F;codeberg.org&#x2F;httpxyz&#x2F;httpxyz</a>)? I didn&#x27;t switch to HTTPXYZ after the fork but have been watching it. (What I did was use urllib.request more and bite the Rust bullet with wreq, <a href="https:&#x2F;&#x2F;github.com&#x2F;0x676e67&#x2F;wreq-python" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;0x676e67&#x2F;wreq-python</a>, where it wasn&#x27;t enough.)
      • kelvinjps104 hours ago
        in their README &gt;Important<p>We started this fork because there was no activity on HTTPX, a very popular Python HTTP library.<p>A few weeks later, Pydantic started their own fork called HTTPX2. We decided to embrace this and support HTTPX2. We&#x27;re upstreaming our fixes to HTTPX2 and in our opinion it should be the &quot;blessed&quot; fork. Pydantic can make this more successful than we ever can.<p>See also <a href="https:&#x2F;&#x2F;tildeweb.nl&#x2F;~michiel&#x2F;httpx2.html" rel="nofollow">https:&#x2F;&#x2F;tildeweb.nl&#x2F;~michiel&#x2F;httpx2.html</a><p>Thanks for all your support!<p>Sander &amp; Michiel
        • NewJazz3 hours ago
          It is too bad because httpxyz is absolutely the better name.
      • simonw5 hours ago
        httpx2 is sponsored by Pydantic and has involvement from the new maintainer of Starlette, so it&#x27;s off to a very strong start.
        • fnord1232 hours ago
          Kludex is a really good dev
    • tonyhart74 hours ago
      &quot;I recommended the HTTPX project release their 1.0 as a package called httpx2 instead, but a year later we now have an httpx2 (released by a different maintainer) that keeps the old API&quot;<p>wtf is going on
      • ClikeX4 hours ago
        Open Source disputes.
    • krzyk4 hours ago
      A bit strange considering &quot;coding is solved&quot;.<p>But seriously, migrating between different libs should be ~free for both Anthropic and OpenAI.
      • simonw4 hours ago
        A migration document like this one is how you get that ~free upgrade - it&#x27;s something you can point an agent at.
    • SimonWAds5 hours ago
      [flagged]
    • rolymath5 hours ago
      The Python community loves confusing versioning.<p>I mean, obviously Python 2.7 is newer than Python 3.1<p>I remember swearing I would never migrate to python3 but here we are, I migrated without even feeling it or realizing when (But I do remember django played a big role).
      • chme5 hours ago
        That isn&#x27;t confusing at all, if you know how maintained stable releases work.<p>Happens with the Linux kernel as well.
      • hk__24 hours ago
        There are a lot of large projects where X.1 is newer than Y.0. You release a new major version for breaking changes, but you backport security changes to previous major releases as well.
      • jubilanti3 hours ago
        Just read <a href="https:&#x2F;&#x2F;semver.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;semver.org&#x2F;</a>
      • Longwelwind5 hours ago
        Isn&#x27;t that whole point of semantic release?<p>Minors and hotfixes allow you to release a new version for an older release (like if you released 3.7 but you found a bug present in 3.4, you can release 3.4.1 which would be newer than 3.7), making it possible to have multiple supported versions at the same time.
      • yard20105 hours ago
        Tangibly related, did you know that odd versions of node don&#x27;t get LTS, I found it odd at first
      • paulddraper4 hours ago
        That’s probably the worst example you could have chosen.<p>You shouldn’t assume anything about relative date of 2.7 and 3.1.
  • jklehm3 hours ago
    Wonder if they evaluated httpx2 vs niquests: <a href="https:&#x2F;&#x2F;github.com&#x2F;jawah&#x2F;niquests" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jawah&#x2F;niquests</a>
    • jtbaker3 hours ago
      Same! Recently ported some code from httpx -&gt; niquests and the experience has been good, although admittedly the governance of the project seems a little unclear.<p>I (ok, Qwen 3.7 27B) wrote some benchmarking code to compare throughput, and niquests seems to be substantially more performant for traffic that doesn&#x27;t need to traverse the public web, e.g. intra cluster service to service communication:<p><a href="https:&#x2F;&#x2F;gist.github.com&#x2F;jtbaker&#x2F;61061d27949ef48ac31e85ff28c24eb6" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;jtbaker&#x2F;61061d27949ef48ac31e85ff28c2...</a><p>uv run scripts&#x2F;bench_http.py --count 1000 Benchmarking 1000 requests to http:&#x2F;&#x2F;localhost:8000&#x2F;health (concurrency=16, timeout=30.0s) Date: 2026-08-28T10:18:34.480111<p>Running httpx... Running httpx2... Running niquests...<p>Metric httpx httpx2 niquests ------------------------------------------------------- mean 17.8ms 4.6ms 3.3ms min 3.2ms 1.5ms 1.2ms max 632.4ms 11.1ms 10.8ms p50 15.9ms 4.2ms 3.0ms p95 32.4ms 7.4ms 5.6ms p99 52.1ms 8.5ms 8.4ms total 1.15s 315.5ms 239.7ms throughput 869.2 req&#x2F;s 3170.0 req&#x2F;s 4171.1 req&#x2F;s<p>Winner: niquests (4.8x faster by wall clock)
    • awoimbee3 hours ago
      I opened an issue some time ago about them monkey patching urllib3, it was fixed than but I now see the issue has been outright deleted. Oh and now I see there is a URLLIB3_NO_OVERRIDE thing... I would not recommend this project.
  • i574n1 hour ago
    A network error occurred. Please check your connection and try again. If this issue persists please contact us through our help center at help.openai.com.<p>yeah nice engineering clowns
  • londons_explore6 hours ago
    There seems to be a bunch of downsides mentioned...<p>But what are the upsides of this change?
    • ddorian436 hours ago
      [flagged]
      • philipallstar6 hours ago
        It&#x27;s like that time I started a primary school and then closed it because I hated that the overwhelming majority of employees were women.
      • solox35 hours ago
        Did this move improve the ratio of gender representation in the software development community?
      • porridgeraisin5 hours ago
        This has happened in many packages contributed to by this person. Mkdocs e.g
        • giov43 hours ago
          unbelievable, how can a single person affect negatively FOSS so much?<p>I mean really, closing repos? excluding maintainers? committing only on private repos?<p>This type of behavior should be moderated and banned from any FOSS activity to avoid exactly this situation of becoming a liability.<p>I&#x27;ve never seen a open source project page without a github link or a git clone ref like this <a href="https:&#x2F;&#x2F;www.encode.io&#x2F;hx&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.encode.io&#x2F;hx&#x2F;</a> it is so ridiculous, wasn&#x27;t that stuff on github? and isn&#x27;t it anyway there due to over 1k forks?<p>what&#x27;s the advantage of having this behaviour? I see it only damaging towards the person, the project and the community.
        • sunaookami4 hours ago
          Oh boy, no wonder MkDocs became an absolute shit-show that fucked everyone over... <a href="https:&#x2F;&#x2F;github.com&#x2F;mkdocs&#x2F;mkdocs&#x2F;discussions&#x2F;4077#discussioncomment-15687765" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mkdocs&#x2F;mkdocs&#x2F;discussions&#x2F;4077#discussion...</a>
      • dgellow4 hours ago
        That’s fair, good for the maintainer to consider his personal values with regards to projects he wants to spend his time on
  • ZeroCool2u4 hours ago
    The requests packages fundamental API is good enough and is now maintained by the PSF. I don&#x27;t understand why OpenAI and Anthropic don&#x27;t just throw some $$$ to the PSF for focused improvements and expansion of it.
    • awildfivreld3 hours ago
      The maintainers of requests have made it pretty clear that they consider that package feature complete, and have not showed interest in adding native async support to the core.
      • TZubiri32 minutes ago
        requests is great and all, but you can just use sockets and send raw http strings. Don&#x27;t treat it like some impenetrable huge OS project.<p>Unless OpenAI deprecates the HTTP endpoint, you can pretty much ignore the whole SDK packages.
  • shay_ker37 minutes ago
    i assume this is largely about the cybersecurity blitz, to ensure hot-path code is secure?
  • delduca2 hours ago
    Why this is in the frontpage?
    • bilalq43 minutes ago
      I&#x27;d second this question. And I really mean that in a sincere way. Why is the choice of a random HTTP library in an SDK such an engaging topic of discussion here? Is there some context I&#x27;m missing?<p>When I first read the title, I assumed this was some fancy new protocol that extends HTTP or something. But it&#x27;s just about an SDK switching one transitive dependency with a fork? And arguably one that should just have its functionality be part of stdlib?
  • tosh6 hours ago
    nb: operating system TLS trust store is used now (instead of certifi)
    • zx80805 hours ago
      This could be a breaking change (for some corporate network environments).
    • hmokiguess6 hours ago
      what&#x27;s `nb` ?
      • tosh6 hours ago
        <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Nota_bene" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Nota_bene</a>
  • karpetrosyan1 hour ago
    Better migrate to <a href="https:&#x2F;&#x2F;zapros.dev" rel="nofollow">https:&#x2F;&#x2F;zapros.dev</a> from httpx maintainer
    • simlevesque1 hour ago
      Seems like the point is that the httpx maintainer is a bad maintainer.
  • KaiserPro3 hours ago
    Why would you want to use HTTPX2 over say requests?
  • fsuts4 hours ago
    Why is everyone so slow to move to http3?
    • tredre31 hour ago
      HTTPX2 isn&#x27;t about the protocol version, it&#x27;s the name of a python library to make http requests.<p>But yes, it doesn&#x27;t support HTTP3. Here&#x27;s the related issue: <a href="https:&#x2F;&#x2F;github.com&#x2F;pydantic&#x2F;httpx2&#x2F;issues&#x2F;92" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pydantic&#x2F;httpx2&#x2F;issues&#x2F;92</a>
    • TZubiri31 minutes ago
      Why would you assume that we have to move from techX to techX+1? If I release http4 would you assume that you have to migrate to http4 at some point?
    • KaiserPro3 hours ago
      because its over QUIC, which is different enough to be a pain.<p>Not that there is anything wrong with QUIC, at least its built by someone who knows what they are doing, unlike HTTP2
      • tankenmate3 hours ago
        that&#x27;s not really much of an argument, almost all reasonable libraries wrap the functionality.and if a provider doesn&#x27;t want to support http3 then the library will fallback, and then the laggards should pay the slow tax.
  • ironqcold3 hours ago
    Oh, well... It was bound to happen eventually. I suppose there must be some advantages to such a solution.
  • ushakov2 hours ago
    we have recently switched from httpx for the same reason but instead went with the Rust-based pyqwest (runs on Hyper) it has also a drop-in httpx-compatible transport so migration was easy and also it supports http2 trailers<p><a href="https:&#x2F;&#x2F;pyqwest.dev" rel="nofollow">https:&#x2F;&#x2F;pyqwest.dev</a>
  • ledoncool6 hours ago
    Wow, finally...
  • pullrun33 minutes ago
    [dead]
  • preetham_rangu5 hours ago
    [flagged]
  • igkougkousis2 hours ago
    [flagged]
  • myshapeprotocol3 hours ago
    [dead]
  • hno5b8kgpg4 hours ago
    [dead]
  • CurbStomper4 hours ago
    [dead]