Repository navigation
Release 0.20.0
Pyochain v0.20.0
This release follow the pattern of 0.18 and 0.19 regarding changes for a leaner, cleaner API with better semantics.
Note that besides the first 4 points in the "breaking changes" section, the rest won't impact you unless you defined custom subclasses from the former traits module.
Changes
💥 Breaking changes
- API change:
pyochain::traitsmodule is nowpyochain::abc. If you were importing frompyochain.traits, update your imports topyochain.abcinstead. - Removed:
PyoIterable::new. Call__init__(())for the same behavior, e.gSeq(()),Iter(()), etc... - Removed:
UnzippedandPeekabledataclasses. TheItermethods who constructed them now simply return tuples instead, simplifying the API and improving speed. - API change:
Iter::sort(now in base classPyoIterator) has been split intoIter::sortandIter::sort_by. If you were usingIter::sort(key=...), you should now useIter::sort_by(key=...)instead. This should bring typing improvements as well as a clearer API. - API change:
PyoIterable::__init__is deleted. This means that subclasses are free to implement their own constructors, without typing constraints nor default behavior.
Methods migration to concrete parents
If you did not define custom classes from PyoSet or PyoIterator, skip to the Enhancements section.
The __init__ deletion from PyoIterable also means that all ABCs methods that relied on self::__class__ needed to move to their concrete pyochain parents, as they couldn't stay (nor should have ever been) purely abstract.
This concerns:
from PyoSet to Set ->
intersection, r_intersection, union, r_union, difference, r_difference, symmetric_difference, r_symmetric_difference
from PyoIterator to Iter ->
take_while, skip_while, compress, unique, unique_by, take, skip, step_by, slice, cycle, insert, intersperse, chain, accumulate
✨ Enhancements
- Migrated:
Iter::{collect_into, try_collect, sort, tail}have been moved toPyoIterator, meaning all user-defined subclasses can now call them (as well assort_by) - Migrated:
Vec::{drain, extract_if}have been moved toPyoMutableSequence, meaning all user-defined mutable sequence subclasses can now call them.
📖 Documentation
- Improved various classes and methods documentation.
- Reformatted all code examples with Ruff.
- Added dev documentation regarding design choices on where to implement a method (abstract vs concrete class).
🔄 Refactors
- Separated some classes in dedicated files to reduce the size of
_iter.pyand improve readability.Seqis now in_seq.py,SetandSetMutare now in_set.pynotably.