Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move urllib3 constraint to pyproject.toml #106768

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

autinerd
Copy link
Contributor

Breaking change

Proposed change

Move the urllib3 constraint to the pyproject.toml

Currently, when installing homeassistant via pip, urllib3 version 2.1.0 gets installed (constraint urllib3<3 from requests)
When starting homeassistant for the first time, the correct version is getting installed, but because a newer version was already installed and is in memory, the mobile_app component can't be imported.

2023-12-31 11:37:23.740 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing component homeassistant.components.mobile_app                                                                                      [234/1880]
Traceback (most recent call last):                                                                                                                                                                                                            
  File "<VENV-FOLDER>/lib/python3.11/site-packages/homeassistant/loader.py", line 814, in get_component                                                                                                                             
    ComponentProtocol, importlib.import_module(self.pkg_path)                                                                                                                                                                                 
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                 
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module                                                                                                                                                                
    return _bootstrap._gcd_import(name[level:], package, level)                                                                                                                                                                               
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                               
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import                                                                                                                                                                             
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load                                                                                                                                                                          
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked                                                                                                                                                                 
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked                                                                                                                                                                           
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module                                                                                                                                                                     
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed                                                                                                                                                                
  File "<VENV-FOLDER>/lib/python3.11/site-packages/homeassistant/components/mobile_app/__init__.py", line 5, in <module>                                                                                                            
    from homeassistant.components import cloud, notify as hass_notify                                                                                                                                                                         
  File "<VENV-FOLDER>/lib/python3.11/site-packages/homeassistant/components/cloud/__init__.py", line 9, in <module>                                                                                                                 
    from hass_nabucasa import Cloud                                                                                                                                                                                                           
  File "<VENV-FOLDER>/lib/python3.11/site-packages/hass_nabucasa/__init__.py", line 15, in <module>                                                                                                                                 
    from .auth import CloudError, CognitoAuth                                                                                                                                                                                                 
  File "<VENV-FOLDER>/lib/python3.11/site-packages/hass_nabucasa/auth.py", line 11, in <module>                                                                                                                                     
    import boto3                                                                                                                                                                                                                              
  File "<VENV-FOLDER>/lib/python3.11/site-packages/boto3/__init__.py", line 17, in <module>                                                                                                                                         
    from boto3.session import Session                                                                                                                                                                                                         
  File "<VENV-FOLDER>/lib/python3.11/site-packages/boto3/session.py", line 17, in <module>                                                                                                                                          
    import botocore.session                                                                                                                                                                                                                   
  File "<VENV-FOLDER>/lib/python3.11/site-packages/botocore/session.py", line 26, in <module>                                                                                                                                       
    import botocore.client                                                                                                                                                                                                                    
  File "<VENV-FOLDER>/lib/python3.11/site-packages/botocore/client.py", line 15, in <module>                                                                                                                                        
    from botocore import waiter, xform_name                                                                                                                                                                                                   
  File "<VENV-FOLDER>/lib/python3.11/site-packages/botocore/waiter.py", line 18, in <module>                                                                                                                                        
    from botocore.docs.docstring import WaiterDocstring                                                                                                                                                                                       
  File "<VENV-FOLDER>/lib/python3.11/site-packages/botocore/docs/__init__.py", line 15, in <module>                                                                                                                                 
    from botocore.docs.service import ServiceDocumenter                                                                                                                                                                                       
  File "<VENV-FOLDER>/lib/python3.11/site-packages/botocore/docs/service.py", line 14, in <module>                                                                                                                                  
    from botocore.docs.client import (                                                                                                                                                                                                        
  File "<VENV-FOLDER>/lib/python3.11/site-packages/botocore/docs/client.py", line 18, in <module>        
    from botocore.docs.example import ResponseExampleDocumenter                                                                                                                                                                               
  File "<VENV-FOLDER>/lib/python3.11/site-packages/botocore/docs/example.py", line 13, in <module>                                                                                                                                  
    from botocore.docs.shape import ShapeDocumenter                                                                    
  File "<VENV-FOLDER>/lib/python3.11/site-packages/botocore/docs/shape.py", line 19, in <module>                                                                                                                                    
    from botocore.utils import is_json_value_header                                                                                                                                                                                           
  File "<VENV-FOLDER>/lib/python3.11/site-packages/botocore/utils.py", line 39, in <module>                                                                                                                                         
    import botocore.httpsession                                                                                        
  File "<VENV-FOLDER>/lib/python3.11/site-packages/botocore/httpsession.py", line 45, in <module>        
    from urllib3.contrib.pyopenssl import (
  File "<VENV-FOLDER>/lib/python3.11/site-packages/urllib3/contrib/pyopenssl.py", line 97, in <module>
    util.PROTOCOL_TLS: OpenSSL.SSL.SSLv23_METHOD,
    ^^^^^^^^^^^^^^^^^
AttributeError: module 'urllib3.util' has no attribute 'PROTOCOL_TLS'

After killing hass and starting it again, it works without problems, so this bug is inconvenient, but not blocking.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@autinerd autinerd requested a review from a team as a code owner December 31, 2023 10:59
@home-assistant home-assistant bot added bugfix cla-signed core small-pr PRs with less than 30 lines. labels Dec 31, 2023
Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Would like another set of 👀 before merging

@frenck frenck added this to the 2024.1.0 milestone Jan 2, 2024
Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @autinerd 👍

../Frenck

@frenck frenck merged commit 729a0fb into home-assistant:dev Jan 2, 2024
53 checks passed
@autinerd autinerd deleted the patch-20231231 branch January 2, 2024 12:35
@github-actions github-actions bot locked and limited conversation to collaborators Jan 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants