generated from Defelo/fastapi-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
137 lines (120 loc) · 3.44 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
[tool.poetry]
name = "jobs-ms"
version = "2.1.2"
description = ""
authors = ["Defelo <[email protected]>"]
readme = "README.md"
homepage = "https://github.com/Bootstrap-Academy/jobs-ms"
repository = "https://github.com/Bootstrap-Academy/jobs-ms"
packages = [{ include = "api" }]
include = ["pyproject.toml", "templates/*"]
[tool.poetry.dependencies]
python = "^3.11"
fastapi = "^0.108.0"
uvicorn = "^0.29.0"
aiohttp = "^3.9.5"
SQLAlchemy = "^1.4.42"
aiomysql = "^0.2.0"
asyncpg = "^0.29.0"
sentry-sdk = "^2.0.1"
pydantic = "^1.10.13"
httpx = "^0.27.0"
starlette = "^0.32.0"
alembic = "^1.13.1"
PyJWT = "^2.8.0"
redis = "^5.0.4"
[tool.poetry.group.dev.dependencies]
flake8 = "^7.0.0"
isort = "^5.13.2"
black = "^24.4.2"
wemake-python-styleguide = "^0.19.2"
mypy = "^1.10"
SQLAlchemy = { extras = ["mypy"], version = "^1.4.42" }
pytest = "^8.2.0"
coverage = "^7.5"
pytest-asyncio = "^0.23.6"
pytest-mock = "^3.14.0"
aiosqlite = "^0.20.0"
rich = "^13.7.1"
ruff = "^0.4.2"
[tool.poetry.scripts]
api = "api.main:main"
alembic = "alembic.config:main"
[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 ."
ruff = "ruff . --line-length 120"
lint = ["format", "ruff", "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 dev.env .env; fi
"""
interpreter = "bash"
[tool.black]
target-version = ["py311"]
line-length = 120
skip-magic-trailing-comma = true
[tool.isort]
profile = "black"
py_version = 311
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]
exclude_lines = ["if TYPE_CHECKING:", "if settings.debug:"]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"