Process Queue
Project description
Process Queue
Simplify data processing using pipelines.
- Inline
# Create the numbers 1-10, square them, then sum the results
result = proq.create(range(11)).map(lambda x: x ** 2).reduce(lambda x, y: x + y).next()
- Procedurally
# Create a square numbers proq and split into two
data1, data2 = proq.create(range(11)).map(lambda x: x ** 2).tee()
# negate one of the streams
data1_neg = data1.map(lambda x: -x)
# add 1 to the other
data2_plus_1 = data2.map(lambda x: x + 1)
# Iterate over the results
for d1, d2 in zip(data1_neg, data2_plus_1):
print(d1, d2, d1 + d2)
assert d1 + d2 == 1
- In parallel
# Get prime numbers under 1,000,000 - calculation happens concurrently
primes = (
proq.create(range(1000001))
.par_map(lambda x: x, is_prime(x))
.filter(lambda x, is_prime: is_prime)
.map(lambda x, is_prime: x)
.collect()
)
Installation
pip install proq
Development
- Download source
- Install development dependencies:
flit install -s --deps develop
- Format code:
black .
- Run tests:
pytest
- Bump version in
src/proq/__init__.py
- Build package:
flit build
- Deploy:
flit publish
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
proq-0.0.4.tar.gz
(6.9 kB
view details)
Built Distribution
proq-0.0.4-py3-none-any.whl
(5.1 kB
view details)
File details
Details for the file proq-0.0.4.tar.gz
.
File metadata
- Download URL: proq-0.0.4.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b95e8a6f1b73619b84ed622b5a478d616ec4b6d75259ec7d15b3b71c679c748c |
|
MD5 | b1cba14ebc28bbe3b2ecc4b57332512f |
|
BLAKE2b-256 | 20e7375f76dd90743836c6359ba916792624102e1a6e25bca103a02c3196213e |
File details
Details for the file proq-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: proq-0.0.4-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58bc39d43003fd21a0dfeb23709b8594e58442e4bd203cc70ce5b07b7ce5c4af |
|
MD5 | fce4cfedec0798c95081c427a9be1fb9 |
|
BLAKE2b-256 | 2b26ca7fa3e523fb0c96303c6e7911672d8f99eab77244a5209143579b8bfeea |