hagworm


Namehagworm JSON
Version 5.9.84 PyPI version JSON
download
home_pagehttps://gitee.com/wsb310/hagworm
SummaryNetwork Development Suite
upload_time2024-12-09 03:27:16
maintainerNone
docs_urlNone
authorShaobo.Wang
requires_python>=3.10
licenseApache License Version 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Hagworm

![](https://img.shields.io/pypi/v/hagworm.svg)
![](https://img.shields.io/pypi/format/hagworm.svg)
![](https://img.shields.io/pypi/implementation/hagworm.svg)
![](https://img.shields.io/pypi/pyversions/hagworm.svg)



## 快速开始



### 1. 下载

```bash
git clone git@gitee.com:wsb310/hagworm.git
```



### 2. 安装

```bash
pip install hagworm
```



### 3. 设计定位

* Hagworm是原生框架、原生库的中间层,对它们进行了更高层次的抽象,用来屏蔽直接的调用,达到不改变使用习惯的情况下可以随意更换框架或库。
* Hagworm整合了它支持的各种框架和库,使它们成为一个整体,屏蔽了底层细节,简化了使用方式。
* Hagworm提供了一个打包的环境,建立了工程质量的底线,开发者只需要关注业务逻辑本身,不需要再关注底层的性能和安全等问题。

```mermaid
graph LR
原生框架-->Hagworm
原生库-->Hagworm
Hagworm-->业务代码
```



### 5. 代码树结构

```text
├── extend
│    ├── base.py                                基础工具
│    ├── cache.py                               缓存相关
│    ├── compile.py                             pyc编译
│    ├── config.py                              配置相关
│    ├── crypto.py                              加解密相关
│    ├── error.py                               错误定义
│    ├── event.py                               事件总线
│    ├── igraph.py                              内存图引擎
│    ├── interface.py                           接口定义
│    ├── logging.py                             日志相关
│    ├── media.py                               媒体相关
│    ├── metaclass.py                           元类相关
│    ├── process.py                             多进程工具
│    ├── qrcode.py                              二维码工具
│    ├── struct.py                              数据结构
│    ├── text.py                                文本相关
│    ├── trace.py                               调试及跟踪
│    ├── transaction.py                         事务抽象
│    ├── validator.py                           通用验证器
│    └── asyncio
│         ├── base.py                           异步工具库
│         ├── buffer.py                         缓冲相关
│         ├── command.py                        命令行相关
│         ├── event.py                          分布式事件总线
│         ├── file.py                           文件读写相关
│         ├── future.py                         协程相关
│         ├── mail.py                           邮件工具
│         ├── mongo.py                          MongoDB工具
│         ├── mysql.py                          MySQL工具
│         ├── net.py                            网络工具
│         ├── ntp.py                            时间同步
│         ├── pool.py                           对象池抽象
│         ├── redis.py                          Redis工具
│         ├── socket.py                         Socket封装
│         ├── task.py                           任务相关
│         └── transaction.py                    事务抽象
│
├── frame
│    └── fastapi
│    │    ├── base.py                           基础工具
│    │    ├── field.py                          表单验证器
│    │    ├── model.py                          表单相关
│    │    └── response.py                       响应数据结构
│    └── gunicorn.py                            gunicorn相关
│    └── stress_tests.py                        压力测试工具
│
└── third
     ├── grpc
     │    ├── client.py                         客户端封装
     │    └── server.py                         服务端封装
     ├── nacos
     │    ├── client.py                         服务发现
     │    └── config.py                         配置中心
     └── rabbitmq
          ├── consume.py                        消费者封装
          ├── publish.py                        生产者封装
          └── rpc.py                            远程调用封装
```



### 6. 重要提示

* 不要在非异步魔术方法中调用异步函数,例如在__del__中调用异步函数,在该函数结束前,对象一直处于析构中的状态,此时弱引用是有效的,但如果此时另外一个线程或者协程通过弱引用去使用它,然后意外就可能发生了
* 使用contextvars库时,要注意使用asyncio的call_soon、call_soon_threadsafe、call_later和call_at函数时(建议使用hagworm.extend.asyncio.base.Utils提供的函数),其中的context参数,必须给出独立的contextvars.Context对象,使其上下文环境独立,否则会出现伪内存泄漏现象



### 7. 关于本项目

* 请遵守开源协议,并保留作者信息
* 本项目任何版本不保证没有BUG,商业使用请自行承担风险
* 如果有任何问题,欢迎与我联系,邮箱wsb310@gmail.com,微信号wsb310



### 8. 特别鸣谢

* 洪仁

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitee.com/wsb310/hagworm",
    "name": "hagworm",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Shaobo.Wang",
    "author_email": "wsb310@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/23/04/86302ff8c72215131fbd8d06a387cd2c90dc3687f982889de928a83e8df8/hagworm-5.9.84.tar.gz",
    "platform": "all",
    "description": "# Hagworm\n\n![](https://img.shields.io/pypi/v/hagworm.svg)\n![](https://img.shields.io/pypi/format/hagworm.svg)\n![](https://img.shields.io/pypi/implementation/hagworm.svg)\n![](https://img.shields.io/pypi/pyversions/hagworm.svg)\n\n\n\n## \u5feb\u901f\u5f00\u59cb\n\n\n\n### 1. \u4e0b\u8f7d\n\n```bash\ngit clone git@gitee.com:wsb310/hagworm.git\n```\n\n\n\n### 2. \u5b89\u88c5\n\n```bash\npip install hagworm\n```\n\n\n\n### 3. \u8bbe\u8ba1\u5b9a\u4f4d\n\n* Hagworm\u662f\u539f\u751f\u6846\u67b6\u3001\u539f\u751f\u5e93\u7684\u4e2d\u95f4\u5c42\uff0c\u5bf9\u5b83\u4eec\u8fdb\u884c\u4e86\u66f4\u9ad8\u5c42\u6b21\u7684\u62bd\u8c61\uff0c\u7528\u6765\u5c4f\u853d\u76f4\u63a5\u7684\u8c03\u7528\uff0c\u8fbe\u5230\u4e0d\u6539\u53d8\u4f7f\u7528\u4e60\u60ef\u7684\u60c5\u51b5\u4e0b\u53ef\u4ee5\u968f\u610f\u66f4\u6362\u6846\u67b6\u6216\u5e93\u3002\n* Hagworm\u6574\u5408\u4e86\u5b83\u652f\u6301\u7684\u5404\u79cd\u6846\u67b6\u548c\u5e93\uff0c\u4f7f\u5b83\u4eec\u6210\u4e3a\u4e00\u4e2a\u6574\u4f53\uff0c\u5c4f\u853d\u4e86\u5e95\u5c42\u7ec6\u8282\uff0c\u7b80\u5316\u4e86\u4f7f\u7528\u65b9\u5f0f\u3002\n* Hagworm\u63d0\u4f9b\u4e86\u4e00\u4e2a\u6253\u5305\u7684\u73af\u5883\uff0c\u5efa\u7acb\u4e86\u5de5\u7a0b\u8d28\u91cf\u7684\u5e95\u7ebf\uff0c\u5f00\u53d1\u8005\u53ea\u9700\u8981\u5173\u6ce8\u4e1a\u52a1\u903b\u8f91\u672c\u8eab\uff0c\u4e0d\u9700\u8981\u518d\u5173\u6ce8\u5e95\u5c42\u7684\u6027\u80fd\u548c\u5b89\u5168\u7b49\u95ee\u9898\u3002\n\n```mermaid\ngraph LR\n\u539f\u751f\u6846\u67b6-->Hagworm\n\u539f\u751f\u5e93-->Hagworm\nHagworm-->\u4e1a\u52a1\u4ee3\u7801\n```\n\n\n\n### 5. \u4ee3\u7801\u6811\u7ed3\u6784\n\n```text\n\u251c\u2500\u2500 extend\n\u2502    \u251c\u2500\u2500 base.py                                \u57fa\u7840\u5de5\u5177\n\u2502    \u251c\u2500\u2500 cache.py                               \u7f13\u5b58\u76f8\u5173\n\u2502    \u251c\u2500\u2500 compile.py                             pyc\u7f16\u8bd1\n\u2502    \u251c\u2500\u2500 config.py                              \u914d\u7f6e\u76f8\u5173\n\u2502    \u251c\u2500\u2500 crypto.py                              \u52a0\u89e3\u5bc6\u76f8\u5173\n\u2502    \u251c\u2500\u2500 error.py                               \u9519\u8bef\u5b9a\u4e49\n\u2502    \u251c\u2500\u2500 event.py                               \u4e8b\u4ef6\u603b\u7ebf\n\u2502    \u251c\u2500\u2500 igraph.py                              \u5185\u5b58\u56fe\u5f15\u64ce\n\u2502    \u251c\u2500\u2500 interface.py                           \u63a5\u53e3\u5b9a\u4e49\n\u2502    \u251c\u2500\u2500 logging.py                             \u65e5\u5fd7\u76f8\u5173\n\u2502    \u251c\u2500\u2500 media.py                               \u5a92\u4f53\u76f8\u5173\n\u2502    \u251c\u2500\u2500 metaclass.py                           \u5143\u7c7b\u76f8\u5173\n\u2502    \u251c\u2500\u2500 process.py                             \u591a\u8fdb\u7a0b\u5de5\u5177\n\u2502    \u251c\u2500\u2500 qrcode.py                              \u4e8c\u7ef4\u7801\u5de5\u5177\n\u2502    \u251c\u2500\u2500 struct.py                              \u6570\u636e\u7ed3\u6784\n\u2502    \u251c\u2500\u2500 text.py                                \u6587\u672c\u76f8\u5173\n\u2502    \u251c\u2500\u2500 trace.py                               \u8c03\u8bd5\u53ca\u8ddf\u8e2a\n\u2502    \u251c\u2500\u2500 transaction.py                         \u4e8b\u52a1\u62bd\u8c61\n\u2502    \u251c\u2500\u2500 validator.py                           \u901a\u7528\u9a8c\u8bc1\u5668\n\u2502    \u2514\u2500\u2500 asyncio\n\u2502         \u251c\u2500\u2500 base.py                           \u5f02\u6b65\u5de5\u5177\u5e93\n\u2502         \u251c\u2500\u2500 buffer.py                         \u7f13\u51b2\u76f8\u5173\n\u2502         \u251c\u2500\u2500 command.py                        \u547d\u4ee4\u884c\u76f8\u5173\n\u2502         \u251c\u2500\u2500 event.py                          \u5206\u5e03\u5f0f\u4e8b\u4ef6\u603b\u7ebf\n\u2502         \u251c\u2500\u2500 file.py                           \u6587\u4ef6\u8bfb\u5199\u76f8\u5173\n\u2502         \u251c\u2500\u2500 future.py                         \u534f\u7a0b\u76f8\u5173\n\u2502         \u251c\u2500\u2500 mail.py                           \u90ae\u4ef6\u5de5\u5177\n\u2502         \u251c\u2500\u2500 mongo.py                          MongoDB\u5de5\u5177\n\u2502         \u251c\u2500\u2500 mysql.py                          MySQL\u5de5\u5177\n\u2502         \u251c\u2500\u2500 net.py                            \u7f51\u7edc\u5de5\u5177\n\u2502         \u251c\u2500\u2500 ntp.py                            \u65f6\u95f4\u540c\u6b65\n\u2502         \u251c\u2500\u2500 pool.py                           \u5bf9\u8c61\u6c60\u62bd\u8c61\n\u2502         \u251c\u2500\u2500 redis.py                          Redis\u5de5\u5177\n\u2502         \u251c\u2500\u2500 socket.py                         Socket\u5c01\u88c5\n\u2502         \u251c\u2500\u2500 task.py                           \u4efb\u52a1\u76f8\u5173\n\u2502         \u2514\u2500\u2500 transaction.py                    \u4e8b\u52a1\u62bd\u8c61\n\u2502\n\u251c\u2500\u2500 frame\n\u2502    \u2514\u2500\u2500 fastapi\n\u2502    \u2502    \u251c\u2500\u2500 base.py                           \u57fa\u7840\u5de5\u5177\n\u2502    \u2502    \u251c\u2500\u2500 field.py                          \u8868\u5355\u9a8c\u8bc1\u5668\n\u2502    \u2502    \u251c\u2500\u2500 model.py                          \u8868\u5355\u76f8\u5173\n\u2502    \u2502    \u2514\u2500\u2500 response.py                       \u54cd\u5e94\u6570\u636e\u7ed3\u6784\n\u2502    \u2514\u2500\u2500 gunicorn.py                            gunicorn\u76f8\u5173\n\u2502    \u2514\u2500\u2500 stress_tests.py                        \u538b\u529b\u6d4b\u8bd5\u5de5\u5177\n\u2502\n\u2514\u2500\u2500 third\n     \u251c\u2500\u2500 grpc\n     \u2502    \u251c\u2500\u2500 client.py                         \u5ba2\u6237\u7aef\u5c01\u88c5\n     \u2502    \u2514\u2500\u2500 server.py                         \u670d\u52a1\u7aef\u5c01\u88c5\n     \u251c\u2500\u2500 nacos\n     \u2502    \u251c\u2500\u2500 client.py                         \u670d\u52a1\u53d1\u73b0\n     \u2502    \u2514\u2500\u2500 config.py                         \u914d\u7f6e\u4e2d\u5fc3\n     \u2514\u2500\u2500 rabbitmq\n          \u251c\u2500\u2500 consume.py                        \u6d88\u8d39\u8005\u5c01\u88c5\n          \u251c\u2500\u2500 publish.py                        \u751f\u4ea7\u8005\u5c01\u88c5\n          \u2514\u2500\u2500 rpc.py                            \u8fdc\u7a0b\u8c03\u7528\u5c01\u88c5\n```\n\n\n\n### 6. \u91cd\u8981\u63d0\u793a\n\n* \u4e0d\u8981\u5728\u975e\u5f02\u6b65\u9b54\u672f\u65b9\u6cd5\u4e2d\u8c03\u7528\u5f02\u6b65\u51fd\u6570\uff0c\u4f8b\u5982\u5728__del__\u4e2d\u8c03\u7528\u5f02\u6b65\u51fd\u6570\uff0c\u5728\u8be5\u51fd\u6570\u7ed3\u675f\u524d\uff0c\u5bf9\u8c61\u4e00\u76f4\u5904\u4e8e\u6790\u6784\u4e2d\u7684\u72b6\u6001\uff0c\u6b64\u65f6\u5f31\u5f15\u7528\u662f\u6709\u6548\u7684\uff0c\u4f46\u5982\u679c\u6b64\u65f6\u53e6\u5916\u4e00\u4e2a\u7ebf\u7a0b\u6216\u8005\u534f\u7a0b\u901a\u8fc7\u5f31\u5f15\u7528\u53bb\u4f7f\u7528\u5b83\uff0c\u7136\u540e\u610f\u5916\u5c31\u53ef\u80fd\u53d1\u751f\u4e86\n* \u4f7f\u7528contextvars\u5e93\u65f6\uff0c\u8981\u6ce8\u610f\u4f7f\u7528asyncio\u7684call_soon\u3001call_soon_threadsafe\u3001call_later\u548ccall_at\u51fd\u6570\u65f6\uff08\u5efa\u8bae\u4f7f\u7528hagworm.extend.asyncio.base.Utils\u63d0\u4f9b\u7684\u51fd\u6570\uff09\uff0c\u5176\u4e2d\u7684context\u53c2\u6570\uff0c\u5fc5\u987b\u7ed9\u51fa\u72ec\u7acb\u7684contextvars.Context\u5bf9\u8c61\uff0c\u4f7f\u5176\u4e0a\u4e0b\u6587\u73af\u5883\u72ec\u7acb\uff0c\u5426\u5219\u4f1a\u51fa\u73b0\u4f2a\u5185\u5b58\u6cc4\u6f0f\u73b0\u8c61\n\n\n\n### 7. \u5173\u4e8e\u672c\u9879\u76ee\n\n* \u8bf7\u9075\u5b88\u5f00\u6e90\u534f\u8bae\uff0c\u5e76\u4fdd\u7559\u4f5c\u8005\u4fe1\u606f\n* \u672c\u9879\u76ee\u4efb\u4f55\u7248\u672c\u4e0d\u4fdd\u8bc1\u6ca1\u6709BUG\uff0c\u5546\u4e1a\u4f7f\u7528\u8bf7\u81ea\u884c\u627f\u62c5\u98ce\u9669\n* \u5982\u679c\u6709\u4efb\u4f55\u95ee\u9898\uff0c\u6b22\u8fce\u4e0e\u6211\u8054\u7cfb\uff0c\u90ae\u7bb1wsb310@gmail.com\uff0c\u5fae\u4fe1\u53f7wsb310\n\n\n\n### 8. \u7279\u522b\u9e23\u8c22\n\n* \u6d2a\u4ec1\n",
    "bugtrack_url": null,
    "license": "Apache License Version 2.0",
    "summary": "Network Development Suite",
    "version": "5.9.84",
    "project_urls": {
        "Homepage": "https://gitee.com/wsb310/hagworm"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "230486302ff8c72215131fbd8d06a387cd2c90dc3687f982889de928a83e8df8",
                "md5": "3c2f2e2c2f1d7e8aeff4964349520c18",
                "sha256": "065a4df9ec4d8e6e347fedbc0a993033c70c47c147398e61bcd5d4920e0dca6a"
            },
            "downloads": -1,
            "filename": "hagworm-5.9.84.tar.gz",
            "has_sig": false,
            "md5_digest": "3c2f2e2c2f1d7e8aeff4964349520c18",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 1143260,
            "upload_time": "2024-12-09T03:27:16",
            "upload_time_iso_8601": "2024-12-09T03:27:16.767214Z",
            "url": "https://files.pythonhosted.org/packages/23/04/86302ff8c72215131fbd8d06a387cd2c90dc3687f982889de928a83e8df8/hagworm-5.9.84.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-09 03:27:16",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "hagworm"
}
        
Elapsed time: 0.40526s