Skip to content

Increase chardet upper limit to 7#7220

Merged
sigmavirus24 merged 1 commit intopsf:mainfrom
aminvakil:chardet_6
Feb 22, 2026
Merged

Increase chardet upper limit to 7#7220
sigmavirus24 merged 1 commit intopsf:mainfrom
aminvakil:chardet_6

Conversation

@aminvakil
Copy link
Contributor

Fixes #7219.

Although right now I'm not sure if it would be as simple as this, but I wanted to run tests on chardet.

@aminvakil aminvakil marked this pull request as draft February 22, 2026 16:08
@aminvakil
Copy link
Contributor Author

Seems like there isn't a test regarding chardet in https://github.com/aminvakil/requests/actions/runs/22280614693/job/64450537467.

I do not see chardet getting installed.

@aminvakil
Copy link
Contributor Author

aminvakil commented Feb 22, 2026

$ tox -e py --notest
$ .tox/py/bin/pip install "chardet>=6.0.0dev0" --pre
$ .tox/py/bin/pip uninstall charset-normalizer -y
$ tox -e py

I've run these four commands and it seems there is not an issue.

Error was present locally as well indeed, I didn't catch it first time.

RequestsDependencyWarning: urllib3 (2.6.3) or chardet (6.0.0.post1)/charset_normalizer (None) doesn't match a supported version!
$ tox -e py --notest
py: install_deps> python -I -m pip install -r requirements-dev.txt
.pkg: install_requires> python -I -m pip install 'setuptools>=61.0'
.pkg: _optional_hooks> python /usr/lib/python3.14/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: get_requires_for_build_sdist> python /usr/lib/python3.14/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: build_sdist> python /usr/lib/python3.14/site-packages/pyproject_api/_backend.py True setuptools.build_meta
py: install_package_deps> python -I -m pip install 'PySocks!=1.5.7,>=1.5.6' 'certifi>=2023.5.7' 'charset_normalizer<4,>=2' 'idna<4,>=2.5' 'urllib3<3,>=1.26'
py: install_package> python -I -m pip install --force-reinstall --no-deps /home/user/requests/.tox/.tmp/package/1/requests-2.33.0.dev1.tar.gz
  py: OK (18.07 seconds)
  congratulations :) (18.12 seconds)
$ .tox/py/bin/pip install "chardet>=6.0.0dev0" --pre
Collecting chardet>=6.0.0dev0
  Using cached chardet-6.0.0.post1-py3-none-any.whl.metadata (3.3 kB)
Using cached chardet-6.0.0.post1-py3-none-any.whl (627 kB)
Installing collected packages: chardet
Successfully installed chardet-6.0.0.post1
$ .tox/py/bin/pip uninstall charset-normalizer -y
Found existing installation: charset-normalizer 3.4.4
Uninstalling charset-normalizer-3.4.4:
  Successfully uninstalled charset-normalizer-3.4.4
$ tox -e py
.pkg: _optional_hooks> python /usr/lib/python3.14/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: get_requires_for_build_sdist> python /usr/lib/python3.14/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: build_sdist> python /usr/lib/python3.14/site-packages/pyproject_api/_backend.py True setuptools.build_meta
py: install_package> python -I -m pip install --force-reinstall --no-deps /home/user/requests/.tox/.tmp/package/2/requests-2.33.0.dev1.tar.gz
py: commands[0]> pytest tests
=========================================================================================================== test session starts ============================================================================================================
platform linux -- Python 3.14.3, pytest-8.4.2, pluggy-1.6.0
cachedir: .tox/py/.pytest_cache
rootdir: /home/user/requests
configfile: pyproject.toml
plugins: httpbin-2.1.0, cov-7.0.0
collected 612 items                                                                                                                                                                                                                        

