Skip to content

v0.4.1

Choose a tag to compare

@nstarman nstarman released this 07 Aug 00:30
d67dfef

Behaviour change: tuple member values

OptionalDependencyEnum now defines __new__, so that members whose versions
are equal stay distinct (#57). A side effect is that enum unpacks tuple
values into it, and a tuple-valued member no longer works:

class OptDeps(OptionalDependencyEnum):
    X = (get_version("some-package"), "extra")
# TypeError: OptionalDependencyEnum.__new__() takes 2 positional arguments but 3 were given

A plain enum.Enum stored the tuple as the member's value. Member values here
are documented as a Version or NOT_INSTALLED, and the low-level helpers
(get_version, chain_checks) still return exactly those, so ordinary use is
unaffected — but a member assigned a tuple now fails loudly instead of being
accepted.

What's Changed

  • Backport PR #40 on branch versions/v0.4.x (ci: update nox) by @meeseeksmachine in #41
  • Backport PR #57 on branch versions/v0.4.x (🐛 fix: stop members with equal values collapsing into aliases) by @nstarman in #59

Full Changelog: v0.4.0...v0.4.1