Typed Stream
The Stream class is an iterable with utility methods for transforming it.
This library heavily uses itertools for great performance and simple code.
Examples
>>> import typed_stream
>>> # Get sum of 10 squares
>>> typed_stream.Stream.range(stop=10).map(lambda x: x * x).sum()
285
>>> # same as above
>>> sum(typed_stream.Stream.counting().limit(10).map(pow, 2))
285
>>> # sum first 100 odd numbers
>>> typed_stream.Stream.counting(start=1, step=2).limit(100).sum()
10000
>>> (typed_stream.Stream.counting()
... .filter(typed_stream.functions.is_odd).limit(100).sum())
10000
>>> (typed_stream.Stream.counting()
... .exclude(typed_stream.functions.is_even).limit(100).sum())
10000
>>> import typed_stream.functions
>>> # Get the longest package name from requirements-dev.txt
>>> (typed_stream.FileStream("requirements-dev.txt")
... .filter()
... .exclude(typed_stream.functions.method_partial(str.startswith, "#"))
... .exclude(typed_stream.functions.method_partial(str.__contains__, "git+"))
... .map(str.split, "==")
... .starmap(lambda name, version = None: name)
... .max(key=len))
'flake8-no-implicit-concat'
In examples are more complex examples using Streams.
Not yet asked questions
I'll try to answer questions that could occur.
What do the versions mean?
I try to follow something similar to sem-ver. For versions before 1.0.0 this means the format is 0.<major>.<patch>.
Any change that could be considered a breaking-change (adding things is not a breaking change) increases the major part. If only patch has changed, there was no breaking-change.
I try to avoid changes that break my own code, so even if major has been changed, it should probably be safe to upgrade.
Why are there no changelogs?
I'm too lazy. I don't know of anybody using this (except me) and I don't need to write changelogs for myself. If you need changelogs, please create an issue.
Why EUPL-1.2-or-later?
- 🇪🇺
- AGPL3 is too long
- Google EUPL Policy
Is it production-ready?
Probably.
Metadata
Release files for typed-stream 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| typed_stream-1.0.0.tar.gz | 29.4 kB | Without provenance | Details for typed_stream-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| typed_stream-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for typed_stream-1.0.0-py3-none-any.whl |
Total release size: 65.6 kB
Release files / typed_stream-1.0.0.tar.gz
| Download URL | typed_stream-1.0.0.tar.gz |
|---|---|
| Size | 29.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3200d058ebc6309d6156fd867a09676f39fae7470aef96e303a971344f74259
|
|
BLAKE2b-256 checksum How to use checksums |
c733afa4ba244406b47227e1589868672c916a45f550bffd43a3943f1b040eef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / typed_stream-1.0.0-py3-none-any.whl
| Download URL | typed_stream-1.0.0-py3-none-any.whl |
|---|---|
| Size | 36.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ea5e9c404839656376bce1deb2959b5cfcacf59314ef7990f712ed7dd02ac22
|
|
BLAKE2b-256 checksum How to use checksums |
71f0d83322a98292f9f6802ec132cfc541369fd14afcdbf530c65307a30749d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for typed-stream 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.