Skip to content

Commit

Permalink
chore: support Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Oct 16, 2023
1 parent adfa509 commit 2eef483
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 65 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies & browsers
run: |
python -m pip install --upgrade pip wheel
python -m pip install --upgrade pip
pip install -r local-requirements.txt
pip install -e .
python setup.py bdist_wheel
Expand Down Expand Up @@ -68,6 +68,15 @@ jobs:
- os: ubuntu-latest
python-version: '3.11'
browser: chromium
- os: windows-latest
python-version: '3.12'
browser: chromium
- os: macos-latest
python-version: '3.12'
browser: chromium
- os: ubuntu-latest
python-version: '3.12'
browser: chromium
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand All @@ -77,7 +86,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies & browsers
run: |
python -m pip install --upgrade pip wheel
python -m pip install --upgrade pip
pip install -r local-requirements.txt
pip install -e .
python setup.py bdist_wheel
Expand All @@ -88,8 +97,6 @@ jobs:
run: pytest tests/test_reference_count_async.py --browser=${{ matrix.browser }}
- name: Test Wheel Installation
run: pytest tests/test_installation.py --browser=${{ matrix.browser }}
- name: Test Generation Scripts
run: pytest tests/test_generation_scripts.py --browser=${{ matrix.browser }}
- name: Test Sync API
if: matrix.os != 'ubuntu-latest'
run: pytest tests/sync --browser=${{ matrix.browser }} --timeout 90
Expand Down Expand Up @@ -125,7 +132,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies & browsers
run: |
python -m pip install --upgrade pip wheel
python -m pip install --upgrade pip
pip install -r local-requirements.txt
pip install -e .
python setup.py bdist_wheel
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_canary_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
python-version: "3.10"
- name: Install dependencies & browsers
run: |
python -m pip install --upgrade pip wheel
python -m pip install --upgrade pip
pip install -r local-requirements.txt
pip install -e .
- uses: azure/docker-login@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_release_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
platforms: arm64
- name: Install dependencies & browsers
run: |
python -m pip install --upgrade pip wheel
python -m pip install --upgrade pip
pip install -r local-requirements.txt
pip install -e .
- run: ./utils/docker/publish_docker.sh stable
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ source ./env/bin/activate
Install required dependencies:

```sh
python -m pip install --upgrade pip wheel
python -m pip install --upgrade pip
pip install -r local-requirements.txt
```

Expand Down
1 change: 0 additions & 1 deletion local-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pytest-xdist==3.3.1
requests==2.31.0
service_identity==23.1.0
setuptools==68.2.2
twine==4.0.2
twisted==23.8.0
types-pyOpenSSL==23.2.0.2
wheel==0.41.2
2 changes: 1 addition & 1 deletion meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ requirements:
run:
- python
- greenlet ==3.0.0
- pyee ==9.0.4
- pyee ==11.0.1
- typing_extensions # [py<39]
test:
requires:
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[build-system]
requires = ["setuptools==60.9.3", "setuptools-scm==7.0.5", "wheel==0.38.1", "auditwheel==5.1.2"]
requires = ["setuptools==68.2.2", "setuptools-scm==8.0.4", "wheel==0.41.2", "auditwheel==5.4.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
version_file = "playwright/_repo_version.py"

[tool.pytest.ini_options]
addopts = "-Wall -rsx -vv -s"
markers = [
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate_async_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from types import FunctionType
from typing import Any

from scripts.documentation_provider import DocumentationProvider
from scripts.generate_api import (
from documentation_provider import DocumentationProvider
from generate_api import (
api_globals,
arguments,
generated_types,
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate_sync_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
from types import FunctionType
from typing import Any

from scripts.documentation_provider import DocumentationProvider
from scripts.generate_api import (
from documentation_provider import DocumentationProvider
from generate_api import (
api_globals,
arguments,
generated_types,
Expand Down
17 changes: 9 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,17 @@ def _download_and_extract_local_driver(
project_urls={
"Release notes": "https://github.com/microsoft/playwright-python/releases",
},
packages=["playwright"],
packages=[
"playwright",
"playwright.async_api",
"playwright.sync_api",
"playwright._impl",
"playwright._impl.__pyinstaller",
],
include_package_data=True,
install_requires=[
"greenlet==3.0.0",
"pyee==9.0.4",
"pyee==11.0.1",
"typing-extensions;python_version<='3.8'",
],
classifiers=[
Expand All @@ -225,17 +231,12 @@ def _download_and_extract_local_driver(
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
],
python_requires=">=3.8",
cmdclass={"bdist_wheel": PlaywrightBDistWheelCommand},
use_scm_version={
"version_scheme": "post-release",
"write_to": "playwright/_repo_version.py",
"write_to_template": 'version = "{version}"\n',
},
setup_requires=["setuptools-scm==7.0.5", "wheel==0.38.1"],
entry_points={
"console_scripts": [
"playwright=playwright.__main__:main",
Expand Down
39 changes: 0 additions & 39 deletions tests/test_generation_scripts.py

This file was deleted.

7 changes: 4 additions & 3 deletions tests/test_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@


def test_install(tmp_path: Path, browser_name: str) -> None:
env_dir = tmp_path / "env"
env = EnvBuilder(with_pip=True)
env.create(env_dir=tmp_path)
context = env.ensure_directories(tmp_path)
env.create(env_dir=env_dir)
context = env.ensure_directories(env_dir)
root = Path(__file__).parent.parent.resolve()
if sys.platform == "win32":
wheelpath = list((root / "dist").glob("playwright*win_amd64*.whl"))[0]
elif sys.platform == "linux":
wheelpath = list((root / "dist").glob("playwright*manylinux1*.whl"))[0]
elif sys.platform == "darwin":
wheelpath = list((root / "dist").glob("playwright*macosx_10_*.whl"))[0]
wheelpath = list((root / "dist").glob("playwright*macosx_*.whl"))[0]
subprocess.check_output(
[
context.env_exe,
Expand Down

0 comments on commit 2eef483

Please sign in to comment.