From 5084241ab69cdc03ceb69ddd4ffe461109c31040 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Sat, 13 Jan 2024 18:22:08 +0200 Subject: [PATCH] Drop Python 3.8 support --- .github/workflows/tests.yml | 2 +- LICENSE.rst | 2 +- docs/conf.py | 5 +++-- enumagic/__init__.py | 4 ++-- enumagic/_iter.py | 8 ++++---- enumagic/_mapping.py | 16 +++++++--------- enumagic/_str.py | 4 +--- setup.cfg | 8 ++++---- 8 files changed, 23 insertions(+), 26 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d013bfd..bcd521d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ['3.8', '3.9', '3.10', '3.11'] + python: ['3.9', '3.10', '3.11', '3.12'] steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/LICENSE.rst b/LICENSE.rst index 4b77c64..f8394c4 100644 --- a/LICENSE.rst +++ b/LICENSE.rst @@ -1,4 +1,4 @@ -Copyright (c) 2020-2023 ObserverOfTime +Copyright (c) 2020-2024 ObserverOfTime This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held diff --git a/docs/conf.py b/docs/conf.py index 526646c..4b8be15 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,7 +20,7 @@ # -- Project information ----------------------------------------------------- project = 'enumagic' -copyright = '2020-2023, ObserverOfTime' +copyright = '2020-2024, ObserverOfTime' author = 'ObserverOfTime' # The full version, including alpha/beta/rc tags @@ -75,6 +75,7 @@ '__init__', '__module__', '__weakref__', + '__annotations__', '__init_subclass__', )), } @@ -83,7 +84,7 @@ # Intersphinx settings intersphinx_mapping = { - 'python': ('https://docs.python.org/3.8/', None), + 'python': ('https://docs.python.org/3.9/', None), } # -- Options for HTML output ------------------------------------------------- diff --git a/enumagic/__init__.py b/enumagic/__init__.py index d79b0b5..d22c80c 100644 --- a/enumagic/__init__.py +++ b/enumagic/__init__.py @@ -1,6 +1,6 @@ """Python enums that work like magic.""" -# Copyright (c) 2020-2023 ObserverOfTime +# Copyright (c) 2020-2024 ObserverOfTime # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages @@ -22,4 +22,4 @@ from ._mapping import MappingEnum, MappingMeta from ._str import StrEnum -__version__: str = '0.2.1' +__version__: str = '0.2.2' diff --git a/enumagic/_iter.py b/enumagic/_iter.py index 145b91a..71a0a80 100644 --- a/enumagic/_iter.py +++ b/enumagic/_iter.py @@ -1,6 +1,6 @@ """Iterable enum module.""" -# Copyright (c) 2020-2023 ObserverOfTime +# Copyright (c) 2020-2024 ObserverOfTime # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages @@ -19,15 +19,15 @@ # 3. This notice may not be removed or altered from any source distribution. from enum import Enum, EnumMeta -from typing import Any, Iterator, Tuple, Type, TypeVar +from typing import Any, Iterator, TypeVar _VT = TypeVar('_VT') -_ET = TypeVar('_ET', bound=Type[Enum]) +_ET = TypeVar('_ET', bound=type[Enum]) class IterMeta(EnumMeta): """Iterable enum metaclass.""" - def __iter__(cls) -> Iterator[Tuple[str, _VT]]: + def __iter__(cls) -> Iterator[tuple[str, _VT]]: """ Iterate over the entries of the enum. diff --git a/enumagic/_mapping.py b/enumagic/_mapping.py index ffd3933..5e670f4 100644 --- a/enumagic/_mapping.py +++ b/enumagic/_mapping.py @@ -1,6 +1,6 @@ """Mapping enum module.""" -# Copyright (c) 2020-2023 ObserverOfTime +# Copyright (c) 2020-2024 ObserverOfTime # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages @@ -19,14 +19,14 @@ # 3. This notice may not be removed or altered from any source distribution. from enum import Enum, EnumMeta -from typing import Any, Dict, Iterator, Tuple, Type, TypeVar +from typing import Any, Iterator, TypeVar -_ET = TypeVar('_ET', bound=Type[Enum]) +_ET = TypeVar('_ET', bound=type[Enum]) class MappingMeta(EnumMeta): """Mapping enum metaclass.""" - def __iter__(cls) -> Iterator[Tuple[int, str]]: + def __iter__(cls) -> Iterator[tuple[int, str]]: """ Iterate over the values of the enum. @@ -70,7 +70,7 @@ def __call__(cls, value: Any) -> _ET: return super().__call__(value) @property - def items(cls) -> Dict[str, int]: + def items(cls) -> dict[str, int]: """ Get a mapping of ``label``/``index`` pairs. @@ -84,7 +84,7 @@ def items(cls) -> Dict[str, int]: return {lbl: idx for idx, lbl in cls} @property - def indices(cls) -> Tuple[int, ...]: + def indices(cls) -> tuple[int, ...]: """ Get the indices of the enum. @@ -98,7 +98,7 @@ def indices(cls) -> Tuple[int, ...]: return tuple(val[0] for val in cls) @property - def labels(cls) -> Tuple[str, ...]: + def labels(cls) -> tuple[str, ...]: """ Get the labels of the enum. @@ -131,8 +131,6 @@ class MappingEnum(Enum, metaclass=MappingMeta): :annotation: alias of :class:`enumagic.MappingMeta` - - .. automethod:: __str__() -> str """ def __init__(self, index: int, label: str): if index in self.__class__.indices: diff --git a/enumagic/_str.py b/enumagic/_str.py index 75dcf46..63e10be 100644 --- a/enumagic/_str.py +++ b/enumagic/_str.py @@ -1,6 +1,6 @@ """String enum module.""" -# Copyright (c) 2020-2023 ObserverOfTime +# Copyright (c) 2020-2024 ObserverOfTime # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages @@ -35,8 +35,6 @@ class StrEnum(str, Enum): :annotation: alias of :class:`enum.EnumMeta` - - .. automethod:: __str__() -> str """ def __str__(self) -> str: """ diff --git a/setup.cfg b/setup.cfg index 71fe85e..4f48944 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,10 +17,10 @@ classifiers = Operating System :: OS Independent Programming Language :: Python Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Programming Language :: Python :: 3 :: Only Topic :: Software Development :: Libraries :: Python Modules Typing :: Typed @@ -30,15 +30,15 @@ project_urls = [options] packages = find: -python_requires = >=3.8 +python_requires = >=3.9 [options.package_data] * = py.typed [options.extras_require] dev = - sphinx~=5.1.1 - sphinx-rtd-theme~=1.0 + sphinx~=7.2 + sphinx-rtd-theme~=2.0 [bdist_wheel] universal = 1