Fix compatibility with Python 3.14
I think this line from pyproject.toml should be changed from "httpcore==1.*", to "httpcore>=1.0.8", to make sure that it doesn't give problem when import it.
The import problem has been fixed by this commit in version 1.0.8.
See also https://github.com/encode/httpx/discussions/3616
Tested without success in:
- #3645
See also:
- https://github.com/encode/httpcore/issues/1043
Apparently this has already been fixed. You just need to upgrade the httpcore library to v1.0.8+
See https://github.com/encode/httpcore/issues/1043#issuecomment-3380758277
Still lingers in both
- #3645
- #3664
https://github.com/encode/httpx/actions/runs/17672966050/job/50228530025#step:4:68 line 67
Can't replicate:
[user@hostname tst]$ uv venv -p 3.14
Using CPython 3.14.0rc3 interpreter at: /home/user/.local/bin/python3.14
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
[user@hostname tst]$ source .venv/bin/activate
(tst) [user@hostname tst]$ uv pip install httpx
Resolved 7 packages in 9ms
Installed 7 packages in 13ms
+ anyio==4.11.0
+ certifi==2025.10.5
+ h11==0.16.0
+ httpcore==1.0.9
+ httpx==0.28.1
+ idna==3.10
+ sniffio==1.3.1
(tst) [user@hostname tst]$ python
Python 3.14.0rc3 (main, Sep 18 2025, 19:47:22) [Clang 20.1.4 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import httpx
>>>
https://github.com/encode/httpx/actions/runs/17672966050/job/50228530025#step:4:68 line 67
It's installing a version that supports Python 3.14. I can't see what's the problem. The job has been cancelled, no errors
@ilovelinux Because the version of httpcore is greater than 1.0.8.
@ilovelinux uv python install # --> python3..14.0
@ilovelinux Because the version of
httpcoreis greater than1.0.8.
Yes, and it is downloaded by default.
I'm not sure pinning the libraries' version with support to the latest Python release is a good practice since it could affect support to older Python versions.
E.g. if I'm using Python 3.10 I can still upgrade httpx without upgrading httpcore. If we pin httpcore to 1.0.8, I couldnt.
AFAIK version pinning should be used for compatibility among libraries, not with Python releases.
If you think I'm wrong, I'm curious about some use-cases or some documentation about this practice 🙁
@ilovelinux
uv python install# --> python3..14.0
? You can see from the output that it's Python 3.14
I saw
[user@hostname tst]$ uv venv -p 3.14 Using CPython 3.14.0rc3 interpreter at: /home/user/.local/bin/python3.14
@ilovelinux httpcore in its latest version should be compatible with python 3.8 and above. Why you can't install httpx when you pin httpcore version?
- #3645
tests/test_timeouts.py
@pytest.mark.xfail(sys.version_info >= (3, 14), reason="Fix trio on Python >= 3.14")
async def test_write_timeout(server):