Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 20 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
- "pypy-3.11"
wayland-version: ["1.24.0"]
wayland-protocols-version: ["1.45"]
Expand All @@ -91,13 +91,13 @@ jobs:
echo "XDG_RUNTIME_DIR=/tmp" >> $GITHUB_ENV
- name: Install Python dependencies
run: |
pip install "setuptools>=77.0.0"
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install .[ci]
python pywayland/ffi_build.py
python -m pywayland.scanner --with-protocols
- name: Run unit tests
run: pytest --cov pywayland --cov-report term-missing
run: |
pip install .[test]
pytest --cov pywayland --cov-report term-missing
- name: Push coverage
run: coveralls --service=github
env:
Expand All @@ -119,7 +119,7 @@ jobs:
runs-on: ubuntu-24.04
needs: build-wayland
env:
python-version: "3.13"
python-version: "3.14"
wayland-version: "1.24.0"
wayland-protocols-version: "1.45"
steps:
Expand All @@ -139,36 +139,19 @@ jobs:
echo "XDG_RUNTIME_DIR=/tmp" >> $GITHUB_ENV
- name: Install Python dependencies
run: |
pip install "setuptools>=77.0.0"
pip install -r requirements.txt
pip install -r doc/requirements.txt
pip install .[ci]
python pywayland/ffi_build.py
python -m pywayland.scanner --with-protocols
- name: Build docs
run: sphinx-build -W -b html doc doc/_build/html
ruff-test:
name: ruff test
runs-on: ubuntu-24.04
env:
python-version: "3.13"
wayland-version: "1.24.0"
wayland-protocols-version: "1.45"
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
- name: Run ruff check
uses: astral-sh/ruff-action@v3
with:
src: pywayland
mypy-test:
name: mypy test
run: |
pip install .[docs]
sphinx-build -W -b html doc doc/_build/html
pre-commit-test:
name: pre-commit test
runs-on: ubuntu-24.04
needs: build-wayland
env:
python-version: "3.13"
python-version: "3.14"
wayland-version: "1.24.0"
wayland-protocols-version: "1.45"
steps:
Expand All @@ -188,19 +171,17 @@ jobs:
echo "XDG_RUNTIME_DIR=/tmp" >> $GITHUB_ENV
- name: Install Python dependencies
run: |
pip install "setuptools>=77.0.0"
pip install -r requirements.txt
pip install -r requirements-types.txt
pip install .[ci]
python pywayland/ffi_build.py
python -m pywayland.scanner --with-protocols
- name: Run mypy test
run: mypy -p pywayland
- name: Run pre-commit test
uses: pre-commit/action@v3.0.1
packaging-test:
name: packaging test
runs-on: ubuntu-24.04
needs: build-wayland
env:
python-version: "3.13"
python-version: "3.14"
wayland-version: "1.24.0"
wayland-protocols-version: "1.45"
steps:
Expand All @@ -220,12 +201,12 @@ jobs:
echo "XDG_RUNTIME_DIR=/tmp" >> $GITHUB_ENV
- name: Install Python dependencies
run: |
pip install "setuptools>=77.0.0"
pip install -r requirements.txt
pip install build check-manifest twine
pip install .[ci]
python pywayland/ffi_build.py
python -m pywayland.scanner --with-protocols
- name: Run packaging test
run: |
pip install .[packaging]
check-manifest
python setup.py check -m -s
python -m build --sdist
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-24.04
container: quay.io/pypa/manylinux_2_34_x86_64
env:
python-version: "3.14"
wayland-version: "1.24.0"
wayland-protocols-version: "1.45"
python-version: "3.13"
steps:
- name: Install dependencies
run: |
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Download wayland libraries
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -154,11 +154,11 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
- "pypy-3.11"
steps:
- name: Download wheels
Expand All @@ -182,7 +182,7 @@ jobs:
container: quay.io/pypa/manylinux_2_34_x86_64
needs: build-wayland
env:
python-version: "3.13"
python-version: "3.14"
steps:
- name: Download wayland libraries
uses: actions/download-artifact@v4
Expand Down
8 changes: 7 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.0
rev: v0.14.4
hooks:
- id: ruff-check
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.18.2
hooks:
- id: mypy
files: "^(pywayland|example)\/.*"
12 changes: 8 additions & 4 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import importlib
import os
import re
import shutil
import sys
import re

# -- Mock necessary classes -----------------------------------------------
from unittest.mock import MagicMock

import sphinx_rtd_theme
import sphinx_rtd_theme # noqa: F401

sys.path.insert(0, os.path.abspath("."))
sys.path.insert(0, os.path.abspath(".."))
Expand All @@ -18,9 +18,13 @@
sys.modules.update((mod_name, MagicMock()) for mod_name in MOCK_MODULES)

# -- Build pywayland.protocol w/docs --------------------------------------
from protocol_build import protocols_build, protocols_version, wayland_version
from protocol_build import ( # noqa: E402
protocols_build,
protocols_version,
wayland_version,
)

