fastapi-sqlmodel-starter


Namefastapi-sqlmodel-starter JSON
Version 1.1.1 PyPI version JSON
download
home_pagehttps://github.com/tyvekzhang/fastapi-sqlmodel-starter
SummaryFss aims to be one of the best scaffold in PyWeb.
upload_time2024-06-20 01:39:54
maintainertyvekZhang
docs_urlNone
authortyvekZhang
requires_python<4.0,>=3.9
licenseMIT
keywords fastapi sqlmodel tools web scaffold
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div  align="center" style="margin-top: 3%">
   <h1>
     FastAPI SQLModel Starter (Fss)
   </h1>
   <p>
     <img src="https://raw.githubusercontent.com/tyvekzhang/fastapi-sqlmodel-starter/main/docs/source/_static/img/fss.svg" alt="logo" style="vertical-align:middle; margin: 0.5%"/>
   </p>
   <p>
     <img alt="GitHub License" src="https://img.shields.io/github/license/tyvekzhang/fastapi-sqlmodel-starter">
     <img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/fastapi-sqlmodel-starter">
     <img alt="CI" src="https://github.com/tyvekzhang/fastapi-sqlmodel-starter/actions/workflows/ci.yaml/badge.svg">
     <img alt="Codecov" src="https://img.shields.io/codecov/c/github/tyvekzhang/fastapi-sqlmodel-starter">
     <img alt="Read the Docs" src="https://img.shields.io/readthedocs/fastapi-sqlmodel-starter">
   </p>
   <h4>
      <p>
        <b>简体中文</b> |
        <a href="https://github.com/tyvekzhang/fastapi-sqlmodel-starter/blob/main/docs/README_en.md">English</a>
     </p>
   </h4>
   <h3>
    PyWeb领域最好用的脚手架之一。
   </h3>
</div>


## 特性

- ⚡ 开箱即用, 完全实现中间件零依赖
   - 默认使用Sqlite, 也可自由切换PostgreSQL、MySQL
   - 默认使用文件缓存, 支持切换为Redis
- 🚢 开启Python操作数据库表结构的新体验
- 🚀 内置单表常见操作, 简化ORM操作
- 🎨 丰富插件机制
   - Jwt安全认证
   - 访问限流
   - Ip黑名单
- 🐋 完备容器化解决方案
  - Docker
  - Docker-compose
  - Kubernetes
- ✅ 基于GitHub Actions的CI (持续集成) 和 CD (持续交付)

