Skip to content

Commit

Permalink
chore: drop Python 3.7 (#1980)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Jun 16, 2023
1 parent f8c4548 commit 0620596
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 238 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ assignees: ''
**Context:**
- Playwright Version: [what Playwright version do you use?]
- Operating System: [e.g. Windows, Linux or Mac]
- Python version: [e.g. 3.7, 3.9]
- Python version: [e.g. 3.8, 3.9]
- Browser: [e.g. All, Chromium, Firefox, WebKit]
- Extra: [any specific details about your environment]

Expand Down
36 changes: 1 addition & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,34 +43,13 @@ jobs:
build:
name: Build
timeout-minutes: 45
env:
DEBUG: pw:*
DEBUG_FILE: pw-log.txt
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.7, 3.8]
python-version: [3.8, 3.9]
browser: [chromium, firefox, webkit]
include:
- os: ubuntu-latest
python-version: 3.9
browser: chromium
- os: windows-latest
python-version: 3.9
browser: chromium
- os: macos-latest
python-version: 3.9
browser: chromium
- os: macos-11.0
python-version: 3.9
browser: chromium
- os: macos-11.0
python-version: 3.9
browser: firefox
- os: macos-11.0
python-version: 3.9
browser: webkit
- os: ubuntu-latest
python-version: '3.10'
browser: chromium
Expand Down Expand Up @@ -129,18 +108,10 @@ jobs:
- name: Test Async API
if: matrix.os == 'ubuntu-latest'
run: xvfb-run pytest tests/async --browser=${{ matrix.browser }} --timeout 90
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.browser }}-${{ matrix.os }}-${{ matrix.python-version }}
path: pw-log.txt

test-stable:
name: Stable
timeout-minutes: 45
env:
DEBUG: pw:*
DEBUG_FILE: pw-log.txt
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -179,11 +150,6 @@ jobs:
- name: Test Async API
if: matrix.os == 'ubuntu-latest'
run: xvfb-run pytest tests/async --browser=chromium --browser-channel=${{ matrix.browser-channel }} --timeout 90
- uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.browser-channel }}-${{ matrix.os }}
path: pw-log.txt

build-conda:
name: Conda Build
Expand Down
17 changes: 0 additions & 17 deletions playwright/_impl/_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import asyncio
import inspect
import os
import sys
Expand All @@ -30,22 +29,6 @@ def compute_driver_executable() -> Path:
return package_path / "driver" / "playwright.sh"


if sys.version_info.major == 3 and sys.version_info.minor == 7:
if sys.platform == "win32":
# Use ProactorEventLoop in 3.7, which is default in 3.8
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
else:
# Prevent Python 3.7 from throwing on Linux:
# RuntimeError: Cannot add child handler, the child watcher does not have a loop attached
asyncio.get_event_loop()
try:
asyncio.get_child_watcher()
except Exception:
# uvloop does not support child watcher
# see https://github.com/microsoft/playwright-python/issues/582
pass


def get_driver_env() -> dict:
env = os.environ.copy()
env["PW_LANG_NAME"] = "python"
Expand Down
15 changes: 0 additions & 15 deletions playwright/sync_api/_context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import asyncio
import sys
from typing import TYPE_CHECKING, Any, Optional, cast

from greenlet import greenlet
Expand Down Expand Up @@ -50,20 +49,6 @@ def __enter__(self) -> SyncPlaywright:
Please use the Async API instead."""
)

# In Python 3.7, asyncio.Process.wait() hangs because it does not use ThreadedChildWatcher
# which is used in Python 3.8+. This is unix specific and also takes care about
# cleaning up zombie processes. See https://bugs.python.org/issue35621
if (
sys.version_info[0] == 3
and sys.version_info[1] == 7
and sys.platform != "win32"
and isinstance(asyncio.get_child_watcher(), asyncio.SafeChildWatcher)
):
from ._py37ThreadedChildWatcher import ThreadedChildWatcher # type: ignore

self._watcher = ThreadedChildWatcher()
asyncio.set_child_watcher(self._watcher) # type: ignore

# Create a new fiber for the protocol dispatcher. It will be pumping events
# until the end of times. We will pass control to that fiber every time we
# block while waiting for a response.
Expand Down
166 changes: 0 additions & 166 deletions playwright/sync_api/_py37ThreadedChildWatcher.py

This file was deleted.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ asyncio_mode = "auto"

[tool.mypy]
ignore_missing_imports = true
python_version = "3.7"
python_version = "3.8"
warn_unused_ignores = false
warn_redundant_casts = true
warn_unused_configs = true
Expand All @@ -32,7 +32,7 @@ profile = "black"
[tool.pyright]
include = ["playwright", "tests/sync"]
ignore = ["tests/async/", "scripts/", "examples/"]
pythonVersion = "3.7"
pythonVersion = "3.8"
reportMissingImports = false
reportTypedDictNotRequiredAccess = false
reportCallInDefaultInitializer = true
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,14 @@ def _download_and_extract_local_driver(
"Topic :: Internet :: WWW/HTTP :: Browsers",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
],
python_requires=">=3.7",
python_requires=">=3.8",
cmdclass={"bdist_wheel": PlaywrightBDistWheelCommand},
use_scm_version={
"version_scheme": "post-release",
Expand Down

0 comments on commit 0620596

Please sign in to comment.