Threading and Multiprocessing for every project.
Project description
lox
Threading and multiprocessing made easy.
Free software: MIT license
Documentation: https://lox.readthedocs.io.
Lox provides decorators and synchronization primitives to quickly add concurrency to your projects.
Installation
pip3 install –user lox
Features
Multithreading: Powerful, intuitive multithreading in just 2 additional lines of code.
Multiprocessing: Truly parallel function execution with the same interface as multithreading.
Synchronization: Advanced thread synchronization, communication, and resource management tools.
Usage
Easy Multithreading
>>> import lox >>> >>> @lox.thread(4) # Will operate with a maximum of 4 threads ... def foo(x,y): ... return x*y >>> foo(3,4) # normal function calls still work 12 >>> for i in range(5): ... foo.scatter(i, i+1) -ignore- >>> # foo is currently being executed in 4 threads >>> results = foo.gather() # block until results are ready >>> print(results) # Results are in the same order as scatter() calls [0, 2, 6, 12, 20]
Easy Multiprocessing
>>> import lox >>> >>> @lox.process(4) # Will operate with a pool of 4 processes ... def foo(x,y): ... return x*y >>> foo(3,4) # normal function calls still work 12 >>> for i in range(5): ... foo.scatter(i, i+1) -ignore- >>> # foo is currently being executed in 4 processes >>> results = foo.gather() # block until results are ready >>> print(results) # Results are in the same order as scatter() calls [0, 2, 6, 12, 20]
History
0.4.2 (2019-06-23)
Fixed multiple instances and successive scatter and gather calls to wrapped methods
0.4.1 (2019-06-23)
Fixed broken workers and unit tests for workers
0.4.0 (2019-06-22)
Semi-breaking change: lox.thread and lox.process now automatically pass the object instance when decorating a method.
0.3.4 (2019-06-20)
Print traceback in red when a thread crashes
0.3.3 (2019-06-19)
Fix bug where thread in scatter of lox.thread double releases on empty queue
0.3.2 (2019-06-17)
Fix manifest for installation from wheel
0.3.1 (2019-06-17)
Fix package on pypi
0.3.0 (2019-06-01)
Multiprocessing decorator. lox.pool renamed to lox.thread
Substantial pytest bug fixes
Documentation examples
timeout for RWLock
0.2.1 (2019-05-25)
Fix IndexSemaphore context manager
0.2.0 (2019-05-24)
Added QLock
Documentation syntax fixes
0.1.1 (2019-05-24)
CICD test
0.1.0 (2019-05-24)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file lox-0.4.2.tar.gz
.
File metadata
- Download URL: lox-0.4.2.tar.gz
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6808c914453e92101a496bcfd58be6d13bc50f992d6ceea669e79f0cfc12ea4 |
|
MD5 | 5071ee74d5e7db1b8b205d50d66d03cf |
|
BLAKE2b-256 | 80cfcf8d1dd0d82c58b407ee473d7ff1a0526288e6458fc87740003d864ef753 |
File details
Details for the file lox-0.4.2-py2.py3-none-any.whl
.
File metadata
- Download URL: lox-0.4.2-py2.py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cb0f4c786c39cb8006294267a92e71ef9ae1ea99bb13c8a3d111944736228a7 |
|
MD5 | 14d69b4f1d1fbb424448c3be4091bc03 |
|
BLAKE2b-256 | ac35964782585aec7465c6009b6ccfd126a6f1bc4a01f35151ebc9ecc1dff00a |