{"id":21441034,"url":"https://github.com/noxdafox/pebble","last_synced_at":"2025-05-15T10:01:57.920Z","repository":{"id":11221133,"uuid":"13610897","full_name":"noxdafox/pebble","owner":"noxdafox","description":"Multi threading and processing eye-candy.","archived":false,"fork":false,"pushed_at":"2025-03-16T15:59:59.000Z","size":881,"stargazers_count":581,"open_issues_count":1,"forks_count":55,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-14T16:53:48.455Z","etag":null,"topics":["asyncio","decorators","multiprocessing","pool","python","threading"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/noxdafox.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-10-16T05:56:17.000Z","updated_at":"2025-04-09T10:03:08.000Z","dependencies_parsed_at":"2022-08-07T06:01:15.681Z","dependency_job_id":"08dc6601-83e4-4ec7-8dee-50c4fa2f47a8","html_url":"https://github.com/noxdafox/pebble","commit_stats":{"total_commits":632,"total_committers":15,"mean_commits":42.13333333333333,"dds":0.319620253164557,"last_synced_commit":"c7b2c92fc2478027825d1c8b218287809d8895c1"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noxdafox%2Fpebble","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noxdafox%2Fpebble/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noxdafox%2Fpebble/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noxdafox%2Fpebble/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noxdafox","download_url":"https://codeload.github.com/noxdafox/pebble/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319717,"owners_count":22051072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asyncio","decorators","multiprocessing","pool","python","threading"],"created_at":"2024-11-23T01:20:08.362Z","updated_at":"2025-05-15T10:01:56.989Z","avatar_url":"https://github.com/noxdafox.png","language":"Python","readme":"Pebble\n======\n\nPebble provides a neat API to manage threads and processes within an application.\n\n:Source: https://github.com/noxdafox/pebble\n:Documentation: https://pebble.readthedocs.io\n:Download: https://pypi.org/project/Pebble/\n\n|build badge| |docs badge| |downloads badge|\n\n.. |build badge| image:: https://github.com/noxdafox/pebble/actions/workflows/action.yml/badge.svg\n   :target: https://github.com/noxdafox/pebble/actions/workflows/action.yml\n   :alt: Build Status\n.. |docs badge| image:: https://readthedocs.org/projects/pebble/badge/?version=latest\n   :target: https://pebble.readthedocs.io\n   :alt: Documentation Status\n.. |downloads badge| image:: https://img.shields.io/pypi/dm/pebble\n   :target: https://pypistats.org/packages/pebble\n   :alt: PyPI - Downloads\n\nExamples\n--------\n\nRun a job in a separate thread and wait for its results.\n\n.. code:: python\n\n    from pebble import concurrent\n\n    @concurrent.thread\n    def function(foo, bar=0):\n        return foo + bar\n\n    future = function(1, bar=2)\n\n    result = future.result()  # blocks until results are ready\n\nSame code with AsyncIO support.\n\n.. code:: python\n\n    import asyncio\n\n    from pebble import asynchronous\n\n    @asynchronous.thread\n    def function(foo, bar=0):\n        return foo + bar\n\n    async def asynchronous_function():\n        result = await function(1, bar=2)  # blocks until results are ready\n        print(result)\n\n    asyncio.run(asynchronous_function())\n\nRun a function with a timeout of ten seconds and deal with errors.\n\n.. code:: python\n\n    from pebble import concurrent\n    from concurrent.futures import TimeoutError\n\n    @concurrent.process(timeout=10)\n    def function(foo, bar=0):\n        return foo + bar\n\n    future = function(1, bar=2)\n\n    try:\n        result = future.result()  # blocks until results are ready\n    except TimeoutError as error:\n        print(\"Function took longer than %d seconds\" % error.args[1])\n    except Exception as error:\n        print(\"Function raised %s\" % error)\n        print(error.traceback)  # traceback of the function\n\nPools support workers restart, timeout for long running tasks and more.\n\n.. code:: python\n\n    from pebble import ProcessPool\n    from concurrent.futures import TimeoutError\n\n    TIMEOUT_SECONDS = 3\n\n    def function(foo, bar=0):\n        return foo + bar\n\n    def task_done(future):\n        try:\n            result = future.result()  # blocks until results are ready\n        except TimeoutError as error:\n            print(\"Function took longer than %d seconds\" % error.args[1])\n        except Exception as error:\n            print(\"Function raised %s\" % error)\n            print(error.traceback)  # traceback of the function\n\n    with ProcessPool(max_workers=5, max_tasks=10) as pool:\n        for index in range(0, 10):\n            future = pool.schedule(function, index, bar=1, timeout=TIMEOUT_SECONDS)\n            future.add_done_callback(task_done)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoxdafox%2Fpebble","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoxdafox%2Fpebble","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoxdafox%2Fpebble/lists"}