Skip to main content

Pebble

Pebble provides a neat API to manage threads and processes within an application.

Source:

https://github.com/noxdafox/pebble

Documentation:

https://pebble.readthedocs.io

Download:

https://pypi.python.org/pypi/pebble

Build Status Documentation Status

Examples

Run a job in a separate thread and wait for its results.

from pebble import concurrent

@concurrent.thread
def function(foo, bar=0):
    return foo + bar

future = function(1, bar=2)

result = future.result()  # blocks until results are ready

Run a function with a timeout of ten seconds and deal with errors.

from pebble import concurrent
from concurrent.futures import TimeoutError

@concurrent.process(timeout=10)
def function(foo, bar=0):
    return foo + bar

future = function(1, bar=2)

try:
    result = future.result()  # blocks until results are ready
except TimeoutError as error:
    print("Function took longer than %d seconds" % error.args[1])
except Exception as error:
    print("Function raised %s" % error)
    print(error.traceback)  # traceback of the function

Pools support workers restart, timeout for long running tasks and more.

from pebble import ProcessPool
from concurrent.futures import TimeoutError

def function(foo, bar=0):
    return foo + bar

def task_done(future):
    try:
        result = future.result()  # blocks until results are ready
    except TimeoutError as error:
        print("Function took longer than %d seconds" % error.args[1])
    except Exception as error:
        print("Function raised %s" % error)
        print(error.traceback)  # traceback of the function

with ProcessPool(max_workers=5, max_tasks=10) as pool:
    for i in range(0, 10):
        future = pool.schedule(function, args=[i], timeout=3)
        future.add_done_callback(task_done)

Metadata

Release files for Pebble 4.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Pebble 4.6.0
File Size Uploaded Provenance Actions
Pebble-4.6.0.tar.gz 23.9 kB Without provenance Details for Pebble-4.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Pebble 4.6.0
File Interpreter ABI Platform Actions
Pebble-4.6.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for Pebble-4.6.0-py2.py3-none-any.whl

Total release size: 48.7 kB

Release files / Pebble-4.6.0.tar.gz

Download URL Pebble-4.6.0.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
10bd8c42573b05c78ad280ce2e53fb892d8fd7405dac3419ed09b95c8f2ba928
BLAKE2b-256 checksum
How to use checksums
1ad820ecdbda8b9ca11774474a0489d81cd0bd3dc879cfdfc3f7e3c5fa5557a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Release files / Pebble-4.6.0-py2.py3-none-any.whl

Download URL Pebble-4.6.0-py2.py3-none-any.whl
Size 24.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
21e633241534e580d6cd01d45f725ad70e7a0749c26dd3433cb080f7f78f4ba0
BLAKE2b-256 checksum
How to use checksums
5a05ca1446ede9a2fbb1ce49416f16aa57e3e5d13d1b55131232cd9f85bafe23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Security for Pebble 4.6.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.

Release history Release notifications | RSS feed

This release

4.6.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page