from pywayland import __version__
from pywayland import __version__ # noqa: E402

protocol_build_dir = "../pywayland/protocol/"
protocol_doc_dir = "module/protocol"
Expand Down
2 changes: 0 additions & 2 deletions doc/requirements.txt

This file was deleted.

22 changes: 19 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ build-backend = "setuptools.build_meta"
name = "pywayland"
description = "Python bindings for the libwayland library written in pure Python"
authors = [{name = "Sean Vig", email = "sean.v.775@gmail.com"}]
requires-python = ">=3.9"
requires-python = ">=3.10"
license = "Apache-2.0"
readme = "README.rst"
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Operating System :: POSIX",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Desktop Environment :: Window Managers",
Expand All @@ -40,7 +40,22 @@ source = "https://github.com/flacjacket/pywayland"
issues = "https://github.com/flacjacket/pywayland/issues"

[project.optional-dependencies]
test = ["pytest"]
ci = ["setuptools>=77.0.0"]
test = [
"pytest",
"pytest-cov",
"coverage>=6.5.0",
"coveralls>=3.3.1",
]
docs = [
"sphinx",
"sphinx_rtd_theme",
]
packaging = [
"build",
"check-manifest",
"twine",
]

[project.scripts]
pywayland-scanner = "pywayland.scanner.__main__:main"
Expand Down Expand Up @@ -78,6 +93,7 @@ ignore = [
]

[tool.mypy]
packages = ["pywayland", "example"]
warn_unused_configs = true
warn_redundant_casts = true
warn_unused_ignores = true
Expand Down
3 changes: 2 additions & 1 deletion pywayland/_ffi/ffi.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Callable, Self, TypeVar, overload
from collections.abc import Callable
from typing import Any, Self, TypeVar, overload

class CData:
def __getitem__(self, idx: int) -> Self: ...
Expand Down
4 changes: 1 addition & 3 deletions pywayland/client/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@

if TYPE_CHECKING:
from types import TracebackType
from typing import Any

from typing_extensions import Literal
from typing import Any, Literal

from pywayland.client.eventqueue import EventQueue
from pywayland.protocol_core import Proxy
Expand Down
5 changes: 3 additions & 2 deletions pywayland/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
from __future__ import annotations

import traceback
from typing import TYPE_CHECKING, Callable, Optional
from collections.abc import Callable
from typing import TYPE_CHECKING

from pywayland import ffi, lib

if TYPE_CHECKING:
from pywayland.protocol_core.message import Message

CallbackT = Callable[..., Optional[int]]
CallbackT = Callable[..., int | None]


# int (*wl_dispatcher_func_t)(const void *, void *, uint32_t, const struct wl_message *, union wl_argument *)
Expand Down
3 changes: 2 additions & 1 deletion pywayland/protocol_core/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
from .message import Message

if TYPE_CHECKING:
from typing import Any, Callable
from collections.abc import Callable
from typing import Any

from .argument import Argument
from .globals import Global
Expand Down
4 changes: 2 additions & 2 deletions pywayland/protocol_core/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
from .argument import Argument, ArgumentType

if TYPE_CHECKING:
from collections.abc import Iterable
from typing import Any, Callable
from collections.abc import Callable, Iterable
from typing import Any

from pywayland.protocol_core import Proxy

Expand Down
3 changes: 1 addition & 2 deletions pywayland/server/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

if TYPE_CHECKING:
from types import TracebackType

from typing_extensions import Literal
from typing import Literal

from pywayland.protocol.wayland import WlShm

Expand Down
3 changes: 2 additions & 1 deletion pywayland/server/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
from pywayland.utils import wl_container_of

if TYPE_CHECKING:
from typing import Any, Callable
from collections.abc import Callable
from typing import Any

logger = getLogger(__package__)

Expand Down
4 changes: 2 additions & 2 deletions pywayland/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
from . import ffi, lib

if TYPE_CHECKING:
from collections.abc import Iterator
from collections.abc import Callable, Iterator
from types import TracebackType
from typing import Any, Callable
from typing import Any


def ensure_valid(func: Callable[..., Any]) -> Callable[..., Any]:
Expand Down
5 changes: 0 additions & 5 deletions requirements-dev.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements-types.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion test/test_client_destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def destroy_notify_b(*args):

def test_client_destroy_listener():
global a, b
s1, s2 = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM, 0)
s1, s2 = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM, 0) # noqa: RUF059
a = 0
b = 0

Expand Down
2 changes: 1 addition & 1 deletion test/test_registry_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_get_registry():
s = ServerDisplay()

# Add a compositor so we can query for it (and keep it alive)
compositor = WlCompositor.global_class(s)
compositor = WlCompositor.global_class(s) # noqa: F841

# Add a timer to kill the server after 0.5 sec (should be more than enough
# time, don't know a more deterministic way...)
Expand Down