Metadata-Version: 1.1
Name: Pebble
Version: 3.0.0
Summary: Threading and multiprocessing eye-candy.
Home-page: https://github.com/noxdafox/pebble
Author: Matteo Cafasso
Author-email: noxdafox@gmail.com
License: LGPL
Description: Pebble
        ======
        
        
        Description
        -----------
        
        Pebble provides a neat API to manage threads and processes within an application.
        
        
        Examples
        --------
        
        Spawn a function within a thread::
        
            from pebble import thread
        
        
            def function(foo, bar=0):
            	print foo + bar
        
        
            if __name__ == "__main__":
                thrd = thread.spawn(target=function, args=[1], kwargs={'bar':2})
                thrd.join()
        
        
        Most of the functions work as well as decorators::
        
            from pebble import process
        
        
            @process.spawn(daemon=True)
            def function(foo, bar=0):
            	print(foo + bar)
        
        
            if __name__ == "__main__":
                proc = function(1, bar=2)
                proc.join()
        
        
        Run a job in a separate process and wait for its results::
        
            from pebble import process
        
        
            @process.concurrent
            def function(foo, bar=0):
                return foo + bar
        
        
            if __name__ == "__main__":
                task = function(1, bar=2)
                results = task.get()  # blocks until results are ready
        
        
        Pools allow to execute several tasks without the need of spawning a new worker for each one of them::
        
            from threading import current_thread
            from pebble import thread
        
        
            def task_done(task):
                results, thread_id = task.get()
            	print "Task %s returned %d from thread %s" % (task.id,
                                                              results,
                                                              thread_id)
        
        
            def do_job(foo, bar=0):
            	return foo + bar, current_thread().ident
        
        
            if __name__ == "__main__":
                with thread.Pool(workers=5) as pool:
                    for i in range(0, 10):
                        pool.schedule(do_job, args=(i, ), callback=task_done)
        
        
        Check the documentation for more examples.
        
        TODO:
        
          * taskselect, queueselect, threadselect, procselect: wait for multiple Tasks, Queues, Threads and Processes
          * channels for message driven synchronization
        
Keywords: thread process pool decorator
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
