aslooper


Nameaslooper JSON
Version 1.2.1 PyPI version JSON
download
home_pagehttps://vastxiao.github.io/
Summarylooper-佛跳墙活套:捕获asyncio报错。
upload_time2023-06-15 14:53:47
maintainer
docs_urlNone
authorvastxiao
requires_python>=3.11
licenseMIT
keywords async asyncio loop
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # aslooper

> looper
> Used to cancel all running tasks after catching SIGINT, SIGTERM signals,
> Quit running without raise asyncio cancelled error.

## use looper

```python
import asyncio
from aslooper import looper


async def run(i):
    while True:
        print(f"{i} running.")
        await asyncio.sleep(1)


@looper()
async def main():
    tasks = [run(i) for i in range(3)]
    await asyncio.gather(*tasks)


asyncio.run(main())
```

## run with a call

```python
import asyncio
from aslooper import looper


async def run(i):
    while True:
        print(f"{i} running.")
        await asyncio.sleep(1)


def some_call():
    print("some_call")


@looper(some_call)
async def main():
    while True:
        print("run something.")
        await asyncio.sleep(1)


asyncio.run(main())
```
            

Raw data

            {
    "_id": null,
    "home_page": "https://vastxiao.github.io/",
    "name": "aslooper",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "keywords": "async,asyncio,loop",
    "author": "vastxiao",
    "author_email": "vastxiao@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ea/f4/d11ea848cc373f2203d2fc2cdf262754703f048a51d05072c00ce9ce0dd0/aslooper-1.2.1.tar.gz",
    "platform": null,
    "description": "# aslooper\n\n> looper\n> Used to cancel all running tasks after catching SIGINT, SIGTERM signals,\n> Quit running without raise asyncio cancelled error.\n\n## use looper\n\n```python\nimport asyncio\nfrom aslooper import looper\n\n\nasync def run(i):\n    while True:\n        print(f\"{i} running.\")\n        await asyncio.sleep(1)\n\n\n@looper()\nasync def main():\n    tasks = [run(i) for i in range(3)]\n    await asyncio.gather(*tasks)\n\n\nasyncio.run(main())\n```\n\n## run with a call\n\n```python\nimport asyncio\nfrom aslooper import looper\n\n\nasync def run(i):\n    while True:\n        print(f\"{i} running.\")\n        await asyncio.sleep(1)\n\n\ndef some_call():\n    print(\"some_call\")\n\n\n@looper(some_call)\nasync def main():\n    while True:\n        print(\"run something.\")\n        await asyncio.sleep(1)\n\n\nasyncio.run(main())\n```",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "looper-\u4f5b\u8df3\u5899\u6d3b\u5957\uff1a\u6355\u83b7asyncio\u62a5\u9519\u3002",
    "version": "1.2.1",
    "project_urls": {
        "Homepage": "https://vastxiao.github.io/"
    },
    "split_keywords": [
        "async",
        "asyncio",
        "loop"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "453f7dabe4952bc4f9b2c107b94ac6026a1435fcb8645fddc230e0f83a99dbf1",
                "md5": "8658901311cd2554b5c5444c5e4e3947",
                "sha256": "282c26e34195fae5635ab0d1866eeae948be0390e794f01917ea011431be22a1"
            },
            "downloads": -1,
            "filename": "aslooper-1.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8658901311cd2554b5c5444c5e4e3947",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 4705,
            "upload_time": "2023-06-15T14:53:45",
            "upload_time_iso_8601": "2023-06-15T14:53:45.892536Z",
            "url": "https://files.pythonhosted.org/packages/45/3f/7dabe4952bc4f9b2c107b94ac6026a1435fcb8645fddc230e0f83a99dbf1/aslooper-1.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eaf4d11ea848cc373f2203d2fc2cdf262754703f048a51d05072c00ce9ce0dd0",
                "md5": "0240632bf51ff719458a0e648677c8e6",
                "sha256": "5f359255f4ec3537d6133da284fba856b0455d473ba9153646bf58b328fd2271"
            },
            "downloads": -1,
            "filename": "aslooper-1.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0240632bf51ff719458a0e648677c8e6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 3865,
            "upload_time": "2023-06-15T14:53:47",
            "upload_time_iso_8601": "2023-06-15T14:53:47.747950Z",
            "url": "https://files.pythonhosted.org/packages/ea/f4/d11ea848cc373f2203d2fc2cdf262754703f048a51d05072c00ce9ce0dd0/aslooper-1.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-15 14:53:47",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "aslooper"
}
        
Elapsed time: 0.07999s