From 23f85d2afeb36281db8a01c68e39ab0df6dfbd62 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Jul 2026 09:02:52 +0000 Subject: [PATCH 1/5] Bump ruff from 0.15.22 to 0.16.0 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.22 to 0.16.0. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.15.22...0.16.0) --- updated-dependencies: - dependency-name: ruff dependency-version: 0.16.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements/develop.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/develop.txt b/requirements/develop.txt index 1a77180..51e2a56 100644 --- a/requirements/develop.txt +++ b/requirements/develop.txt @@ -8,6 +8,6 @@ docformatter==1.7.8 wemake-python-styleguide==1.6.2 -ruff==0.15.22 +ruff==0.16.0 ty==0.0.61 From 2f92d9d2733bcc796e70312e4f5b2377da82a162 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Jul 2026 18:45:35 +0000 Subject: [PATCH 2/5] Bump ruff from 0.15.22 to 0.16.0 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.22 to 0.16.0. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.15.22...0.16.0) --- updated-dependencies: - dependency-name: ruff dependency-version: 0.16.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements/develop.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/develop.txt b/requirements/develop.txt index cf26bdf..8003206 100644 --- a/requirements/develop.txt +++ b/requirements/develop.txt @@ -8,6 +8,6 @@ docformatter==1.7.8 wemake-python-styleguide==1.7.0 -ruff==0.15.22 +ruff==0.16.0 ty==0.0.61 From 698ef45a5f4b19639d57cbf79db799928c13af4d Mon Sep 17 00:00:00 2001 From: Chase Finch Date: Tue, 28 Jul 2026 14:47:51 -0400 Subject: [PATCH 3/5] Lint --- README.md | 26 ++++++++++++++++---------- data_enum/__init__.py | 1 + data_enum/_compatibility.py | 1 + data_enum/data_enum.py | 1 + setup.py | 1 + tests/__init__.py | 1 + tests/test_data_enum.py | 1 + 7 files changed, 22 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index c05413c..e68986d 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ from typing import Annotated from data_enum import DataEnum, UNIQUE, UniqueTogether + class Currency(DataEnum): __members__ = ("USD", "EUR", "GBP") @@ -34,6 +35,7 @@ class Currency(DataEnum): name: str code: Annotated[str, UNIQUE] + Currency.USD = Currency(symbol="$", name="US Dollar", code="USD") Currency.EUR = Currency(symbol="€", name="Euro", code="EUR") Currency.GBP = Currency(symbol="£", name="Pound Sterling", code="GBP") @@ -42,24 +44,24 @@ Currency.GBP = Currency(symbol="£", name="Pound Sterling", code="GBP") ### Access data on members ```py -Currency.USD.name # 'US Dollar' -Currency.EUR.symbol # '€' -str(Currency.USD) # 'USD' -repr(Currency.USD) # 'Currency.USD' +Currency.USD.name # 'US Dollar' +Currency.EUR.symbol # '€' +str(Currency.USD) # 'USD' +repr(Currency.USD) # 'Currency.USD' ``` ### Look up members by name ```py -Currency.get("USD") # Currency.USD -Currency.get("MISSING", default=None) # None +Currency.get("USD") # Currency.USD +Currency.get("MISSING", default=None) # None Currency.get("MISSING", default=Currency.USD) # Currency.USD ``` ### Look up by unique attribute ```py -Currency.get(code="EUR") # Currency.EUR +Currency.get(code="EUR") # Currency.EUR Currency.get(code="MISSING", default=Currency.USD) # Currency.USD ``` @@ -77,7 +79,7 @@ Currency.USD == Currency.EUR # False Currency.USD == Currency.USD # True {Currency.USD, Currency.EUR} # works in sets -{Currency.USD: "dollar"} # works as dict keys +{Currency.USD: "dollar"} # works as dict keys ``` ### Default values @@ -93,7 +95,8 @@ class Currency(DataEnum): code: Annotated[str, UNIQUE] active: bool = True -Currency.USD = Currency(symbol="$", name="US Dollar", code="USD") # active=True + +Currency.USD = Currency(symbol="$", name="US Dollar", code="USD") # active=True Currency.EUR = Currency(symbol="€", name="Euro", code="EUR", active=False) # active=False ``` @@ -115,6 +118,7 @@ class State(DataEnum): code: Annotated[str, UniqueTogether("location")] name: str + State.CA_US = State(country="US", code="CA", name="California") State.TX_US = State(country="US", code="TX", name="Texas") State.ON_CA = State(country="CA", code="ON", name="Ontario") @@ -146,7 +150,7 @@ DataEnum uses PEP 681 (`@dataclass_transform`) so type checkers (mypy, pyright, ```py Currency(symbol="$", name="US Dollar", code="USD") # type checker knows these kwargs -Currency(symbol="$") # type checker flags missing args +Currency(symbol="$") # type checker flags missing args ``` ### No-data enums @@ -155,6 +159,7 @@ Currency(symbol="$") # type checker flags missi class Direction(DataEnum): __members__ = ("NORTH", "SOUTH", "EAST", "WEST") + Direction.NORTH = Direction() Direction.SOUTH = Direction() Direction.EAST = Direction() @@ -192,6 +197,7 @@ class Color(DataEnum): __members__ = ("RED", "BLUE") name: str + Color.RED = Color(name="Red") Color.get("RED") # raises ConfigurationError (BLUE not yet assigned) ``` diff --git a/data_enum/__init__.py b/data_enum/__init__.py index 29c8f2c..0db7f24 100644 --- a/data_enum/__init__.py +++ b/data_enum/__init__.py @@ -1,3 +1,4 @@ +# Copyright (C) 2021 Chase Finch """An alternative to the built-in Python `enum` implementation.""" from .data_enum import ( diff --git a/data_enum/_compatibility.py b/data_enum/_compatibility.py index 3fc9226..952f5b6 100644 --- a/data_enum/_compatibility.py +++ b/data_enum/_compatibility.py @@ -1,3 +1,4 @@ +# Copyright (C) 2021 Chase Finch """Back-compatibility shims for supported Python versions. `typing.override` only exists on Python 3.12+, but this package supports diff --git a/data_enum/data_enum.py b/data_enum/data_enum.py index c23bee0..9f9bc30 100644 --- a/data_enum/data_enum.py +++ b/data_enum/data_enum.py @@ -1,3 +1,4 @@ +# Copyright (C) 2021 Chase Finch """An alternative to the built-in Python `enum` implementation.""" from __future__ import annotations diff --git a/setup.py b/setup.py index 682d3b3..ac2457a 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +# Copyright (C) 2021 Chase Finch """Define metadata for DataEnum.""" from pathlib import Path diff --git a/tests/__init__.py b/tests/__init__.py index 9bae35f..be89eee 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1,2 @@ +# Copyright (C) 2021 Chase Finch """Tests for the DataEnum project.""" diff --git a/tests/test_data_enum.py b/tests/test_data_enum.py index c839e35..0ea7fb0 100644 --- a/tests/test_data_enum.py +++ b/tests/test_data_enum.py @@ -1,3 +1,4 @@ +# Copyright (C) 2021 Chase Finch """Tests for DataEnum.""" import pickle From 694fb7b948488befaf1e08e317da98d6d9a8c76d Mon Sep 17 00:00:00 2001 From: Chase Finch Date: Tue, 28 Jul 2026 16:40:34 -0400 Subject: [PATCH 4/5] Update ruff.toml --- ruff.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ruff.toml b/ruff.toml index ac75644..ef3bf5c 100644 --- a/ruff.toml +++ b/ruff.toml @@ -4,6 +4,9 @@ line-length = 99 target-version = "py313" output-format = "grouped" +# The axioms submodule isn't governed by this repo's style +extend-exclude = ["axioms"] + [lint] allowed-confusables = ["\u2018", "\u2019", "\u00d7", "\u2013"] select = ["ALL"] From 0c50216ae28ae88950c482bbddc7d8e40263f10a Mon Sep 17 00:00:00 2001 From: Chase Finch Date: Fri, 31 Jul 2026 15:16:52 -0400 Subject: [PATCH 5/5] Update LICENSE --- LICENSE | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/LICENSE b/LICENSE index 261eeb9..d9a10c0 100644 --- a/LICENSE +++ b/LICENSE @@ -174,28 +174,3 @@ of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License.