tests/test_adapters.py .                                                                                                                                                                                                             [  0%]
tests/test_help.py ...                                                                                                                                                                                                               [  0%]
tests/test_hooks.py ...                                                                                                                                                                                                              [  1%]
tests/test_lowlevel.py ....................                                                                                                                                                                                          [  4%]
tests/test_packages.py ...                                                                                                                                                                                                           [  4%]
tests/test_requests.py ........................................................................................................................spytest-httpbin server hit an exception serving request: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:1081)
attempting to ignore so the rest of the tests can run
127.0.0.1 - - [22/Feb/2026 20:08:29] "GET /get HTTP/1.1" 200 233
.................................................................................... [ 38%]
............................X..................................................................................................                                                                                                      [ 59%]
tests/test_structures.py ....................                                                                                                                                                                                        [ 62%]
tests/test_testserver.py ......s....                                                                                                                                                                                                 [ 64%]
tests/test_utils.py ..s.......................................................................................................................................................................................................ssssss [ 98%]
sssss.....s                                                                                                                                                                                                                          [100%]

============================================================================================================= warnings summary =============================================================================================================
.tox/py/lib/python3.14/site-packages/requests/__init__.py:113
  /home/user/requests/.tox/py/lib/python3.14/site-packages/requests/__init__.py:113: RequestsDependencyWarning: urllib3 (2.6.3) or chardet (6.0.0.post1)/charset_normalizer (None) doesn't match a supported version!
    warnings.warn(

tests/test_requests.py::TestRequests::test_set_basicauth[42-42]
tests/test_requests.py::TestRequests::test_set_basicauth[42-42]
  /home/user/requests/.tox/py/lib/python3.14/site-packages/requests/auth.py:36: DeprecationWarning: Non-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (42) to a string or bytes object in the near future to avoid problems.
    warnings.warn(

tests/test_requests.py::TestRequests::test_set_basicauth[42-42]
tests/test_requests.py::TestRequests::test_set_basicauth[42-42]
  /home/user/requests/.tox/py/lib/python3.14/site-packages/requests/auth.py:46: DeprecationWarning: Non-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (<class 'int'>) to a string or bytes object in the near future to avoid problems.
    warnings.warn(

tests/test_requests.py::TestRequests::test_set_basicauth[None-None]
tests/test_requests.py::TestRequests::test_set_basicauth[None-None]
  /home/user/requests/.tox/py/lib/python3.14/site-packages/requests/auth.py:36: DeprecationWarning: Non-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (None) to a string or bytes object in the near future to avoid problems.
    warnings.warn(

tests/test_requests.py::TestRequests::test_set_basicauth[None-None]
tests/test_requests.py::TestRequests::test_set_basicauth[None-None]
  /home/user/requests/.tox/py/lib/python3.14/site-packages/requests/auth.py:46: DeprecationWarning: Non-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (<class 'NoneType'>) to a string or bytes object in the near future to avoid problems.
    warnings.warn(

tests/test_requests.py::TestPreparingURLs::test_different_connection_pool_for_tls_settings_verify_True
tests/test_requests.py::TestPreparingURLs::test_different_connection_pool_for_tls_settings_verify_bundle_expired_cert
tests/test_requests.py::TestPreparingURLs::test_different_connection_pool_for_tls_settings_verify_bundle_unexpired_cert
tests/test_requests.py::TestPreparingURLs::test_different_connection_pool_for_mtls_settings
  /home/user/requests/.tox/py/lib/python3.14/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host 'localhost'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings
    warnings.warn(

tests/test_utils.py::TestContentEncodingDetection::test_none
tests/test_utils.py::TestContentEncodingDetection::test_pragmas[<meta charset="UTF-8">]
tests/test_utils.py::TestContentEncodingDetection::test_pragmas[<meta http-equiv="Content-type" content="text/html;charset=UTF-8">]
tests/test_utils.py::TestContentEncodingDetection::test_pragmas[<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />]
tests/test_utils.py::TestContentEncodingDetection::test_pragmas[<?xml version="1.0" encoding="UTF-8"?>]
tests/test_utils.py::TestContentEncodingDetection::test_precedence
  /home/user/requests/.tox/py/lib/python3.14/site-packages/requests/utils.py:482: DeprecationWarning: In requests 3.0, get_encodings_from_content will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
==================================================================================== 596 passed, 15 skipped, 1 xpassed, 19 warnings in 77.69s (0:01:17) ====================================================================================
  py: OK (81.82=setup[3.18]+cmd[78.64] seconds)
  congratulations :) (81.87 seconds)

Although looking at #6996 seems it was not necessary.

@aminvakil
Copy link
Contributor Author

Aha!
After adding chardet>=6.0.0 to requirements-dev.txt, this appears:
https://github.com/aminvakil/requests/actions/runs/22281326095/job/64452330231#step:5:42

 /home/runner/work/requests/requests/src/requests/__init__.py:113: RequestsDependencyWarning: urllib3 (2.6.3) or chardet (6.0.0.post1)/charset_normalizer (3.4.4) doesn't match a supported version!

Seems like the fix is not enough.

@aminvakil
Copy link
Contributor Author

OK, I didn't know that I had to src/requests/__init__.py to ensure there is no warning in runtime, with changing the major version in it, the warning is gone:
https://github.com/aminvakil/requests/actions/runs/22281469973/job/64452681974

Also tests are running fine ensuring chardet>=6.0.0 is getting installed.

I'm going to squash all commits now, there is no need for them.

@aminvakil aminvakil marked this pull request as ready for review February 22, 2026 17:10
@sigmavirus24
Copy link
Contributor

@nateprewitt Any objections to including this into the next release?

@nateprewitt
Copy link
Member

:shipit: If tests pass

@sigmavirus24 sigmavirus24 merged commit 4bd79e3 into psf:main Feb 22, 2026
26 checks passed
@aminvakil aminvakil deleted the chardet_6 branch February 22, 2026 23:01
hswong3i added a commit to alvistack/psf-requests that referenced this pull request Feb 24, 2026
    git clean -xdf
    tar zcvf ../python-requests_2.32.5.orig.tar.gz --exclude=.git .
    debuild -uc -us
    cp python-requests.spec ../python-requests_2.32.5-1.spec
    cp ../python*-requests*2.32.5*.{gz,xz,spec,dsc} /osc/home\:alvistack/psf-requests-2.32.5
    rm -rf ../python*-requests_2.32.5*.*

See psf#7220

Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
cadamsdotcom added a commit to cadamsdotcom/CodeLeash that referenced this pull request Feb 26, 2026
CodeLeash is a demonstration of agentic software development, not a
production application. The worker system can be rebuilt using the
patterns already in the repo (repository, service, container DI) when
actually needed. Removing it keeps the scaffold focused on what it
teaches: TDD enforcement, code quality checks, and full-stack
integration.

Also pins chardet<6 to fix a spurious RequestsDependencyWarning in
requests 2.32.5 (psf/requests#7220 is merged but unreleased).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
llucax added a commit to llucax/frequenz-repo-config-python that referenced this pull request Mar 3, 2026
We are currently having CI failures because there are some issues with
transitive dependencies. It is already [fixed
upstream](psf/requests#7220) but not release
yet. For now we just adjust golden tests to expect these warnings.

We will have to roll this back when upstream is fixed.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
andreatgretel added a commit to NVIDIA-NeMo/DataDesigner that referenced this pull request Mar 12, 2026
requests 2.32.5 asserts chardet<6 at import time, but sqlfluff and
diff_cover pull in chardet without an upper bound, resolving to 7.1.0
on fresh installs. Add a workspace constraint to cap chardet until a
new requests release ships the fix from psf/requests#7220.

Closes #404
andreatgretel added a commit to NVIDIA-NeMo/DataDesigner that referenced this pull request Mar 12, 2026
requests 2.32.5 asserts chardet<6 at import time, but sqlfluff and
diff_cover pull in chardet without an upper bound, resolving to 7.1.0
on fresh installs. Add a workspace constraint to cap chardet until a
new requests release ships the fix from psf/requests#7220.

Closes #404
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.

chardet 6 triggers RequestsDependencyWarning on stderr

3 participants