Fix GH Actions, remove Python 3.7, re-enable MacOS, remove old dev dependency (#3766)

* Fixing pytest running on incorrect Python version in GitHub actions.
Also removes 3.12 from the testing matrix, and enables MacOS again.

* Dropping Python 3.7

* Update required Python version to ^3.8

* Remove 3.7 asyncio compatibility layer

* Version pinning in GitHub Action
This commit is contained in:
Darren Burns
2023-11-29 14:05:25 +00:00
committed by GitHub
parent ed3924e89c
commit 5603a4da2b
10 changed files with 806 additions and 952 deletions

View File

@@ -16,40 +16,25 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3.5.2
- name: Install and configure Poetry # This could be cached, too...
uses: snok/install-poetry@v1.3.3
with:
version: 1.4.2
virtualenvs-in-project: true
- uses: actions/checkout@v4.1.1
- name: Install Poetry
run: pipx install poetry==1.7.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.7.1
with:
python-version: ${{ matrix.python-version }}
architecture: x64
allow-prereleases: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
cache: 'poetry'
- name: Install dependencies
run: poetry install --extras syntax
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
# - name: Typecheck with mypy
# run: |
# make typecheck
run: poetry install --no-interaction --extras syntax
- name: Test with pytest
run: |
source $VENV
pytest tests -v --cov=./src/textual --cov-report=xml:./coverage.xml --cov-report term-missing
poetry run pytest tests -v --cov=./src/textual --cov-report=xml:./coverage.xml --cov-report term-missing
- name: Upload snapshot report
if: always()
uses: actions/upload-artifact@v3

1672
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,6 @@ classifiers = [
"Operating System :: Microsoft :: Windows :: Windows 11",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
@@ -41,7 +40,7 @@ include = [
"Bug Tracker" = "https://github.com/Textualize/textual/issues"
[tool.poetry.dependencies]
python = "^3.7"
python = "^3.8"
rich = ">=13.3.3"
markdown-it-py = { extras = ["plugins", "linkify"], version = ">=2.1.0" }
#rich = {path="../rich", develop=true}
@@ -64,7 +63,6 @@ mkdocstrings-python = "0.10.1"
mkdocs-material = "^9.0.11"
mkdocs-exclude = "^1.0.2"
pre-commit = "^2.13.0"
pytest-aiohttp = "^1.0.4"
time-machine = "^2.6.0"
mkdocs-rss-plugin = "^1.5.0"
httpx = "^0.23.1"

View File

@@ -1,22 +0,0 @@
"""
Compatibility layer for asyncio.
"""
from __future__ import annotations
import sys
__all__ = ["create_task"]
if sys.version_info >= (3, 8):
from asyncio import create_task
else:
import asyncio
from asyncio import create_task as _create_task
from typing import Awaitable
# The name parameter was added in Python 3.8
def create_task(coroutine: Awaitable, *, name: str | None = None) -> asyncio.Task:
"""Schedule the execution of a coroutine object in a spawn task."""
return _create_task(coroutine)

View File

@@ -16,7 +16,7 @@ import platform
import sys
import threading
import warnings
from asyncio import Task
from asyncio import Task, create_task
from concurrent.futures import Future
from contextlib import (
asynccontextmanager,
@@ -59,7 +59,6 @@ from rich.segment import Segment, Segments
from . import Logger, LogGroup, LogVerbosity, actions, constants, events, log, messages
from ._animator import DEFAULT_EASING, Animatable, Animator, EasingFunction
from ._ansi_sequences import SYNC_END, SYNC_START
from ._asyncio import create_task
from ._callback import invoke
from ._compose import compose
from ._compositor import CompositorUpdate

View File

@@ -7,7 +7,15 @@ See the guide on the [Command Palette](../guide/command_palette.md) for full det
from __future__ import annotations
from abc import ABC, abstractmethod
from asyncio import CancelledError, Queue, Task, TimeoutError, wait, wait_for
from asyncio import (
CancelledError,
Queue,
Task,
TimeoutError,
create_task,
wait,
wait_for,
)
from dataclasses import dataclass
from functools import total_ordering
from inspect import isclass
@@ -23,7 +31,6 @@ from rich.text import Text
from typing_extensions import Final, TypeAlias
from . import on, work
from ._asyncio import create_task
from .binding import Binding, BindingType
from .containers import Horizontal, Vertical
from .events import Click, Mount

View File

@@ -12,14 +12,13 @@ from __future__ import annotations
import asyncio
import inspect
import threading
from asyncio import CancelledError, Queue, QueueEmpty, Task
from asyncio import CancelledError, Queue, QueueEmpty, Task, create_task
from contextlib import contextmanager
from functools import partial
from typing import TYPE_CHECKING, Any, Awaitable, Callable, Generator, Iterable, cast
from weakref import WeakSet
from . import Logger, events, log, messages
from ._asyncio import create_task
from ._callback import invoke
from ._context import NoActiveAppError, active_app, active_message_pump
from ._context import message_hook as message_hook_context_var

View File

@@ -7,13 +7,12 @@ Timer objects are created by [set_interval][textual.message_pump.MessagePump.set
from __future__ import annotations
import weakref
from asyncio import CancelledError, Event, Task
from asyncio import CancelledError, Event, Task, create_task
from typing import Any, Awaitable, Callable, Union
from rich.repr import Result, rich_repr
from . import _time, events
from ._asyncio import create_task
from ._callback import invoke
from ._context import active_app
from ._time import sleep

View File

@@ -4,7 +4,7 @@ The base class for widgets.
from __future__ import annotations
from asyncio import wait
from asyncio import create_task, wait
from collections import Counter
from fractions import Fraction
from itertools import islice
@@ -42,7 +42,6 @@ from typing_extensions import Self
from . import constants, errors, events, messages
from ._animator import DEFAULT_EASING, Animatable, BoundAnimator, EasingFunction
from ._arrange import DockArrangeResult, arrange
from ._asyncio import create_task
from ._cache import FIFOCache
from ._compose import compose
from ._context import NoActiveAppError, active_app

View File

@@ -789,9 +789,6 @@ def test_nested_fr(snap_compare) -> None:
assert snap_compare(SNAPSHOT_APPS_DIR / "nested_fr.py")
@pytest.mark.skipif(
sys.version_info < (3, 8), reason="tree-sitter requires python3.8 or higher"
)
@pytest.mark.parametrize("language", BUILTIN_LANGUAGES)
def test_text_area_language_rendering(language, snap_compare):
# This test will fail if we're missing a snapshot test for a valid
@@ -843,9 +840,6 @@ I am the final line."""
)
@pytest.mark.skipif(
sys.version_info < (3, 8), reason="tree-sitter requires python3.8 or higher"
)
@pytest.mark.parametrize(
"theme_name", [theme.name for theme in TextAreaTheme.builtin_themes()]
)