NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #608 most downloaded on PyPI
Advanced Enumerations (compatible with Python's stdlib Enum), NamedTuples, and NamedConstants
Last release 6 months ago
20 Mar 2026
Release timing varies
gaps range from 2 weeks to 1.8 years
Most releases are documented
notes for 41 of 53 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
53 releases · first in 2015
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.
split source code into separate files
support inheriting from empty NamedTuples
support inheriting from empty NamedTuples
Nothing published for this version
prevent test_v3.py from being run as main
prevent test_v3.py from being run as main
Move Py2/3 specific code to dedicated files
Move Py2/3 specific code to dedicated files
recalculate bits used after all flags created (sometimes needed when a custom __new__ is in place.
recalculate bits used after all flags created (sometimes needed when a custom
__new__ is in place.
update flag creation to (possibly) add bitwise operator methods to newly created flags
update flag creation to (possibly) add bitwise operator methods to newly created flags
update extend_enum() to work with 3.11 flags
BREAKING CHANGE BUG FIX that won't affect most people
Update dir() on mixed enums to include mixed data type methods and
attributes.
Rename enum_property to property to match stdlib. Recommended usage is
aenum.property (prefix with module name).
Remove quadritic creation behavior.
BREAKING CHANGE BUG FIX that won't affect most people
Enums with a custom __new__ that:
None)will fail to generate a missing value. To fix: remove the default value and instead specify it on the member creation line.
BREAKING CHANGE
In Python 3.11 the str() of mixed enums will now match its format() which
will be the normal str() of the data type -- so for an IntEnum you'll see
5 instead of Perm.R|X. This affects IntEnum, StrEnum, and IntFlag.
fix support of auto() kwds
fix support of auto() kwds
rename aenum.property to aenum.enum_property
rename aenum.property to aenum.enum_property
fix enum_property to work with _init_ attributes
fix extend_enum() for unhashable values
fix extend_enum() for unhashable values
fix extend_enum() for most cases
fix extend_enum() for most cases
AddValue is similar to the old AutoNumber: it will always activate, but uses _generate_next_value_ to get the next value (so the user has some control
AddValue is similar to the old AutoNumber: it will always activate, but uses generate_next_value to get the next value (so the user has some control over the return data type instead of always getting an int).
BREAKING CHANGES
AutoValue is gone. It was superflous and its removal simplified the code.
Simply put the fields needed in an _init_ and _generate_next_value_
will be called to supply the missing values (this is probably already what
is happening).
enum_property() has been renamed to property() (old name still available, but deprecated).
standard Enum usage is unchanged
BREAKING CHANGES
Enum
Flag
ENHANCEMENTS
Member creation has been redone to match Python 3.10's methods. This also allows all supported Pythons (2.7, 3.3+) to use the set_name and init_subclass protocols (more robustly than in aenum 2.2.5)
CHANGES
enum_property() has been renamed to property() (old name still available, but deprecated).
bin() replacement shows negative integers in twos-complement
Nothing published for this version
call __init_subclass__ after members have been added, and in Pythons < 3.6 call __set_name__ in Pythons < 3.6 do not convert/disallow private names ad
call init_subclass after members have been added, and in Pythons < 3.6 call set_name in Pythons < 3.6 do not convert/disallow private names add iteration/len support to NamedConstant
add support to Constant to retrieve members by value
add support to Constant to retrieve members by value
--> class K(Constant):
... one = 1
... two = 2
--> K.one
<K.one: 1>
--> K(1)
<K.one: 1>
add pickle/deepcopy support to Constant
add support for Constant to use other Constant values (resulting members /are not/ the same)
--> class C(Constant)
... one = K.one
... three = 3
--> C.one == K.one
True
--> C.one is K.one
False
AutoNumber and auto() now work together
Enum members are now added to the class as enum_property, which supports unshadowing of parent class attributes when called on an Enum member:
--> class StrEnum(str, Enum):
... lower = 'lower'
... upper = 'upper'
... mixed = 'mixed'
--> StrEnum.lower
<StrEnum.lower: 'lower'>
--> StrEnum.lower.upper()
'LOWER'
--> StrEnum.upper
<StrEnum.upper: 'upper'>
--> StrEnum.upper.upper()
'UPPER'
use members' type's methods __str__, __repr__, __format__, and __reduce_ex__ if directly assigned in Enum class body; i.e.:
use members' type's methods str, repr, format, and reduce_ex if directly assigned in Enum class body; i.e.:
--> class Color(str, Enum):
... red = 'red'
... green = 'green'
... blue = 'blue'
... __str__ = str.__str__
--> print(repr(Color.green))
<Color.green: 'green'>
--> print(Color.green)
green
replace _RouteClassAttributeToGetattr with enum_property (it is still available as an alias)
replace _RouteClassAttributeToGetattr with enum_property (it is still available as an alias)
support constant() and auto() being used together:
--> class Fruit(Flag):
... _order_ = 'apple banana lemon orange'
... apple = auto()
... banana = auto()
... lemon = auto()
... orange = auto()
... CitrusTypes = constant(lemon | orange)
--> list(Fruit)
[Fruit.apple, Fruit.banana, Fruit.lemon, Fruit.orange]
--> list(Fruit.CitrusTypes)
[Fruit.orange, Fruit.lemon]
--> Fruit.orange in Fruit.CitrusTypes
True
allow Enums to be called without a value
allow Enums to be called without a value
class Color(Enum):
black = 0
red = 1
green = 2
blue = 3
#
@classmethod
def _missing_value_(cls, value):
if value is no_arg:
return cls.black
>>> Color()
<Color.black: 0>
allow Enum name use while constructing Enum (Python 3.4+ only)
--> class Color(Enum):
... _order_ = 'BLACK WHITE'
... BLACK = Color('black', '#000')
... WHITE = Color('white', '#fff')
... #
... def __init__(self, label, hex):
... self.label = label
... self.hex = hex
In Python 3+ classes defined inside an Enum no longer become members by default; in Python 2 they still become members, but see below.
In Python 3+ classes defined inside an Enum no longer become members by default; in Python 2 they still become members, but see below.
For cross-compatibility and full control two decorators are provided:
So to have an Enum that behaves the same in Python 2 and 3, use the decorators (and other compatibility shims):
class Color(Enum):
_order_ = 'red green blue'
red = 1
green = 2
blue = 3
@nonmember
class Shades(Enum):
_order_ = 'light medium dark'
light = 1
medium = 2
dark = 3
use getfullargspec() in Python 3 (avoids deprecation warnings)
EnumMeta:
Enum:
extend_enum:
general:
when order is callable, save it for subclass use
when order is callable, save it for subclass use
correctly raise TypeError for non-Enum containment checks support combining names with | for Flag key access support _order_ being a callable
correctly raise TypeError for non-Enum containment checks support combining names with | for Flag key access support order being a callable
support Flags being combined with other data types:
support Flags being combined with other data types:
ensure _ignore_ is set when _settings_ specified in body which includes AutoValue
ensure ignore is set when settings specified in body which includes AutoValue
make Flag members iterable
fix missing comma in __all__ fix extend_enum with custom __new__ methods fix MultiValue with AutoNumber without _init_
fix missing comma in all fix extend_enum with custom new methods fix MultiValue with AutoNumber without init
extend_enum now handles aliases and multivalues correctly
extend_enum now handles aliases and multivalues correctly
support mixin types with extend_enum init and AutoNumber can now work together add test for new Enum using EnumMeta add tests for variations of multiv
support mixin types with extend_enum init and AutoNumber can now work together add test for new Enum using EnumMeta add tests for variations of multivalue and init prevent deletion of NamedConstant.constant
constants cannot be deleted (they already couldn't be changed) constants can be used to define other constants
constants cannot be deleted (they already couldn't be changed) constants can be used to define other constants
_init_ and MultiValue can now work together
init and MultiValue can now work together
_init_ and AutoValue (and _generate_next_value_) can now work together to supply missing values even when some of the required values per member are a
init and AutoValue (and generate_next_value) can now work together to supply missing values even when some of the required values per member are absent
add _missing_value_ and _missing_name_ methods, deprecate _missing_ make enum instances comparable
add missing_value and missing_name methods, deprecate missing make enum instances comparable
both EnumMeta.__getattr__ and Enum.__new__ fall back to _missing_
both EnumMeta.getattr and Enum.new fall back to missing
auto() now works with other data types AutoNumber supports legacy Enums (fixed regression)
auto() now works with other data types AutoNumber supports legacy Enums (fixed regression)
Flag and IntFlag added.
Flag and IntFlag added.
fix %-interpolation bug defined SqlLiteEnum only if sqlite exists support pyflakes
fix %-interpolation bug defined SqlLiteEnum only if sqlite exists support pyflakes
revert AutoNumberEnum to custom __new__ instead of AutoNumber use _ignore_ to shield against AutoNumber magic inherit start and init settings from bas
revert AutoNumberEnum to custom new instead of AutoNumber use ignore to shield against AutoNumber magic inherit start and init settings from base Enums
enabled export as a decorator enabled _order_ to replace __order__ enabled python2 support for settings, init, and start
enabled export as a decorator enabled order to replace order enabled python2 support for settings, init, and start
support _ignore_ for dynamically creating class bodies
support ignore for dynamically creating class bodies
MultiValue, NoAlias, Unique, and init now work with Python 2
MultiValue, NoAlias, Unique, and init now work with Python 2
Py3: added Enum creation flags: Auto, MultiValue, NoAlias, Unique
Py3: added Enum creation flags: Auto, MultiValue, NoAlias, Unique
fixed extend_enum to honor Enum flags
Breaking change: enum members now default to evaluating as True to maintain compatibility with the stdlib.
When possible aenum inherits from Python's own enum.
Breaking change: enum members now default to evaluating as True to maintain compatibility with the stdlib.
Add your own bool (nonzero in Python 2) if need this behavior:
def __bool__(self):
return bool(self.value)
__nonzero__ = __bool__
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →