generated from Defelo/fastapi-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pyproject.toml
140 lines (124 loc) · 3.48 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
[tool.poetry]
name = "fastapi-template"
version = "0"
description = ""
authors = ["Defelo <[email protected]>"]
readme = "README.md"
license = "GPL-3.0-only"
homepage = "https://github.com/Defelo/fastapi-template"
repository = "https://github.com/Defelo/fastapi-template"
packages = [{ include = "api" }]
[tool.poetry.dependencies]
python = "^3.10"
fastapi = "^0.84.0"
uvicorn = "^0.19.0"
aiohttp = "^3.8.3"
aioredis = "^2.0.1"
SQLAlchemy = "^1.4.42"
aiomysql = "^0.1.1"
asyncpg = "^0.26.0"
sentry-sdk = "^1.10.1"
pydantic = "^1.10.2"
httpx = "^0.23.0"
starlette = "^0.19.1"
alembic = "^1.8.1"
PyJWT = "^2.4.0"
annotated-types = "^0.7.0"
openai= "^0.28.0"
redis="*"
gitpython = "^3.1.43"
[tool.poetry.group.dev.dependencies]
flake8 = "^4.0.1"
isort = "^5.10.1"
black = "^22.8.0"
wemake-python-styleguide = "^0.16.1"
mypy = "^1.10"
SQLAlchemy = { extras = ["mypy"], version = "^1.4.42" }
pytest = "^7.1.3"
coverage = "^6.4"
pytest-asyncio = "^0.19.0"
pytest-mock = "^3.8.2"
aiosqlite = "^0.17.0"
rich = "^12.5.1"
[tool.poe.tasks]
api = { script = "api.main:main", envfile = ".env" }
flake8 = "flake8 . --count --statistics --show-source"
isort = "isort ."
black = "black ."
format = ["isort", "black"]
mypy = "mypy ."
lint = ["format", "mypy", "flake8"]
test = "pytest -v tests"
pre-commit = ["lint", "coverage"]
alembic = { cmd = "alembic", envfile = ".env" }
migrate = { cmd = "alembic upgrade head", envfile = ".env" }
env = { cmd = """python -c 'from api.settings import settings; from rich import print; print(settings)'""", envfile = ".env" }
jwt = { cmd = """python -c 'from api.utils import jwt; import sys, json; print(jwt.encode_jwt(json.loads(sys.argv[1]), jwt.timedelta(seconds=int(sys.argv[2]))))'""", envfile = ".env" }
[tool.poe.tasks.coverage]
shell = """
set -e
coverage run -m pytest -v tests
if [[ "$check" != True ]]; then fail="--fail-under=0"; fi
if ! coverage report $fail; then c=2; fi
if [[ "$xml" = True ]]; then coverage xml --fail-under=0; fi
if [[ "$html" = True ]]; then coverage html --fail-under=0 && xdg-open htmlcov/index.html; fi
if [[ "$clean" = True ]]; then coverage erase; fi
exit $c
"""
interpreter = "bash"
[tool.poe.tasks.coverage.args.xml]
options = ["--xml"]
type = "boolean"
[tool.poe.tasks.coverage.args.html]
options = ["--html"]
type = "boolean"
[tool.poe.tasks.coverage.args.clean]
options = ["--no-clean"]
type = "boolean"
default = true
[tool.poe.tasks.coverage.args.check]
options = ["--no-check"]
type = "boolean"
default = true
[tool.poe.tasks.setup]
shell = """
set -ex
poetry install --sync
if ! [[ -e .env ]]; then cp fastapi.env .env; fi
./pre-commit.sh install
unset VIRTUAL_ENV
git submodule update --init
git submodule foreach 'poe setup'
"""
interpreter = "bash"
[tool.black]
target-version = ["py310"]
line-length = 120
skip-magic-trailing-comma = true
[tool.isort]
profile = "black"
py_version = 310
line_length = 120
lines_after_imports = 2
reverse_relative = true
known_local_folder = ["api", "tests"]
sections = ["FUTURE", "STDLIB", "FIRSTPARTY", "THIRDPARTY", "LOCALFOLDER"]
[tool.mypy]
strict = true
ignore_missing_imports = true
plugins = ["sqlalchemy.ext.mypy.plugin"]
exclude = ['^alembic/env\.py$']
[tool.pytest.ini_options]
asyncio_mode = "auto"
markers = []
[tool.coverage.run]
branch = true
source = ["api"]
omit = ["api/__main__.py", "tests/*"]
concurrency = ["thread", "greenlet"]
[tool.coverage.report]
fail_under = 100
exclude_lines = ["if TYPE_CHECKING:", "if settings.debug:"]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"