downstream
raw JSON → 1.22.0 verified Fri May 01 auth: no python
downstream provides efficient, constant-space algorithms for stream curation, including deduplication, filtering, and counting. Current version 1.22.0 supports Python >=3.10. Releases are regular, with breaking changes documented in changelog.
pip install downstream Common errors
error ImportError: cannot import name 'BloomFilter' from 'downstream' ↓
cause Trying to import from submodule (downstream.bloom) which is removed in v1.0+
fix
Use 'from downstream import BloomFilter'
error TypeError: BloomFilter.__init__() got an unexpected keyword argument 'size' ↓
cause Using old constructor signature (size, num_hashes)
fix
Use 'BloomFilter(capacity=..., error_rate=...)'
Warnings
breaking In v1.0, BloomFilter constructor changed from (size, num_hashes) to (capacity, error_rate). Old code using positional arguments will break. ↓
fix Use keyword arguments: BloomFilter(capacity=..., error_rate=...)
gotcha BloomFilter does not support deletion. Attempting to remove items silently does nothing. ↓
fix Use CountingBloomFilter if deletion is needed.
deprecated The `downstream.utils` module is deprecated since v1.15 and will be removed in v2.0. ↓
fix Import utilities directly from downstream: e.g. from downstream import hash_functions
Imports
- BloomFilter wrong
from downstream.bloom import BloomFiltercorrectfrom downstream import BloomFilter - CountMinSketch wrong
import downstreamcorrectfrom downstream import CountMinSketch
Quickstart
from downstream import BloomFilter
bf = BloomFilter(capacity=1000, error_rate=0.01)
bf.add('item1')
print('item1' in bf) # True