Skip to content

Commit

Permalink
Drop py37 support (#12400)
Browse files Browse the repository at this point in the history
* [py]: Upgrading syntax to be `python3.8+`

* [py]: Upgrade infrastructure for `python3.8+`

* [py] Remove accidental commit of pre commit config used for upgrading

* [py]: Remove py37 classifiers from bazel python packaging recipes

* [py]: Apply `flake8` with py3.8 - update docstrings inline with `PEP-257`

* [py]: Use more python3.8+ syntax

* [py]: Remove old python3.7 comments in code

* [py] Apply more python3.8+ type hints

* [py]: Fix conflicts and make `CHANGES` accurate

---------

Co-authored-by: Diego Molina <[email protected]>
  • Loading branch information
symonk and diemol authored Aug 28, 2023
1 parent 09674ae commit 98d4640
Show file tree
Hide file tree
Showing 38 changed files with 127 additions and 201 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
steps:
- name: Checkout source tree
uses: actions/checkout@v3
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.7.10
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -40,10 +40,10 @@ jobs:
steps:
- name: Checkout source tree
uses: actions/checkout@v3
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.7.10
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -60,10 +60,10 @@ jobs:
steps:
- name: Checkout source tree
uses: actions/checkout@v3
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.7.10
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
3 changes: 1 addition & 2 deletions py/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ py_wheel(
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Libraries",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -212,7 +211,7 @@ py_wheel(
distribution = "selenium",
homepage = "https://www.selenium.dev",
license = "Apache 2.0",
python_requires = ">=3.7",
python_requires = ">=3.8",
python_tag = "py3",
requires = [
"urllib3[socks]>=1.26,<3",
Expand Down
4 changes: 2 additions & 2 deletions py/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Selenium 4.12.0
* fix bug in common options (#12499)
* allow setting http client certifications with REQUESTS_CA_BUNDLE env (#11957)
* support conda installation of selenium manager (#12536)


* Drop support for `python3.7`
* Fixed a bug where `Popen.wait()` calls caught the wrong exceptions when timing out

Selenium 4.11.2
* better bug fix for #12454
Expand Down
4 changes: 2 additions & 2 deletions py/docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Several browsers/drivers are supported (Firefox, Chrome, Internet Explorer), as
Supported Python Versions
=========================

* Python 3.7+
* Python 3.8+

Installing
==========
Expand Down Expand Up @@ -148,7 +148,7 @@ Contributing

- Create a branch for your work
- Ensure `tox` is installed (using a `virtualenv` is recommended)
- `python3.7 -m venv .venv && . .venv/bin/activate && pip install tox`
- `python3.8 -m venv .venv && . .venv/bin/activate && pip install tox`
- After making changes, before committing execute `tox -e linting`
- If tox exits `0`, commit and push otherwise fix the newly introduced breakages.
- `flake8` requires manual fixes
Expand Down
1 change: 0 additions & 1 deletion py/selenium/common/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

"""Exceptions that may happen in all the webdriver code."""

from typing import Optional
Expand Down
1 change: 0 additions & 1 deletion py/selenium/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

"""Selenium type definitions."""

import typing
Expand Down
37 changes: 12 additions & 25 deletions py/selenium/webdriver/chromium/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ def __init__(self) -> None:

@property
def binary_location(self) -> str:
"""
:Returns: The location of the binary, otherwise an empty string
"""
""":Returns: The location of the binary, otherwise an empty string."""
return self._binary_location

@binary_location.setter
def binary_location(self, value: str) -> None:
"""
Allows you to set where the chromium binary lives
"""Allows you to set where the chromium binary lives.
:Args:
- value: path to the Chromium binary
"""
Expand All @@ -57,17 +55,14 @@ def binary_location(self, value: str) -> None:

@property
def debugger_address(self) -> str:
"""
:Returns: The address of the remote devtools instance
"""
""":Returns: The address of the remote devtools instance."""
return self._debugger_address

@debugger_address.setter
def debugger_address(self, value: str) -> None:
"""
Allows you to set the address of the remote devtools instance
that the ChromeDriver instance will try to connect to during an
active wait.
"""Allows you to set the address of the remote devtools instance that
the ChromeDriver instance will try to connect to during an active wait.
:Args:
- value: address of remote devtools instance if any (hostname[:port])
"""
Expand All @@ -77,9 +72,7 @@ def debugger_address(self, value: str) -> None:

@property
def extensions(self) -> List[str]:
"""
:Returns: A list of encoded extensions that will be loaded
"""
""":Returns: A list of encoded extensions that will be loaded."""

def _decode(file_data: BinaryIO) -> str:
# Should not use base64.encodestring() which inserts newlines every
Expand Down Expand Up @@ -124,9 +117,7 @@ def add_encoded_extension(self, extension: str) -> None:

@property
def experimental_options(self) -> dict:
"""
:Returns: A dictionary of experimental options for chromium
"""
""":Returns: A dictionary of experimental options for chromium."""
return self._experimental_options

def add_experimental_option(self, name: str, value: Union[str, int, dict, List[str]]) -> None:
Expand All @@ -140,9 +131,7 @@ def add_experimental_option(self, name: str, value: Union[str, int, dict, List[s

@property
def headless(self) -> bool:
"""
:Returns: True if the headless argument is set, else False
"""
""":Returns: True if the headless argument is set, else False."""
warnings.warn(
"headless property is deprecated, instead check for '--headless' in arguments",
DeprecationWarning,
Expand Down Expand Up @@ -176,10 +165,8 @@ def headless(self, value: bool) -> None:
self._arguments = list(set(self._arguments) - args)

def to_capabilities(self) -> dict:
"""
Creates a capabilities with all the options that have been set
:Returns: A dictionary with everything
"""
"""Creates a capabilities with all the options that have been set
:Returns: A dictionary with everything."""
caps = self._caps
chrome_options = self.experimental_options.copy()
if self.mobile_options:
Expand Down
16 changes: 6 additions & 10 deletions py/selenium/webdriver/chromium/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@ def launch_app(self, id):
def get_network_conditions(self):
"""Gets Chromium network emulation settings.
:Returns:
A dict. For example:
{'latency': 4, 'download_throughput': 2, 'upload_throughput': 2,
'offline': False}
:Returns: A dict. For example: {'latency': 4,
'download_throughput': 2, 'upload_throughput': 2, 'offline':
False}
"""
return self.execute("getNetworkConditions")["value"]

Expand Down Expand Up @@ -140,15 +139,12 @@ def execute_cdp_cmd(self, cmd: str, cmd_args: dict):
return self.execute("executeCdpCommand", {"cmd": cmd, "params": cmd_args})["value"]

def get_sinks(self) -> list:
"""
:Returns: A list of sinks available for Cast.
"""
""":Returns: A list of sinks available for Cast."""
return self.execute("getSinks")["value"]

def get_issue_message(self):
"""
:Returns: An error message when there is any issue in a Cast session.
"""
""":Returns: An error message when there is any issue in a Cast
session."""
return self.execute("getIssueMessage")["value"]

def set_sink_to_use(self, sink_name: str) -> dict:
Expand Down
Loading

0 comments on commit 98d4640

Please sign in to comment.