## 文档
- 在线文档: [Read the docs](https://fastapi-sqlmodel-starter.readthedocs.io/en/latest/)
- 交互式API文档示意
  <img alt="API doc"  src="https://raw.githubusercontent.com/tyvekzhang/fastapi-sqlmodel-starter/main/docs/img/api_doc.png">

## 设置一个conda的虚拟环境
> 这部分是可选的,但可能对新学 Python 的用户有用。

通常来说, [虚拟环境](https://docs.python.org/3/glossary.html#term-virtual-environment)可以解决包冲突和多版本Python等问题, [conda](https://conda.io/en/latest/)是管理包和环境的一种选择. 在Linux上,可以从[这里](https://conda.io/en/latest/miniconda.html)下载Miniconda,
并按照说明进行安装。
```shell
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
```
设置镜像源
```shell
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes
```
创建带有Python 3.11(>=3.9)的Fss虚拟环境
```shell
conda create -n fss_py311 python==3.11 -y
```
激活虚拟环境
```shell
conda activate fss_py311
```
## 快速开始
1. 克隆代码
```shell
git clone https://github.com/tyvekzhang/fastapi-sqlmodel-starter
cd fastapi-sqlmodel-starter
```
2. 安装 Poetry并下载依赖
- 通过虚拟环境安装
  ```shell
  conda install poetry -y
  poetry install
  ```
- 或者通过pip安装, 首先要设置镜像源
  ```shell
  mkdir -p ~/.pip
  cat > ~/.pip/pip.conf << EOF
  [global]
  trusted-host = mirrors.aliyun.com
  index-url = http://mirrors.aliyun.com/pypi/simple/
  EOF

  pip install poetry
  poetry install
  ```
3. 数据库迁移
```shell
cd fss && alembic upgrade head
```
4. 启动
```shell
python apiserver.py
```
5. 交互式文档地址: http://127.0.0.1:9010/docs
6. 恭喜你, 运行成功. 接口访问前需创建用户, 并进行认证
7. 可以随时按CTRL+C停止运行

## 许可证

FastapiSqlmodelStarter 采用 [MIT 许可证](https://opensource.org/licenses/MIT)开源。

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tyvekzhang/fastapi-sqlmodel-starter",
    "name": "fastapi-sqlmodel-starter",
    "maintainer": "tyvekZhang",
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": "tyvekzhang@gmail.com",
    "keywords": "fastapi, sqlmodel, tools, web, scaffold",
    "author": "tyvekZhang",
    "author_email": "tyvekzhang@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5c/c8/374dfcca64b39dab4882eb8bd78ed50120e7a336a6ed1344e9948c57f5f9/fastapi_sqlmodel_starter-1.1.1.tar.gz",
    "platform": null,
    "description": "<div  align=\"center\" style=\"margin-top: 3%\">\n   <h1>\n     FastAPI SQLModel Starter (Fss)\n   </h1>\n   <p>\n     <img src=\"https://raw.githubusercontent.com/tyvekzhang/fastapi-sqlmodel-starter/main/docs/source/_static/img/fss.svg\" alt=\"logo\" style=\"vertical-align:middle; margin: 0.5%\"/>\n   </p>\n   <p>\n     <img alt=\"GitHub License\" src=\"https://img.shields.io/github/license/tyvekzhang/fastapi-sqlmodel-starter\">\n     <img alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/fastapi-sqlmodel-starter\">\n     <img alt=\"CI\" src=\"https://github.com/tyvekzhang/fastapi-sqlmodel-starter/actions/workflows/ci.yaml/badge.svg\">\n     <img alt=\"Codecov\" src=\"https://img.shields.io/codecov/c/github/tyvekzhang/fastapi-sqlmodel-starter\">\n     <img alt=\"Read the Docs\" src=\"https://img.shields.io/readthedocs/fastapi-sqlmodel-starter\">\n   </p>\n   <h4>\n      <p>\n        <b>\u7b80\u4f53\u4e2d\u6587</b> |\n        <a href=\"https://github.com/tyvekzhang/fastapi-sqlmodel-starter/blob/main/docs/README_en.md\">English</a>\n     </p>\n   </h4>\n   <h3>\n    PyWeb\u9886\u57df\u6700\u597d\u7528\u7684\u811a\u624b\u67b6\u4e4b\u4e00\u3002\n   </h3>\n</div>\n\n\n## \u7279\u6027\n\n- \u26a1 \u5f00\u7bb1\u5373\u7528, \u5b8c\u5168\u5b9e\u73b0\u4e2d\u95f4\u4ef6\u96f6\u4f9d\u8d56\n   - \u9ed8\u8ba4\u4f7f\u7528Sqlite, \u4e5f\u53ef\u81ea\u7531\u5207\u6362PostgreSQL\u3001MySQL\n   - \u9ed8\u8ba4\u4f7f\u7528\u6587\u4ef6\u7f13\u5b58, \u652f\u6301\u5207\u6362\u4e3aRedis\n- \ud83d\udea2 \u5f00\u542fPython\u64cd\u4f5c\u6570\u636e\u5e93\u8868\u7ed3\u6784\u7684\u65b0\u4f53\u9a8c\n- \ud83d\ude80 \u5185\u7f6e\u5355\u8868\u5e38\u89c1\u64cd\u4f5c, \u7b80\u5316ORM\u64cd\u4f5c\n- \ud83c\udfa8 \u4e30\u5bcc\u63d2\u4ef6\u673a\u5236\n   - Jwt\u5b89\u5168\u8ba4\u8bc1\n   - \u8bbf\u95ee\u9650\u6d41\n   - Ip\u9ed1\u540d\u5355\n- \ud83d\udc0b \u5b8c\u5907\u5bb9\u5668\u5316\u89e3\u51b3\u65b9\u6848\n  - Docker\n  - Docker-compose\n  - Kubernetes\n- \u2705 \u57fa\u4e8eGitHub Actions\u7684CI (\u6301\u7eed\u96c6\u6210) \u548c CD (\u6301\u7eed\u4ea4\u4ed8)\n\n## \u6587\u6863\n- \u5728\u7ebf\u6587\u6863: [Read the docs](https://fastapi-sqlmodel-starter.readthedocs.io/en/latest/)\n- \u4ea4\u4e92\u5f0fAPI\u6587\u6863\u793a\u610f\n  <img alt=\"API doc\"  src=\"https://raw.githubusercontent.com/tyvekzhang/fastapi-sqlmodel-starter/main/docs/img/api_doc.png\">\n\n## \u8bbe\u7f6e\u4e00\u4e2aconda\u7684\u865a\u62df\u73af\u5883\n> \u8fd9\u90e8\u5206\u662f\u53ef\u9009\u7684\uff0c\u4f46\u53ef\u80fd\u5bf9\u65b0\u5b66 Python \u7684\u7528\u6237\u6709\u7528\u3002\n\n\u901a\u5e38\u6765\u8bf4, [\u865a\u62df\u73af\u5883](https://docs.python.org/3/glossary.html#term-virtual-environment)\u53ef\u4ee5\u89e3\u51b3\u5305\u51b2\u7a81\u548c\u591a\u7248\u672cPython\u7b49\u95ee\u9898, [conda](https://conda.io/en/latest/)\u662f\u7ba1\u7406\u5305\u548c\u73af\u5883\u7684\u4e00\u79cd\u9009\u62e9. \u5728Linux\u4e0a,\u53ef\u4ee5\u4ece[\u8fd9\u91cc](https://conda.io/en/latest/miniconda.html)\u4e0b\u8f7dMiniconda,\n\u5e76\u6309\u7167\u8bf4\u660e\u8fdb\u884c\u5b89\u88c5\u3002\n```shell\nwget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh\nbash Miniconda3-latest-Linux-x86_64.sh\n```\n\u8bbe\u7f6e\u955c\u50cf\u6e90\n```shell\nconda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/\nconda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/\nconda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/\nconda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/\nconda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/\nconda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/\nconda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/\nconda config --set show_channel_urls yes\n```\n\u521b\u5efa\u5e26\u6709Python 3.11(>=3.9)\u7684Fss\u865a\u62df\u73af\u5883\n```shell\nconda create -n fss_py311 python==3.11 -y\n```\n\u6fc0\u6d3b\u865a\u62df\u73af\u5883\n```shell\nconda activate fss_py311\n```\n## \u5feb\u901f\u5f00\u59cb\n1. \u514b\u9686\u4ee3\u7801\n```shell\ngit clone https://github.com/tyvekzhang/fastapi-sqlmodel-starter\ncd fastapi-sqlmodel-starter\n```\n2. \u5b89\u88c5 Poetry\u5e76\u4e0b\u8f7d\u4f9d\u8d56\n- \u901a\u8fc7\u865a\u62df\u73af\u5883\u5b89\u88c5\n  ```shell\n  conda install poetry -y\n  poetry install\n  ```\n- \u6216\u8005\u901a\u8fc7pip\u5b89\u88c5, \u9996\u5148\u8981\u8bbe\u7f6e\u955c\u50cf\u6e90\n  ```shell\n  mkdir -p ~/.pip\n  cat > ~/.pip/pip.conf << EOF\n  [global]\n  trusted-host = mirrors.aliyun.com\n  index-url = http://mirrors.aliyun.com/pypi/simple/\n  EOF\n\n  pip install poetry\n  poetry install\n  ```\n3. \u6570\u636e\u5e93\u8fc1\u79fb\n```shell\ncd fss && alembic upgrade head\n```\n4. \u542f\u52a8\n```shell\npython apiserver.py\n```\n5. \u4ea4\u4e92\u5f0f\u6587\u6863\u5730\u5740: http://127.0.0.1:9010/docs\n6. \u606d\u559c\u4f60, \u8fd0\u884c\u6210\u529f. \u63a5\u53e3\u8bbf\u95ee\u524d\u9700\u521b\u5efa\u7528\u6237, \u5e76\u8fdb\u884c\u8ba4\u8bc1\n7. \u53ef\u4ee5\u968f\u65f6\u6309CTRL+C\u505c\u6b62\u8fd0\u884c\n\n## \u8bb8\u53ef\u8bc1\n\nFastapiSqlmodelStarter \u91c7\u7528 [MIT \u8bb8\u53ef\u8bc1](https://opensource.org/licenses/MIT)\u5f00\u6e90\u3002\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Fss aims to be one of the best scaffold in PyWeb.",
    "version": "1.1.1",
    "project_urls": {
        "Documentation": "https://github.com/tyvekzhang/fastapi-sqlmodel-starter/wiki",
        "Homepage": "https://github.com/tyvekzhang/fastapi-sqlmodel-starter",
        "Repository": "https://github.com/tyvekzhang/fastapi-sqlmodel-starter"
    },
    "split_keywords": [
        "fastapi",
        " sqlmodel",
        " tools",
        " web",
        " scaffold"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eb86f9299ea1a99a34d971b1872be754c6f4840b9d7a861b2e0c53fe183bc823",
                "md5": "61273c41b790d794a642cd6e3b519a8b",
                "sha256": "c678ede1c3b5737e49acbb03ad0c27e8c3a6661d245f62a6f4172a4bba8af968"
            },
            "downloads": -1,
            "filename": "fastapi_sqlmodel_starter-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "61273c41b790d794a642cd6e3b519a8b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 51006,
            "upload_time": "2024-06-20T01:39:52",
            "upload_time_iso_8601": "2024-06-20T01:39:52.205198Z",
            "url": "https://files.pythonhosted.org/packages/eb/86/f9299ea1a99a34d971b1872be754c6f4840b9d7a861b2e0c53fe183bc823/fastapi_sqlmodel_starter-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5cc8374dfcca64b39dab4882eb8bd78ed50120e7a336a6ed1344e9948c57f5f9",
                "md5": "c1274ff13ba5e6412a2961f50a6a0529",
                "sha256": "c24ad4d32bff0a2a44a49bb49be01df8b157715e378fe2b3a1c6c011e71b9714"
            },
            "downloads": -1,
            "filename": "fastapi_sqlmodel_starter-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c1274ff13ba5e6412a2961f50a6a0529",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 31543,
            "upload_time": "2024-06-20T01:39:54",
            "upload_time_iso_8601": "2024-06-20T01:39:54.170554Z",
            "url": "https://files.pythonhosted.org/packages/5c/c8/374dfcca64b39dab4882eb8bd78ed50120e7a336a6ed1344e9948c57f5f9/fastapi_sqlmodel_starter-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-20 01:39:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tyvekzhang",
    "github_project": "fastapi-sqlmodel-starter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "fastapi-sqlmodel-starter"
}
        
Elapsed time: 0.27448s