Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 5.2.3 instead.
Reason given by maintainers: Broken tag claiming Python 2 compatibility

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.org/project/Pebble/

Build Status Documentation Status PyPI - Downloads

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

Same code with AsyncIO support.

import asyncio

from pebble import asynchronous

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

async def asynchronous_function():
    result = await function(1, bar=2)  # blocks until results are ready
    print(result)

asyncio.run(asynchronous_function())

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

TIMEOUT_SECONDS = 3

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 index in range(0, 10):
        future = pool.submit(function, TIMEOUT_SECONDS, index, bar=1)
        future.add_done_callback(task_done)

Metadata

Release files for Pebble 5.0.1

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 5.0.1
File Size Uploaded Provenance Actions
Pebble-5.0.1.tar.gz 29.0 kB Without provenance Details for Pebble-5.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 59.0 kB

Release files / Pebble-5.0.1.tar.gz

Download URL Pebble-5.0.1.tar.gz
Size 29.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ee41c33be3d412285571f2cc7cf914d4c2a81ab3d388c68b3c746b7ab3b0b865
BLAKE2b-256 checksum
How to use checksums
6fd1c4197c755e858e1a388e6559d1101a8b53e22236f9cebc743549286fedd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.2

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

Download URL Pebble-5.0.1-py2.py3-none-any.whl
Size 30.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3ae712b40211fa731309dd6e846efd98da831ae546e300ff6f03a351621505c4
BLAKE2b-256 checksum
How to use checksums
3b761cd1f6527763744d5350477715267a27ad92b22bc26c6d8db980a015df68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.2

Security for Pebble 5.0.1

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

5.0.1 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