Skip to main content

An ID generator for distributed microservices

Project description

readme-template


Introduction

yzcore 目的为了开发后端服务时,提供一种代码结构规范参考。 可以通过startprojectstartapp两个命令快速创建工程和内部的接口应用模块。 安装模块

$ pip install yz-core

示例:

  • 创建工程:
$ yzcore startproject myproject
  • 创建工程内部应用:
$ yzcore startapp myapp ./src/apps/

代码结构介绍:

.
├── docs		        说明文档、接口文档等文档的存放目录
├── migrations		    数据表迁移文件存放目录
├── src
│   ├── apps 接口应用程序的主目录
│   │   ├── __init__.py
│   │   ├── myapp01
│   │   │   ├── __init__.py
│   │   │   ├── controllers.py  控制层:封装数据交互操作
│   │   │   ├── models.py       模型层:实现数据表与模型的定义
│   │   │   ├── schemas.py      模式层:定义接口数据参数
│   │   │   ├── tests.py        测试文件
│   │   │   └── views.py        视图层:接口定义层
│   │   └── myapp02
│   ├── conf		配置文件的存放目录
│   ├── const		公共常量存放目录
│   ├── tests		测试文件的存放目录
│   ├── main.py		程序的入口文件
│   ├── settings.py	程序的设置文件
│   └── utils		抽离出的公共代码模块存放目录
├── .gitignore
├── requirements.txt
└── README.md

Quick start

Quick Start 部分主要包括两部分内容:简易的安装部署说明(Deployment)和使用案例(Example)。特别是对于一些基础库,必须包括Example模块。

Documentation

Documentation 部分是核心的文档,对于大型项目可以使用超链接,如使用以下这种形式:

For the full story, head over to the documentation.

数据库迁移操作

# pip install alembic

alembic init migrations                             # 创建迁移环境
alembic revision --autogenerate -m "commit content" # 自动生成迁移文件
alembic upgrade head                                # 升级到最近版本
alembic upgrade <revision_id>                       # 升级到指定版本
alembic downgrade <revision_id>                     # 回退到指定版本

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yz-core-0.2.0.tar.gz (57.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yz_core-0.2.0-py3-none-any.whl (87.0 kB view details)

Uploaded Python 3

File details

Details for the file yz-core-0.2.0.tar.gz.

File metadata

  • Download URL: yz-core-0.2.0.tar.gz
  • Upload date:
  • Size: 57.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.5.0 pkginfo/1.8.2 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.9

File hashes

Hashes for yz-core-0.2.0.tar.gz
Algorithm Hash digest
SHA256 58f027e76ea332b9b0eefbf6fd62eb93ef4c3f94724404e1f59397e2cb269106
MD5 7a233703fafdd1240b6ea55c82521d64
BLAKE2b-256 afd21c4be320d5efba55d871a32418b918b46f0b6a77a8efb5c22a250e00552d

See more details on using hashes here.

File details

Details for the file yz_core-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: yz_core-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 87.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.5.0 pkginfo/1.8.2 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.9

File hashes

Hashes for yz_core-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b2d11b7b1678469c49aa0f2ef5837645e0c3c01ca9dd6bffbe3edcfc8c57ed3
MD5 a9236fb9cd6e9ff5b95caf170625eb93
BLAKE2b-256 b34d746ebaa803152fb77e723963a256588e44b1746c797574466e83fda35d04

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page