Skip to content

Commit

Permalink
Add Python 3.12, Drop Python 3.10 (#919)
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Oct 20, 2023
1 parent a63363c commit 30a03b0
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 82 deletions.
2 changes: 1 addition & 1 deletion .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
description: "A breaking change for existing users."
- name: "bugfix"
color: ee0701
description: "Inconsistencies or issues which will cause a problem for users or implementors."
description: "Inconsistencies or issues which will cause a problem for users or implementers."
- name: "documentation"
color: 0052cc
description: "Solely about the documentation of the project."
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch:

env:
DEFAULT_PYTHON: "3.10"
DEFAULT_PYTHON: "3.11"

jobs:
codespell:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- published

env:
DEFAULT_PYTHON: "3.10"
DEFAULT_PYTHON: "3.11"

jobs:
release:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ on:
workflow_dispatch:

env:
DEFAULT_PYTHON: "3.10"
DEFAULT_PYTHON: "3.11"

jobs:
pytest:
name: Python ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.10", "3.11"]
python: ["3.11"]
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4.1.1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/typing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch:

env:
DEFAULT_PYTHON: "3.10"
DEFAULT_PYTHON: "3.11"

jobs:
mypy:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ This Python project is fully managed using the [Poetry][poetry] dependency manag

You need at least:

- Python 3.10+
- Python 3.11+
- [Poetry][poetry-install]
- NodeJS 18+ (including NPM)

Expand Down
76 changes: 8 additions & 68 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ classifiers = [
"Framework :: AsyncIO",
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries :: Python Modules",
]
Expand All @@ -27,7 +27,7 @@ version = "0.0.0"
[tool.poetry.dependencies]
aiohttp = ">=3.0.0"
pydantic = "^1.8.0"
python = "^3.10"
python = "^3.11"
yarl = ">=1.6.0"

[tool.poetry.urls]
Expand Down Expand Up @@ -64,7 +64,7 @@ show_missing = true
# free to run mypy on Windows, Linux, or macOS and get consistent
# results.
platform = "linux"
python_version = "3.10"
python_version = "3.11"

# show error messages from unrelated files
follow_imports = "normal"
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ sonar.sourceEncoding=UTF-8
sonar.sources=src
sonar.tests=tests

sonar.python.version=3.10, 3.11
sonar.python.version=3.11, 3.12
sonar.python.coverage.reportPaths=coverage.xml
17 changes: 14 additions & 3 deletions src/elgato/elgato.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@
import socket
from dataclasses import dataclass
from importlib import metadata
from typing import TYPE_CHECKING, Any, Concatenate, ParamSpec, TypedDict, TypeVar, cast
from typing import (
TYPE_CHECKING,
Any,
Concatenate,
ParamSpec,
Self,
TypedDict,
TypeVar,
cast,
)

import async_timeout
from aiohttp.client import ClientError, ClientSession
Expand Down Expand Up @@ -188,6 +197,7 @@ async def battery_settings(self) -> BatterySettings:
return settings.battery

@requires_battery
# pylint: disable-next=too-many-arguments
async def energy_saving( # noqa: PLR0913
self,
*,
Expand Down Expand Up @@ -283,6 +293,7 @@ async def display_name(self, name: str) -> None:
data={"displayName": name},
)

# pylint: disable-next=too-many-arguments
async def light( # noqa: PLR0913
self,
*,
Expand Down Expand Up @@ -400,7 +411,7 @@ async def close(self) -> None:
if self.session and self._close_session:
await self.session.close()

async def __aenter__(self) -> Elgato:
async def __aenter__(self) -> Self:
"""Async enter.
Returns
Expand All @@ -409,7 +420,7 @@ async def __aenter__(self) -> Elgato:
"""
return self

async def __aexit__(self, *_exc_info: Any) -> None:
async def __aexit__(self, *_exc_info: object) -> None:
"""Async exit.
Args:
Expand Down
2 changes: 2 additions & 0 deletions src/elgato/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Asynchronous Python client for Elgato Lights."""
from __future__ import annotations

from enum import IntEnum

from pydantic import BaseModel, Field
Expand Down
1 change: 1 addition & 0 deletions tests/test_state.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for retrieving information from the Elgato Light device."""
from __future__ import annotations

import pytest
from aiohttp import ClientResponse, ClientSession
Expand Down

0 comments on commit 30a03b0

Please sign in to comment.