Skip to content

[py] Bump Python package requirements to latest versions #15731

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

Open
wants to merge 12 commits into
base: trunk
Choose a base branch
from

Conversation

cgoldberg
Copy link
Contributor

@cgoldberg cgoldberg commented May 11, 2025

User description

💥 What does this PR do?

This PR updates all of the Python dependencies/requirements to the latest versions.

  • updates dependencies in pyproject.toml for packaging
  • updates dependencies in py/BUILD.bazel for building/testing/packaging
  • updates dependency versions in py/requirements.txt
  • adds tox and its dependencies to py/requirements.txt
  • updates Python CI job to use new version of tox
  • adds missing pinned transient dependencies to py/requirements.txt
  • generates new py/requirements_lock.txt with updated hashes
  • fixes errors in tests that were failing due to deprecations in the newer version of PyTest
  • removes trove license classifier from packaging data since it is now deprecated (license is specified through project.license metadata)

🔄 Types of changes

  • Build/Packaging Maintenance

PR Type

Enhancement


Description

  • Upgrade all Python dependencies to latest versions

  • Update Bazel, pyproject, requirements, and lock files

  • Refactor tests for Pytest 8.x deprecation compatibility

  • Minor code improvements for path handling in tests


Changes walkthrough 📝

Relevant files
Dependencies
4 files
BUILD.bazel
Update Bazel build dependencies to latest versions             
+6/-6     
pyproject.toml
Update project dependencies to latest versions                     
+6/-6     
requirements.txt
Bump all Python requirements to latest versions                   
+24/-24 
requirements_lock.txt
Regenerate lock file for updated dependencies                       
+308/-270
Enhancement
1 files
conftest.py
Refactor for Pytest 8.x compatibility and path handling   
+4/-4     
Tests
3 files
devtools_tests.py
Refactor test to use recwarn for Pytest 8.x                           
+3/-4     
firefox_service_tests.py
Update test to use recwarn for Pytest 8.x                               
+3/-4     
remote_connection_tests.py
Refactor test to use recwarn for Pytest 8.x                           
+3/-4     

Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • @selenium-ci selenium-ci added C-py Python Bindings B-build Includes scripting, bazel and CI integrations labels May 11, 2025
    Copy link
    Contributor

    qodo-merge-pro bot commented May 11, 2025

    PR Reviewer Guide 🔍

    (Review updated until commit 1064a77)

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Path Handling

    The PR changes path handling from string-based to using Path objects. Verify that this works correctly across all operating systems, especially Windows where path separators differ.

    def pytest_ignore_collect(collection_path, config):
        drivers_opt = config.getoption("drivers")
        _drivers = set(drivers).difference(drivers_opt or drivers)
        if drivers_opt:
            _drivers.add("unit")
        return len([d for d in _drivers if d.lower() in collection_path.parts]) > 0
    Warning Capture

    The test has been refactored to use recwarn fixture instead of pytest.warns(). Ensure this correctly captures the expected warning in all test environments.

    def test_get_remote_connection_headers_adds_auth_header_if_pass(recwarn):
        url = "http://user:pass@remote"
        headers = RemoteConnection.get_remote_connection_headers(parse.urlparse(url))
        assert headers.get("Authorization") == "Basic dXNlcjpwYXNz"
        assert (
            recwarn[0].message.args[0]
            == "Embedding username and password in URL could be insecure, use ClientConfig instead"

    Copy link
    Contributor

    qodo-merge-pro bot commented May 11, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Use flexible version constraints

    The dependency version constraints are too strict, which could lead to
    compatibility issues with other packages. Use more flexible version constraints
    to allow minor version updates without breaking compatibility.

    py/pyproject.toml [28-35]

     dependencies = [
    -    "urllib3[socks]~=2.4.0",
    -    "trio~=0.30.0",
    -    "trio-websocket~=0.12.2",
    +    "urllib3[socks]>=2.4.0,<3",
    +    "trio>=0.30.0,<0.31",
    +    "trio-websocket>=0.12.2,<0.13",
         "certifi>=2025.4.26",
    -    "typing_extensions~=4.13.2",
    -    "websocket-client~=1.8.0",
    +    "typing_extensions>=4.13.2,<5",
    +    "websocket-client>=1.8.0,<2",
         ]
    • Apply / Chat
    Suggestion importance[1-10]: 7

    __

    Why: The suggestion to use more flexible version constraints is valid and important for dependency management. Using upper bounds (<3, <0.31, etc.) allows for compatible minor updates while preventing major version changes that might break functionality. This improves compatibility with other packages in the ecosystem.

    Medium
    • Update

    @cgoldberg cgoldberg marked this pull request as draft May 11, 2025 16:34
    @cgoldberg
    Copy link
    Contributor Author

    There are some issues using the latest version of pytest... marking this as a draft for now.

    @cgoldberg cgoldberg marked this pull request as ready for review May 11, 2025 21:31
    Copy link
    Contributor

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    B-build Includes scripting, bazel and CI integrations C-py Python Bindings Review effort 2/5
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants