marshmallow
marshmallow copied to clipboard
unbundle ordered-set
This module was added in 2014, but it is available in PyPI for long time.
This patch is actually in package in Fedora Linux for ages. No issue has been reported during that time.
See #546. Looks like there are (were ?) several competing implementations. Let's make sure we pick the right one if we go on with this.
Looks like none is packaged on Debian.
Since we don't use all features of an ordered set, and since performance doesn't matter that much on schema creation, I'm wondering if we even need an ordered set in the first place. But I've been giving it a quick try to see if we could replace this with a list or a dict and I have the feeling that it would take more code than the recipe we currently use.
The other option can be:
try:
from ordered_set import OrderedSet
except ImportError:
from marshmallow.orderedset import OrderedSet
try: from ordered_set import OrderedSet except ImportError: from marshmallow.orderedset import OrderedSet
I'd rather settle one way or another than maintain both ways using the conditional import above.
While I like to avoid code duplication, this part of the code is small and stable and there doesn't even seem to be a consensus on a single implementation (#546). It is mostly a question of principle. The "no-duplication" principle meets the "don't go making a lib for any piece of code that is more than 10 lines long, this is not Javascript" principle.
Thinking this again, I totally respect the choice of Fedora devs, but I don't feel strongly in favour of this. I'm fine with the status quo.
Leaving this open for others to comment.
#1744 is partly related.