Skip to content

Commit 9f042ec

Browse files
authored
chore: support Python 3.12 (#2116)
1 parent adfa509 commit 9f042ec

13 files changed

+37
-65
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
python-version: "3.10"
2929
- name: Install dependencies & browsers
3030
run: |
31-
python -m pip install --upgrade pip wheel
31+
python -m pip install --upgrade pip
3232
pip install -r local-requirements.txt
3333
pip install -e .
3434
python setup.py bdist_wheel
@@ -68,6 +68,15 @@ jobs:
6868
- os: ubuntu-latest
6969
python-version: '3.11'
7070
browser: chromium
71+
- os: windows-latest
72+
python-version: '3.12'
73+
browser: chromium
74+
- os: macos-latest
75+
python-version: '3.12'
76+
browser: chromium
77+
- os: ubuntu-latest
78+
python-version: '3.12'
79+
browser: chromium
7180
runs-on: ${{ matrix.os }}
7281
steps:
7382
- uses: actions/checkout@v3
@@ -77,7 +86,7 @@ jobs:
7786
python-version: ${{ matrix.python-version }}
7887
- name: Install dependencies & browsers
7988
run: |
80-
python -m pip install --upgrade pip wheel
89+
python -m pip install --upgrade pip
8190
pip install -r local-requirements.txt
8291
pip install -e .
8392
python setup.py bdist_wheel
@@ -88,8 +97,6 @@ jobs:
8897
run: pytest tests/test_reference_count_async.py --browser=${{ matrix.browser }}
8998
- name: Test Wheel Installation
9099
run: pytest tests/test_installation.py --browser=${{ matrix.browser }}
91-
- name: Test Generation Scripts
92-
run: pytest tests/test_generation_scripts.py --browser=${{ matrix.browser }}
93100
- name: Test Sync API
94101
if: matrix.os != 'ubuntu-latest'
95102
run: pytest tests/sync --browser=${{ matrix.browser }} --timeout 90
@@ -125,7 +132,7 @@ jobs:
125132
python-version: "3.10"
126133
- name: Install dependencies & browsers
127134
run: |
128-
python -m pip install --upgrade pip wheel
135+
python -m pip install --upgrade pip
129136
pip install -r local-requirements.txt
130137
pip install -e .
131138
python setup.py bdist_wheel

.github/workflows/publish_canary_docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
python-version: "3.10"
1919
- name: Install dependencies & browsers
2020
run: |
21-
python -m pip install --upgrade pip wheel
21+
python -m pip install --upgrade pip
2222
pip install -r local-requirements.txt
2323
pip install -e .
2424
- uses: azure/docker-login@v1

.github/workflows/publish_release_docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
platforms: arm64
3434
- name: Install dependencies & browsers
3535
run: |
36-
python -m pip install --upgrade pip wheel
36+
python -m pip install --upgrade pip
3737
pip install -r local-requirements.txt
3838
pip install -e .
3939
- run: ./utils/docker/publish_docker.sh stable

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ source ./env/bin/activate
1515
Install required dependencies:
1616

1717
```sh
18-
python -m pip install --upgrade pip wheel
18+
python -m pip install --upgrade pip
1919
pip install -r local-requirements.txt
2020
```
2121

local-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pytest-xdist==3.3.1
1818
requests==2.31.0
1919
service_identity==23.1.0
2020
setuptools==68.2.2
21-
twine==4.0.2
2221
twisted==23.8.0
2322
types-pyOpenSSL==23.2.0.2
2423
wheel==0.41.2

meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ requirements:
2424
run:
2525
- python
2626
- greenlet ==3.0.0
27-
- pyee ==9.0.4
27+
- pyee ==11.0.1
2828
- typing_extensions # [py<39]
2929
test:
3030
requires:

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
[build-system]
2-
requires = ["setuptools==60.9.3", "setuptools-scm==7.0.5", "wheel==0.38.1", "auditwheel==5.1.2"]
2+
requires = ["setuptools==68.2.2", "setuptools-scm==8.0.4", "wheel==0.41.2", "auditwheel==5.4.0"]
33
build-backend = "setuptools.build_meta"
44

5+
[tool.setuptools_scm]
6+
version_file = "playwright/_repo_version.py"
7+
58
[tool.pytest.ini_options]
69
addopts = "-Wall -rsx -vv -s"
710
markers = [

scripts/__init__.py

Whitespace-only changes.

scripts/generate_async_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
from types import FunctionType
1919
from typing import Any
2020

21-
from scripts.documentation_provider import DocumentationProvider
22-
from scripts.generate_api import (
21+
from documentation_provider import DocumentationProvider
22+
from generate_api import (
2323
api_globals,
2424
arguments,
2525
generated_types,

scripts/generate_sync_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
from types import FunctionType
2020
from typing import Any
2121

22-
from scripts.documentation_provider import DocumentationProvider
23-
from scripts.generate_api import (
22+
from documentation_provider import DocumentationProvider
23+
from generate_api import (
2424
api_globals,
2525
arguments,
2626
generated_types,

setup.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,17 @@ def _download_and_extract_local_driver(
209209
project_urls={
210210
"Release notes": "https://github.com/microsoft/playwright-python/releases",
211211
},
212-
packages=["playwright"],
212+
packages=[
213+
"playwright",
214+
"playwright.async_api",
215+
"playwright.sync_api",
216+
"playwright._impl",
217+
"playwright._impl.__pyinstaller",
218+
],
213219
include_package_data=True,
214220
install_requires=[
215221
"greenlet==3.0.0",
216-
"pyee==9.0.4",
222+
"pyee==11.0.1",
217223
"typing-extensions;python_version<='3.8'",
218224
],
219225
classifiers=[
@@ -225,17 +231,12 @@ def _download_and_extract_local_driver(
225231
"Programming Language :: Python :: 3.9",
226232
"Programming Language :: Python :: 3.10",
227233
"Programming Language :: Python :: 3.11",
234+
"Programming Language :: Python :: 3.12",
228235
"License :: OSI Approved :: Apache Software License",
229236
"Operating System :: OS Independent",
230237
],
231238
python_requires=">=3.8",
232239
cmdclass={"bdist_wheel": PlaywrightBDistWheelCommand},
233-
use_scm_version={
234-
"version_scheme": "post-release",
235-
"write_to": "playwright/_repo_version.py",
236-
"write_to_template": 'version = "{version}"\n',
237-
},
238-
setup_requires=["setuptools-scm==7.0.5", "wheel==0.38.1"],
239240
entry_points={
240241
"console_scripts": [
241242
"playwright=playwright.__main__:main",

tests/test_generation_scripts.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

tests/test_installation.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@
2121

2222

2323
def test_install(tmp_path: Path, browser_name: str) -> None:
24+
env_dir = tmp_path / "env"
2425
env = EnvBuilder(with_pip=True)
25-
env.create(env_dir=tmp_path)
26-
context = env.ensure_directories(tmp_path)
26+
env.create(env_dir=env_dir)
27+
context = env.ensure_directories(env_dir)
2728
root = Path(__file__).parent.parent.resolve()
2829
if sys.platform == "win32":
2930
wheelpath = list((root / "dist").glob("playwright*win_amd64*.whl"))[0]
3031
elif sys.platform == "linux":
3132
wheelpath = list((root / "dist").glob("playwright*manylinux1*.whl"))[0]
3233
elif sys.platform == "darwin":
33-
wheelpath = list((root / "dist").glob("playwright*macosx_10_*.whl"))[0]
34+
wheelpath = list((root / "dist").glob("playwright*macosx_*.whl"))[0]
3435
subprocess.check_output(
3536
[
3637
context.env_exe,

0 commit comments

Comments
 (0)