From c4f32fb6c2d592db59bf146e8a115b6f29f2d6df Mon Sep 17 00:00:00 2001 From: Sassan Haradji Date: Fri, 24 Nov 2023 20:57:05 +0400 Subject: [PATCH] chore: drop support for python 3.9 and 3.10 --- .github/workflows/wheels.yml | 2 +- CHANGELOG.md | 4 ++ README.md | 5 +- headless_kivy_pi/__init__.py | 5 +- headless_kivy_pi/logger.py | 13 +++-- poetry.lock | 101 ++++++++++++++++++++++++----------- pyproject.toml | 17 +++--- 7 files changed, 96 insertions(+), 51 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 24cdf50..da26bee 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -19,7 +19,7 @@ jobs: - name: Set up python uses: actions/setup-python@v4 with: - python-version: '3.9' + python-version: '3.11' - name: Install Poetry uses: snok/install-poetry@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 823681b..d4cf6de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Version 0.5.0 + +- chore: drop support for python 3.9 and 3.10 + ## Version 0.4.2 - chore: migrate from poetry groups to poetry extras diff --git a/README.md b/README.md index 636b5a3..9424619 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,8 @@ This project demonstrates the use of the Kivy framework to create a headless ren ## ⚡️ Requirements -- Raspberry Pi 4 +- Raspberry Pi 4 or 5 - SPI Display (tested with ST7789 module) -- SDL2 with `kmsdrm` backend - -You need to compile and install SDL2 from source with `kmsdrm` backend. Please follow the instructions provided [here](https://kivy.org/doc/stable/installation/installation-rpi.html#raspberry-pi-4-headless-installation-on-raspbian-buster) ## 📦 Installation diff --git a/headless_kivy_pi/__init__.py b/headless_kivy_pi/__init__.py index 82ddc6e..844db80 100644 --- a/headless_kivy_pi/__init__.py +++ b/headless_kivy_pi/__init__.py @@ -34,10 +34,9 @@ Fbo, Rectangle, ) +from logger import add_file_handler, add_stdout_handler, logger from typing_extensions import Any, NotRequired, TypedDict -from .logger import add_file_handler, add_stdout_handler, logger - if TYPE_CHECKING: from kivy.graphics.texture import Texture from numpy._typing import NDArray @@ -404,7 +403,7 @@ def transfer_to_display( if IS_RPI: HeadlessWidget._display._block( 0, - 0, # noqa: SLF001 + 0, HeadlessWidget.width - 1, HeadlessWidget.height - 1, data_bytes, diff --git a/headless_kivy_pi/logger.py b/headless_kivy_pi/logger.py index dda3fd8..d13650a 100644 --- a/headless_kivy_pi/logger.py +++ b/headless_kivy_pi/logger.py @@ -1,3 +1,4 @@ +# ruff: noqa: D100, D101, D102, D103, D104, D107 import logging import sys @@ -6,26 +7,28 @@ logger.propagate = False -def add_stdout_handler(): +def add_stdout_handler() -> None: stdout_handler = logging.StreamHandler(sys.stdout) stdout_handler.setLevel(logging.DEBUG) stdout_handler.setFormatter( logging.Formatter( - '%(created)f [%(levelname)s] %(message)s', '%Y-%m-%d %H:%M:%S', + '%(created)f [%(levelname)s] %(message)s', + '%Y-%m-%d %H:%M:%S', ), ) logger.addHandler(stdout_handler) -def add_file_handler(): +def add_file_handler() -> None: file_handler = logging.FileHandler('headless-kivy-pi.log') file_handler.setLevel(logging.DEBUG) file_handler.setFormatter( logging.Formatter( - '%(created)f [%(levelname)s] %(message)s', '%Y-%m-%d %H:%M:%S', + '%(created)f [%(levelname)s] %(message)s', + '%Y-%m-%d %H:%M:%S', ), ) logger.addHandler(file_handler) -__all__ = ('logger', 'add_stdout_handler') +__all__ = ('logger', 'add_stdout_handler', 'add_file_handler') diff --git a/poetry.lock b/poetry.lock index 639b553..0310ce3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,13 +1,13 @@ -# This file is automatically @generated by Poetry 1.7.0 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. [[package]] name = "adafruit-blinka" -version = "8.24.0" +version = "8.25.0" description = "CircuitPython APIs for non-CircuitPython versions of Python such as CPython on Linux and MicroPython." optional = false python-versions = ">=3.7.0" files = [ - {file = "Adafruit_Blinka-8.24.0-py3-none-any.whl", hash = "sha256:9aff60442085102d4af963a37292761ca19f187de858b2836d9b0a545b2159a4"}, + {file = "Adafruit_Blinka-8.25.0-py3-none-any.whl", hash = "sha256:9af0f97a7d09cc097c528d278add5f0ec814f1f2f75e0e1a3758468d715790c6"}, ] [package.dependencies] @@ -144,12 +144,12 @@ reference = "piwheels" [[package]] name = "adafruit-platformdetect" -version = "3.53.0" +version = "3.54.0" description = "Platform detection for use by libraries like Adafruit-Blinka." optional = false python-versions = "*" files = [ - {file = "Adafruit_PlatformDetect-3.53.0-py3-none-any.whl", hash = "sha256:7d039d5d4546b45859209daea6322c188f291633c43b0c01a8be7ee364263abf"}, + {file = "Adafruit_PlatformDetect-3.54.0-py3-none-any.whl", hash = "sha256:5355fe07b5636ea0e9f04ab414688556797d3026d4c3656dbfc6ccbb8ee0780a"}, ] [package.source] @@ -174,19 +174,15 @@ reference = "piwheels" [[package]] name = "certifi" -version = "2023.7.22" +version = "2023.11.17" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:4e4d84b05d4572339352afe85f0490367f5b8572b7f8d3f2373dffd642210f2d"}, + {file = "certifi-2023.11.17-py3-none-any.whl", hash = "sha256:e036ab49d5b79556f99cfc2d9320b34cfbe5be05c5871b51de9329f0603b0474"}, + {file = "certifi-2023.11.17.tar.gz", hash = "sha256:9b469f3a900bf28dc19b8cfbf8019bf47f7fdd1a65a1d4ffb98fc14166beb4d1"}, ] -[package.source] -type = "legacy" -url = "https://www.piwheels.org/simple" -reference = "piwheels" - [[package]] name = "charset-normalizer" version = "3.3.2" @@ -363,13 +359,15 @@ requests = "*" [[package]] name = "numpy" -version = "1.25.2" +version = "1.26.2" description = "Fundamental package for array computing in Python" optional = false python-versions = ">=3.9" files = [ - {file = "numpy-1.25.2-cp39-cp39-linux_armv6l.whl", hash = "sha256:4b0bf79e4c9ea416d3e7ddfd463263b7489c80e8fac9c94f3c9f11ee443210b7"}, - {file = "numpy-1.25.2-cp39-cp39-linux_armv7l.whl", hash = "sha256:4b0bf79e4c9ea416d3e7ddfd463263b7489c80e8fac9c94f3c9f11ee443210b7"}, + {file = "numpy-1.26.2-cp311-cp311-linux_armv6l.whl", hash = "sha256:784889ff2205b671e8283e37caa621a3aa1c8d0d4c03b44be4a857efde2edd72"}, + {file = "numpy-1.26.2-cp311-cp311-linux_armv7l.whl", hash = "sha256:784889ff2205b671e8283e37caa621a3aa1c8d0d4c03b44be4a857efde2edd72"}, + {file = "numpy-1.26.2-cp39-cp39-linux_armv6l.whl", hash = "sha256:795033f0e3b6a1ef31729906d68c88aab30f18cc625850729e95d0c8607a6ef6"}, + {file = "numpy-1.26.2-cp39-cp39-linux_armv7l.whl", hash = "sha256:795033f0e3b6a1ef31729906d68c88aab30f18cc625850729e95d0c8607a6ef6"}, ] [package.source] @@ -377,6 +375,39 @@ type = "legacy" url = "https://www.piwheels.org/simple" reference = "piwheels" +[[package]] +name = "pastel" +version = "0.2.1" +description = "Bring colors to your terminal." +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +files = [ + {file = "pastel-0.2.1-py2.py3-none-any.whl", hash = "sha256:4349225fcdf6c2bb34d483e523475de5bb04a5c10ef711263452cb37d7dd4364"}, +] + +[package.source] +type = "legacy" +url = "https://www.piwheels.org/simple" +reference = "piwheels" + +[[package]] +name = "poethepoet" +version = "0.24.4" +description = "A task runner that works well with poetry." +optional = false +python-versions = ">=3.8" +files = [ + {file = "poethepoet-0.24.4-py3-none-any.whl", hash = "sha256:fb4ea35d7f40fe2081ea917d2e4102e2310fda2cde78974050ca83896e229075"}, + {file = "poethepoet-0.24.4.tar.gz", hash = "sha256:ff4220843a87c888cbcb5312c8905214701d0af60ac7271795baa8369b428fef"}, +] + +[package.dependencies] +pastel = ">=0.2.1,<0.3.0" +tomli = ">=1.2.2" + +[package.extras] +poetry-plugin = ["poetry (>=1.0,<2.0)"] + [[package]] name = "pyftdi" version = "0.55.0" @@ -398,21 +429,18 @@ reference = "piwheels" [[package]] name = "pygments" -version = "2.16.1" +version = "2.17.2" description = "Pygments is a syntax highlighting package written in Python." optional = false python-versions = ">=3.7" files = [ - {file = "Pygments-2.16.1-py3-none-any.whl", hash = "sha256:ca6616a95d7517ca5c636e9b865bcb47035881de11845ee5c8ba9f6cfbd39783"}, + {file = "pygments-2.17.2-py3-none-any.whl", hash = "sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c"}, + {file = "pygments-2.17.2.tar.gz", hash = "sha256:da46cec9fd2de5be3a8a784f434e4c4ab670b4ff54d605c4c2717e9d49c4c367"}, ] [package.extras] plugins = ["importlib-metadata"] - -[package.source] -type = "legacy" -url = "https://www.piwheels.org/simple" -reference = "piwheels" +windows-terminal = ["colorama (>=0.4.6)"] [[package]] name = "pyobjc-core" @@ -619,6 +647,21 @@ type = "legacy" url = "https://www.piwheels.org/simple" reference = "piwheels" +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, +] + +[package.source] +type = "legacy" +url = "https://www.piwheels.org/simple" +reference = "piwheels" + [[package]] name = "typing-extensions" version = "4.8.0" @@ -636,17 +679,16 @@ reference = "piwheels" [[package]] name = "urllib3" -version = "2.0.7" +version = "2.1.0" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "urllib3-2.0.7-py3-none-any.whl", hash = "sha256:569a2c93ac2791db5f1e10ca665db55661f9727a47e9f95385ea840d06baac85"}, + {file = "urllib3-2.1.0-py3-none-any.whl", hash = "sha256:c94da74949bf2cd9d7c6539ba66893c8b51e1207702dc7463eb537499b39a455"}, ] [package.extras] brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] -secure = ["certifi", "cryptography (>=1.9)", "idna (>=2.0.0)", "pyopenssl (>=17.1.0)", "urllib3-secure-extra"] socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["zstandard (>=0.18.0)"] @@ -655,10 +697,7 @@ type = "legacy" url = "https://www.piwheels.org/simple" reference = "piwheels" -[extras] -dev = [] - [metadata] lock-version = "2.0" -python-versions = "^3.9" -content-hash = "1512fee577f1cb3593e5a6e1c831bf0208c168d0964f6a9ed37c4e0a995eb1ef" +python-versions = "^3.11" +content-hash = "6c6aeb8ef691a5270f54541cb3938e9b929970e22ef79b6e8dd95f195d77df13" diff --git a/pyproject.toml b/pyproject.toml index c923a22..f8e763c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "headless-kivy-pi" -version = "0.4.2" +version = "0.5.0" description = "Headless renderer for Kivy framework on Raspberry Pi" authors = ["Sassan Haradji "] license = "Apache-2.0" @@ -19,24 +19,27 @@ priority = "primary" [tool.poetry.dependencies] -python = "^3.9" +python = "^3.11" numpy = "^1.24.2" kivy = "^2.2.1" typing-extensions = "^4.8.0" -adafruit-circuitpython-rgb-display = "^3.11.0" -adafruit-circuitpython-aw9523 = "^1.1.7" +adafruit-circuitpython-rgb-display = { version = "^3.11.0", markers = "platform_machine == 'aarch64'", source = 'piwheels' } +adafruit-circuitpython-aw9523 = { version = "^1.1.7", markers = "platform_machine == 'aarch64'", source = 'piwheels' } -screeninfo = { version = "^0.8.1", markers = "platform_machine != 'aarch64'", source = 'PyPI', optional = true } -[tool.poetry.extras] -dev = ['screeninfo'] +[tool.poetry.group.dev.dependencies] +poethepoet = { version = "^0.24.2", markers = "platform_machine != 'aarch64'", source = 'PyPI' } +screeninfo = { version = "^0.8.1", markers = "platform_machine != 'aarch64'", source = 'PyPI' } [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" +[tool.poe.tasks] +lint = "pyright -p pyproject.toml ." + [tool.ruff] select = ['ALL'] ignore = []