AppZoo


NameAppZoo JSON
Version 2023.4.25.19.12.44 PyPI version JSON
download
home_pagehttps://github.com/yuanjie-ai/AppZoo
Summarydescription
upload_time2023-04-25 11:13:06
maintaineryuanjie
docs_urlNone
authoryuanjie
requires_python>=3.6
licenseMIT License
keywords utils
VCS
bugtrack_url
requirements meutils fastapi streamlit gradio uvicorn thriftpy2
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Downloads](http://pepy.tech/badge/AppZoo)](http://pepy.tech/project/AppZoo)
[![Open in Streamlit](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://share.streamlit.io/jie-yuan/appzoo/apps_streamlit/demo.py)

<h1 align = "center">:rocket: AppZoo :facepunch:</h1>

---



## Install
```bash
pip install -U appzoo
```
## Usage
- Rest Api
```python
import jieba
from appzoo import App

pred1 = lambda **kwargs: kwargs['x'] + kwargs['y']
pred2 = lambda x=1, y=1: x - y
pred3 = lambda text='小米是家不错的公司': jieba.lcut(text)

app = App(verbose=True)
app.add_route("/", pred1, result_key='result')
app.add_route("/f1", pred1, version="1")
app.add_route("/f2", pred2, version="2")
app.add_route("/f3", pred3, version="3")

app.run() # appcli easy-run ./apps
```

- 带缓存
```python
@lru_cache()
def post_func(kwargs: str):
    logger.info(kwargs)
    return kwargs


app.add_route_plus(post_func)
```

- Fast Api
```bash
app-run - fastapi demo.py
app-run - fastapi -- --help
```

- [Streamlit App](https://share.streamlit.io/jie-yuan/appzoo/apps_streamlit/demo.py)
```bash
app-run - streamlit demo.py
app-run - streamlit -- --help
```


---
## TODO
- add logger: 采样
- add scheduler
- add 监听服务
- add rpc服务
    - hive等穿透
- add thrift https://github.com/Thriftpy/thriftpy2
- add dataReport
- add plotly
- add explain
- add 限制次数 https://slowapi.readthedocs.io/en/latest/
---

对于RESTful API的URL具体设计的规范如下:
1.不用大写字母,所有单词使用英文且小写。
2.连字符用中杠"-“而不用下杠”_"
3.正确使用 “/“表示层级关系,URL的层级不要过深,并且越靠前的层级应该相对越稳定
4.结尾不要包含正斜杠分隔符”/”
5.URL中不出现动词,用请求方式表示动作
6.资源表示用复数不要用单数
7.不要使用文件扩展名

---
[FastAPI--依赖注入之Depends](https://blog.csdn.net/shykevin/article/details/106834526)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yuanjie-ai/AppZoo",
    "name": "AppZoo",
    "maintainer": "yuanjie",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "313303303@qq.com",
    "keywords": "utils",
    "author": "yuanjie",
    "author_email": "313303303@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/26/2e/ce3a1c68f0612f826db5992c38863e3cbaba1ed7fd1dad8908e0124a8cdf/AppZoo-2023.4.25.19.12.44.tar.gz",
    "platform": "all",
    "description": "[![Downloads](http://pepy.tech/badge/AppZoo)](http://pepy.tech/project/AppZoo)\n[![Open in Streamlit](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://share.streamlit.io/jie-yuan/appzoo/apps_streamlit/demo.py)\n\n<h1 align = \"center\">:rocket: AppZoo :facepunch:</h1>\n\n---\n\n\n\n## Install\n```bash\npip install -U appzoo\n```\n## Usage\n- Rest Api\n```python\nimport jieba\nfrom appzoo import App\n\npred1 = lambda **kwargs: kwargs['x'] + kwargs['y']\npred2 = lambda x=1, y=1: x - y\npred3 = lambda text='\u5c0f\u7c73\u662f\u5bb6\u4e0d\u9519\u7684\u516c\u53f8': jieba.lcut(text)\n\napp = App(verbose=True)\napp.add_route(\"/\", pred1, result_key='result')\napp.add_route(\"/f1\", pred1, version=\"1\")\napp.add_route(\"/f2\", pred2, version=\"2\")\napp.add_route(\"/f3\", pred3, version=\"3\")\n\napp.run() # appcli easy-run ./apps\n```\n\n- \u5e26\u7f13\u5b58\n```python\n@lru_cache()\ndef post_func(kwargs: str):\n    logger.info(kwargs)\n    return kwargs\n\n\napp.add_route_plus(post_func)\n```\n\n- Fast Api\n```bash\napp-run - fastapi demo.py\napp-run - fastapi -- --help\n```\n\n- [Streamlit App](https://share.streamlit.io/jie-yuan/appzoo/apps_streamlit/demo.py)\n```bash\napp-run - streamlit demo.py\napp-run - streamlit -- --help\n```\n\n\n---\n## TODO\n- add logger: \u91c7\u6837\n- add scheduler\n- add \u76d1\u542c\u670d\u52a1\n- add rpc\u670d\u52a1\n    - hive\u7b49\u7a7f\u900f\n- add thrift https://github.com/Thriftpy/thriftpy2\n- add dataReport\n- add plotly\n- add explain\n- add \u9650\u5236\u6b21\u6570 https://slowapi.readthedocs.io/en/latest/\n---\n\n\u5bf9\u4e8eRESTful API\u7684URL\u5177\u4f53\u8bbe\u8ba1\u7684\u89c4\u8303\u5982\u4e0b\uff1a\n1.\u4e0d\u7528\u5927\u5199\u5b57\u6bcd\uff0c\u6240\u6709\u5355\u8bcd\u4f7f\u7528\u82f1\u6587\u4e14\u5c0f\u5199\u3002\n2.\u8fde\u5b57\u7b26\u7528\u4e2d\u6760\"-\u201c\u800c\u4e0d\u7528\u4e0b\u6760\u201d_\"\n3.\u6b63\u786e\u4f7f\u7528 \u201c/\u201c\u8868\u793a\u5c42\u7ea7\u5173\u7cfb,URL\u7684\u5c42\u7ea7\u4e0d\u8981\u8fc7\u6df1\uff0c\u5e76\u4e14\u8d8a\u9760\u524d\u7684\u5c42\u7ea7\u5e94\u8be5\u76f8\u5bf9\u8d8a\u7a33\u5b9a\n4.\u7ed3\u5c3e\u4e0d\u8981\u5305\u542b\u6b63\u659c\u6760\u5206\u9694\u7b26\u201d/\u201d\n5.URL\u4e2d\u4e0d\u51fa\u73b0\u52a8\u8bcd\uff0c\u7528\u8bf7\u6c42\u65b9\u5f0f\u8868\u793a\u52a8\u4f5c\n6.\u8d44\u6e90\u8868\u793a\u7528\u590d\u6570\u4e0d\u8981\u7528\u5355\u6570\n7.\u4e0d\u8981\u4f7f\u7528\u6587\u4ef6\u6269\u5c55\u540d\n\n---\n[FastAPI--\u4f9d\u8d56\u6ce8\u5165\u4e4bDepends](https://blog.csdn.net/shykevin/article/details/106834526)\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "description",
    "version": "2023.4.25.19.12.44",
    "split_keywords": [
        "utils"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b11d2645c1d4d2a16cdbfb31cdc04f974cb5656ddbdcdfa6a59eba232d3a0934",
                "md5": "5b4619b61532235e064fcfebfff9a196",
                "sha256": "dfffe5d1fb5bd4f71108040fdfb5409d2f11ab8a730f3b303907746b51814f89"
            },
            "downloads": -1,
            "filename": "AppZoo-2023.4.25.19.12.44-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5b4619b61532235e064fcfebfff9a196",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6741468,
            "upload_time": "2023-04-25T11:12:56",
            "upload_time_iso_8601": "2023-04-25T11:12:56.537689Z",
            "url": "https://files.pythonhosted.org/packages/b1/1d/2645c1d4d2a16cdbfb31cdc04f974cb5656ddbdcdfa6a59eba232d3a0934/AppZoo-2023.4.25.19.12.44-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "262ece3a1c68f0612f826db5992c38863e3cbaba1ed7fd1dad8908e0124a8cdf",
                "md5": "4796bb03e700abe25de58de1924e5787",
                "sha256": "fcd44fbbca803e83e5393bf96e0f63a9abf32088fd68f2ed1de4a0f0a02908b2"
            },
            "downloads": -1,
            "filename": "AppZoo-2023.4.25.19.12.44.tar.gz",
            "has_sig": false,
            "md5_digest": "4796bb03e700abe25de58de1924e5787",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 6638063,
            "upload_time": "2023-04-25T11:13:06",
            "upload_time_iso_8601": "2023-04-25T11:13:06.670880Z",
            "url": "https://files.pythonhosted.org/packages/26/2e/ce3a1c68f0612f826db5992c38863e3cbaba1ed7fd1dad8908e0124a8cdf/AppZoo-2023.4.25.19.12.44.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-25 11:13:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "yuanjie-ai",
    "github_project": "AppZoo",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "meutils",
            "specs": []
        },
        {
            "name": "fastapi",
            "specs": []
        },
        {
            "name": "streamlit",
            "specs": []
        },
        {
            "name": "gradio",
            "specs": []
        },
        {
            "name": "uvicorn",
            "specs": []
        },
        {
            "name": "thriftpy2",
            "specs": []
        }
    ],
    "lcname": "appzoo"
}
        
Elapsed time: 0.07271s