skillfed

Pebble

Threading and multiprocessing eye-candy.

pebble v5.2.1 1.5M downloads/30d#3,778 on PyPI651
Copyleft license LGPL Active released

What it is and what it does

Pebble is a decorator-based library that simplifies running functions concurrently in threads or separate processes. It wraps Python's threading and multiprocessing modules with a cleaner API, allowing you to mark functions with @concurrent.thread or @concurrent.process and get back futures that you can poll or await. The library handles timeouts, error propagation (including remote tracebacks from worker processes), and provides pool abstractions for managing multiple workers with configurable restart and task limits.

The package is useful when you need to offload blocking I/O or CPU-bound work without writing boilerplate around futures and exception handling. It supports both synchronous and asyncio-based code paths, so you can use the same decorated functions in traditional or async contexts. With no external dependencies and support for current Python versions, it's straightforward to add to existing projects.

Use it for:

  • Offload blocking I/O operations (file reads, network calls) to threads while keeping the main thread responsive.
  • Run CPU-bound computations in separate processes to avoid Python's GIL and parallelize work.
  • Enforce time limits on long-running tasks and handle timeouts gracefully without killing the process.
  • Build worker pools for batch processing with automatic task distribution and error collection.
  • Integrate concurrent execution into asyncio applications using the @asynchronous decorators.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Pebble provides decorators and pool abstractions to run functions in separate threads or processes, with timeout and error handling support.

Yes. Pebble is actively maintained, has no external dependencies, carries a copyleft license suitable for open-source work, and provides genuine convenience for concurrent programming. Install it if you need decorator-based thread or process management with timeout support; skip it if you need only basic threading or if your project cannot accept LGPL licensing.

Install

pebble on PyPI

pip

pip install pebble

uv

uv add pebble

poetry

poetry add pebble

Installing Pebble

Before you install

Low friction installation with no runtime dependencies. Actively maintained with recent releases and a stable codebase since 2013.

License in practice

Licensed under LGPL (copyleft), which requires derivative works to be distributed under compatible terms; suitable for open-source projects but review is needed before use in proprietary software.

Quickstart

pip install Pebble

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()
except TimeoutError:
    print("Timed out")

Requires Python 3.8 or later.

Verify before relying

  • Whether process-based execution works reliably on Windows (multiprocessing platform differences not detailed in fact sheet).
  • Performance characteristics and overhead compared to direct threading/multiprocessing for specific workload types.

Package facts

License LGPL (copyleft)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 26 days since the last release
Last repo commit
First released
Downloads 1,546,487/month — #3,778 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pebble-5.2.1-py3-none-any.whl

Keywords: thread, process, pool, decorator

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)Operating System :: OS IndependentProgramming Language :: Python :: 3Topic :: Software Development :: Libraries :: Python Modules

Tags

thread pool decoratorprocess pool managementconcurrent function executiontimeout handling threadsasync task schedulingworker pool abstractionthread process decorator
concurrencymultiprocessingdecorator-based

More Python Modules packages