Skip to content

Commit

Permalink
Drop Python 3.8 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverOfTime committed Jan 13, 2024
1 parent a3dc498 commit 5084241
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.rst
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -75,6 +75,7 @@
'__init__',
'__module__',
'__weakref__',
'__annotations__',
'__init_subclass__',
)),
}
Expand All @@ -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 -------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions enumagic/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -22,4 +22,4 @@
from ._mapping import MappingEnum, MappingMeta
from ._str import StrEnum

__version__: str = '0.2.1'
__version__: str = '0.2.2'
8 changes: 4 additions & 4 deletions enumagic/_iter.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
16 changes: 7 additions & 9 deletions enumagic/_mapping.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions enumagic/_str.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -35,8 +35,6 @@ class StrEnum(str, Enum):
:annotation:
alias of :class:`enum.EnumMeta`
.. automethod:: __str__() -> str
"""
def __str__(self) -> str:
"""
Expand Down
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 5084241

Please sign in to comment.