{"id":28537550,"url":"https://github.com/python-trio/trimeter","last_synced_at":"2025-07-08T07:32:01.326Z","repository":{"id":66107165,"uuid":"151952068","full_name":"python-trio/trimeter","owner":"python-trio","description":"(not ready yet) A simple but powerful job scheduler for Trio programs","archived":false,"fork":false,"pushed_at":"2020-09-03T05:52:21.000Z","size":51,"stargazers_count":67,"open_issues_count":11,"forks_count":3,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-06-28T08:32:25.391Z","etag":null,"topics":["async","async-await","concurrency-management","map","python","trio"],"latest_commit_sha":null,"homepage":"https://trimeter.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/python-trio.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"python-trio","open_collective":"python-trio"}},"created_at":"2018-10-07T14:49:11.000Z","updated_at":"2025-06-19T15:31:22.000Z","dependencies_parsed_at":"2023-06-28T09:57:26.029Z","dependency_job_id":null,"html_url":"https://github.com/python-trio/trimeter","commit_stats":{"total_commits":31,"total_committers":6,"mean_commits":5.166666666666667,"dds":0.5483870967741935,"last_synced_commit":"85d50671c3c754d149c6211fa32fe81d5b07b79d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/python-trio/trimeter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-trio%2Ftrimeter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-trio%2Ftrimeter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-trio%2Ftrimeter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-trio%2Ftrimeter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/python-trio","download_url":"https://codeload.github.com/python-trio/trimeter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/python-trio%2Ftrimeter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264025944,"owners_count":23545782,"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":["async","async-await","concurrency-management","map","python","trio"],"created_at":"2025-06-09T18:10:12.706Z","updated_at":"2025-07-08T07:32:01.317Z","avatar_url":"https://github.com/python-trio.png","language":"Python","funding_links":["https://github.com/sponsors/python-trio","https://opencollective.com/python-trio"],"categories":[],"sub_categories":[],"readme":".. image:: https://img.shields.io/badge/chat-join%20now-blue.svg\n   :target: https://gitter.im/python-trio/general\n   :alt: Join chatroom\n\n.. image:: https://img.shields.io/badge/docs-read%20now-blue.svg\n   :target: https://trimeter.readthedocs.io/en/latest/?badge=latest\n   :alt: Documentation Status\n\n.. image:: https://img.shields.io/pypi/v/trimeter.svg\n   :target: https://pypi.org/project/trimeter\n   :alt: Latest PyPi version\n\n.. image:: https://travis-ci.org/python-trio/trimeter.svg?branch=master\n   :target: https://travis-ci.org/python-trio/trimeter\n   :alt: Automated test status\n\n.. image:: https://codecov.io/gh/python-trio/trimeter/branch/master/graph/badge.svg\n   :target: https://codecov.io/gh/python-trio/trimeter\n   :alt: Test coverage\n\nWarning\n=======\n\nThis library isn't ready for release yet. Feedback welcome!\n\n\nTrimeter\n========\n\nTrio is a friendly Python library for async concurrency and\nnetworking. Trimeter is a simple but powerful job scheduler for\nprograms using Trio, released under your choice of the MIT or Apache 2\nlicenses.\n\nTrimeter's core purpose is to make it easy to execute lots tasks\nconcurrently, with rich options to **control the degree of\nconcurrency** and to **collect the task results**.\n\nSay you have 1000 urls that you want to fetch and process somehow:\n\n.. code-block:: python3\n\n   # Old slow way\n   for url in urls:\n       await fetch_and_process(url)\n\nThat's slow, so you want to do several at the same time... but to\navoid overloading the network, you want to limit it to at most 5 calls\nat once. Oh, and there's a request quota, so we have to throttle it\ndown to 1 per second. No problem:\n\n.. code-block:: python3\n\n   # New and fancy way\n   await trimeter.run_on_each(\n       fetch_and_process, urls, max_at_once=5, max_per_second=1\n   )\n\nWhat if we don't know the whole list of urls up front? No worries,\njust pass in an async iterable instead, and Trimeter will do the right\nthing.\n\nWhat if we want to get the result from each call as it finishes, so we\ncan do something further with it? Just use ``amap`` (= short for\n\"async `map\n\u003chttps://docs.python.org/3/library/functions.html#map\u003e`__\"):\n\n.. code-block:: python3\n\n   async with trimeter.amap(fetch_and_process, urls, ...) as results:\n       # Then iterate over the return values, as they become available\n       # (i.e., not necessarily in the original order)\n       async for result in results:\n           ...\n\nOf course ``amap`` also accepts throttling options like\n``max_at_once``, ``max_per_second``, etc.\n\nWhat if we want to use the `outcome library\n\u003chttps://outcome.readthedocs.io/\u003e`__ to capture exceptions, so one\ncall crashing doesn't terminate the whole program? And also, we want\nto pass through the original url alongside each result, so we know\nwhich result goes with which url?\n\n.. code-block:: python3\n\n   async with trimeter.amap(\n       fetch_and_process,\n       urls,\n       capture_outcome=True,\n       include_value=True,\n   ) as outcomes:\n       # Then iterate over the return values, as they become available\n       # (i.e., not necessarily in the original order)\n       async for url, outcome in outcomes:\n           try:\n               return_value = outcome.unwrap()\n           except Exception as exc:\n               print(f\"error while processing {url}: {exc!r}\")\n\nWhat if we just want to call a few functions in parallel and then get\nthe results as a list, like `asyncio.gather\n\u003chttps://docs.python.org/3/library/asyncio-task.html#asyncio.gather\u003e`__\nor `Promise.all\n\u003chttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all\u003e`__?\n\n.. code-block:: python3\n\n   return_values = await trimeter.run_all([\n       async_fn1,\n       async_fn2,\n       functools.partial(async_fn3, extra_arg, kwarg=\"yeah\"),\n   ])\n\nOf course, this takes all the same options as the other functions, so\nyou can control the degree of parallelism, use ``capture_outcome`` to\ncapture exceptions, and so forth.\n\nFor more details, see `the fine manual\n\u003chttps://trimeter.readthedocs.io\u003e`__.\n\n\nCan you summarize that in iambic trimeter?\n------------------------------------------\n\n`Iambic trimeter \u003chttps://en.wikipedia.org/wiki/Iambic_trimeter\u003e`__?\nNo problem:\n\n| Trimeter gives you tools\n| for running lots of tasks\n| to do your work real fast\n| but not so fast you crash.\n\n\nCode of conduct\n---------------\n\nContributors are requested to follow our `code of conduct\n\u003chttps://trio.readthedocs.io/en/latest/code-of-conduct.html\u003e`__ in all\nproject spaces.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-trio%2Ftrimeter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpython-trio%2Ftrimeter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-trio%2Ftrimeter/lists"}