{"id":13494175,"url":"https://github.com/gawel/aiocron","last_synced_at":"2025-05-14T19:10:10.397Z","repository":{"id":27678193,"uuid":"31164398","full_name":"gawel/aiocron","owner":"gawel","description":"Crontabs for asyncio","archived":false,"fork":false,"pushed_at":"2025-03-23T17:28:46.000Z","size":100,"stargazers_count":359,"open_issues_count":6,"forks_count":25,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-15T00:41:45.062Z","etag":null,"topics":["asyncio","cron","cronjob","python","python3"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gawel.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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":"2015-02-22T13:50:38.000Z","updated_at":"2025-04-12T19:20:33.000Z","dependencies_parsed_at":"2025-01-13T00:01:23.764Z","dependency_job_id":"8b028e8c-6cca-411b-ac64-a5895f94e6c5","html_url":"https://github.com/gawel/aiocron","commit_stats":{"total_commits":92,"total_committers":13,"mean_commits":7.076923076923077,"dds":"0.18478260869565222","last_synced_commit":"88994550126df5c791bd8c94b201b87f2f400b7a"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawel%2Faiocron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawel%2Faiocron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawel%2Faiocron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawel%2Faiocron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gawel","download_url":"https://codeload.github.com/gawel/aiocron/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254209859,"owners_count":22032897,"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","cron","cronjob","python","python3"],"created_at":"2024-07-31T19:01:22.595Z","updated_at":"2025-05-14T19:10:08.168Z","avatar_url":"https://github.com/gawel.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"================================================\naiocron - Crontabs for asyncio\n================================================\n\n\n.. image:: https://img.shields.io/pypi/v/aiocron.svg\n  :target: https://pypi.python.org/pypi/aiocron\n.. image:: https://img.shields.io/pypi/dm/aiocron.svg\n  :target: https://pypi.python.org/pypi/aiocron\n\nUsage\n=====\n\n``aiocron`` provide a decorator to run function at time::\n\n    \u003e\u003e\u003e import aiocron\n    \u003e\u003e\u003e import asyncio\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e @aiocron.crontab('*/30 * * * *')\n    ... async def attime():\n    ...     print('run')\n    ...\n    \u003e\u003e\u003e asyncio.get_event_loop().run_forever()\n\nYou can also use it as an object::\n\n    \u003e\u003e\u003e @aiocron.crontab('1 9 * * 1-5', start=False)\n    ... async def attime():\n    ...     print('run')\n    ...\n    \u003e\u003e\u003e attime.start()\n    \u003e\u003e\u003e asyncio.get_event_loop().run_forever()\n\nYour function still be available at ``attime.func``\n\nYou can also await a crontab. In this case, your coroutine can accept\narguments::\n\n    \u003e\u003e\u003e @aiocron.crontab('0 9,10 * * * mon,fri', start=False)\n    ... async def attime(i):\n    ...     print('run %i' % i)\n    ...\n    \u003e\u003e\u003e async def once():\n    ...     try:\n    ...         res = await attime.next(1)\n    ...     except Exception as e:\n    ...         print('It failed (%r)' % e)\n    ...     else:\n    ...         print(res)\n    ...\n    \u003e\u003e\u003e asyncio.get_event_loop().run_forever()\n\nFinally you can use it as a sleep coroutine. The following will wait until\nnext hour::\n\n    \u003e\u003e\u003e await crontab('0 * * * *').next()\n\nIf you don't like the decorator magic you can set the function by yourself::\n\n    \u003e\u003e\u003e cron = crontab('0 * * * *', func=yourcoroutine, start=False)\n\n``aiocron`` use `cronsim \u003chttps://github.com/cuu508/cronsim\u003e`_. Refer to\nit's documentation to know more about crontab format.\n\nFrom Dec 31, 2024, ``aiocron`` has switched from ``croniter`` to ``cronsim``\nfor cron expression parsing (`PR #39 \u003chttps://github.com/gawel/aiocron/pull/39\u003e`_). \nPlease ensure that your cron expressions are valid in ``cronsim``. For a comparison of \nfeatures between ``croniter`` and ``cronsim``, refer to \n`cronsim documentation \u003chttps://github.com/cuu508/cronsim?tab=readme-ov-file#cron-expression-feature-matrix\u003e`_.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgawel%2Faiocron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgawel%2Faiocron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgawel%2Faiocron/lists"}