Releases: Techcable/orderedset.py
Fix broken wheel
After I published v0.1.7 to PyPI, I realized it was missing necessary source files. The only python file included was _version.py
, which is not sufficient to run the library.
This version v0.1.8 has only a single commit fixing the issue (dcb1fe8).
This issue was caused by the transition from setuptools to hatch. Now that the configuration is fixed, it should not happen again.
Document `OrderedSet.remove` has linear complexity
Document that OrderedSet.remove
method has linear complexity, unlike set.remove
which takes O(1)
time. This can potentially cause quadratic blow up if called inside a loop.
To work around this, use OrderedSet.__isub__
to remove items in bulk.
Full Changes
- Document the fact
OrderedSet.remove
takes linear time- Add test to check for this behavior (currently failing, since it takes linear instead of constant time)
- Explicitly implement in-place bulk methods
__ior__
,__iand__
to avoid quadratic blow up
- Explicitly implement
OrderedSet.remove
(previously implemented by superclass) - Switch build from setuptools to hatchling
Add OrderedSet.of constructor and improve docs
Adds the OrderedSet.of
factory method. This is a convenient shorthand for OrderedSet([1,2,3])
while avoiding an extra pair of brackets.
Significantly improve docstrings and readme, although the API documentation is still not published. See PR #4 for ongoing work.
Changes
OrderedSet.sort
now requirekey
andreverse
to be keyword arguments. This is consistent with the (new) behavior oflist.sort
.- This is (potentially) breaking, but the old behavior was never intended
- Change format of
OrderedSet.__repr__
to use the newOrderedSet.of
factory method. - Configure
ruff
more agressively, adding lints well beyond the defaults.
More efficient pickling
This avoids serializing each element twice. Because pickling preserves object identity, the behavior was still correct before, it was just less efficient.
The new version is fully backwards compatible, and can still deserialize data from v0.1.4.
There is a test to make sure this is true.
Implement OrderedSet.dedup
This is an iterator combinator that removes duplicate elements while preserving ordering.
Because it is implemented as a generator, it does not need to wait for the entire input before yielding values.
Add a corresponding OrderedSet.dedup_async
method for AsyncIterator
Support pydantic serialization and validation
This resolves issue #1 - The depenency is optional and the library still works fine without it.
Full Changes
Drop cython build dependency
Not currently being used.
Use 'techcable' as a namespace, not a package
Avoids conflicts with my other libraries that use 'techcable'.
Namespace packages are described in PEP 420.
Initial Release
v0.1.0 Initial release