Skip to content

Commit 5540ffc

Browse files
authored
Dependencies update. (#212)
1 parent 63d7f21 commit 5540ffc

20 files changed

Lines changed: 170 additions & 256 deletions

File tree

‎fastapi_template/cli.py‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def checker(ctx: BuilderContext) -> bool:
158158
),
159159
additional_info=Database(
160160
name="mysql",
161-
image="bitnami/mysql:8.0.30",
161+
image="mysql:8.4",
162162
async_driver="mysql+aiomysql",
163163
driver_short="mysql",
164164
driver="mysql",
@@ -178,7 +178,7 @@ def checker(ctx: BuilderContext) -> bool:
178178
),
179179
additional_info=Database(
180180
name="postgresql",
181-
image="postgres:13.8-bullseye",
181+
image="postgres:16.3-bullseye",
182182
async_driver="postgresql+asyncpg",
183183
driver_short="postgres",
184184
driver="postgresql",
@@ -274,7 +274,6 @@ def checker(ctx: BuilderContext) -> bool:
274274
code="ormar",
275275
user_view="Ormar",
276276
is_hidden=check_db(["sqlite", "mysql", "postgresql"]),
277-
pydantic_v1=True,
278277
description=(
279278
"{what} is a great {feature} ORM.\n"
280279
"It's compatible with pydantic models and alembic migrator.".format(
@@ -354,12 +353,6 @@ def checker(ctx: BuilderContext) -> bool:
354353
multiselect=True,
355354
before_ask=do_not_ask_features_if_quiet,
356355
entries=[
357-
MenuEntry(
358-
code="pydanticv1",
359-
cli_name="pydantic-v1",
360-
user_view="Use older version of pydantic",
361-
description="Use pydantic version ^1 instead of ^2",
362-
),
363356
MenuEntry(
364357
code="enable_redis",
365358
cli_name="redis",

‎fastapi_template/input_model.py‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class MenuEntry(BaseModel):
2929
description: str
3030
is_hidden: Optional[Callable[["BuilderContext"], bool]] = None
3131
additional_info: Any = None
32-
pydantic_v1: bool = False
3332

3433
@property
3534
def generated_name(self) -> str:
@@ -159,8 +158,6 @@ def ask(self, context: "BuilderContext") -> Optional["BuilderContext"]:
159158
return
160159

161160
setattr(context, self.code, chosen_entry.code)
162-
if chosen_entry.pydantic_v1:
163-
context.pydanticv1 = True
164161

165162
return context
166163

@@ -240,10 +237,6 @@ def ask(self, context: "BuilderContext") -> Optional["BuilderContext"]:
240237
for entry in chosen_entries:
241238
setattr(context, entry.code, True)
242239

243-
for ch_entry in chosen_entries:
244-
if ch_entry.pydantic_v1:
245-
context.pydanticv1 = True
246-
247240
return context
248241

249242

‎fastapi_template/template/cookiecutter.json‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@
5959
"otlp_enabled": {
6060
"type": "bool"
6161
},
62-
"pydanticv1": {
63-
"type": "bool"
64-
},
6562
"gunicorn": {
6663
"type": "bool"
6764
},

‎fastapi_template/template/{{cookiecutter.project_name}}/.github/workflows/tests.yml‎

Lines changed: 15 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,24 @@ name: Testing {{cookiecutter.project_name}}
33
on: push
44

55
jobs:
6-
black:
6+
lint:
7+
strategy:
8+
matrix:
9+
cmd:
10+
- black
11+
- ruff
12+
- mypy
713
runs-on: ubuntu-latest
814
steps:
9-
- uses: actions/checkout@v2
10-
- name: Set up Python
11-
uses: actions/setup-python@v2
12-
with:
13-
python-version: '3.9'
14-
- name: Install deps
15-
uses: knowsuchagency/poetry-install@v1
16-
env:
17-
POETRY_VIRTUALENVS_CREATE: false
18-
- name: Run black check
19-
run: poetry run black --check .
20-
flake8:
21-
runs-on: ubuntu-latest
22-
steps:
23-
- uses: actions/checkout@v2
24-
- name: Set up Python
25-
uses: actions/setup-python@v2
26-
with:
27-
python-version: '3.9'
28-
- name: Install deps
29-
uses: knowsuchagency/poetry-install@v1
30-
env:
31-
POETRY_VIRTUALENVS_CREATE: false
32-
- name: Run flake8 check
33-
run: poetry run flake8 --count .
34-
mypy:
35-
runs-on: ubuntu-latest
36-
steps:
37-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
3816
- name: Set up Python
39-
uses: actions/setup-python@v2
17+
uses: actions/setup-python@v5
4018
with:
41-
python-version: '3.9'
19+
python-version: '3.11'
4220
- name: Install deps
43-
uses: knowsuchagency/poetry-install@v1
44-
env:
45-
POETRY_VIRTUALENVS_CREATE: false
46-
- name: Run mypy check
47-
run: poetry run mypy .
21+
run: poetry install
22+
- name: Run lint check
23+
run: poetry run pre-commit run -a {{ '${{' }} matrix.cmd {{ '}}' }}
4824
pytest:
4925
runs-on: ubuntu-latest
5026
{%- if ((cookiecutter.db_info.name != "none" and cookiecutter.db_info.name != "sqlite") or
@@ -63,17 +39,16 @@ jobs:
6339
{%- endif %}
6440
{%- if cookiecutter.db_info.name == "mysql" %}
6541
MYSQL_ROOT_PASSWORD: "{{ cookiecutter.project_name }}"
66-
MYSQL_ROOT_USER: "{{ cookiecutter.project_name }}"
42+
MYSQL_USER: "{{ cookiecutter.project_name }}"
6743
MYSQL_DATABASE: "{{ cookiecutter.project_name }}"
68-
MYSQL_AUTHENTICATION_PLUGIN: "mysql_native_password"
6944
{%- endif %}
7045
{%- if cookiecutter.db_info.name == "mongodb" %}
7146
MONGO_INITDB_ROOT_USERNAME: "{{ cookiecutter.project_name }}"
7247
MONGO_INITDB_ROOT_PASSWORD: "{{ cookiecutter.project_name }}"
7348
{%- endif %}
7449
{%- if cookiecutter.db_info.name == "mysql" %}
7550
options: >-
76-
--health-cmd="mysqladmin ping -u root"
51+
--health-cmd="mysqladmin ping --user={{ cookiecutter.project_name }} --password={{ cookiecutter.project_name }}"
7752
--health-interval=15s
7853
--health-timeout=5s
7954
--health-retries=6

‎fastapi_template/template/{{cookiecutter.project_name}}/deploy/docker-compose.yml‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,24 @@ services:
130130
hostname: {{cookiecutter.project_name}}-db
131131
restart: always
132132
environment:
133-
MYSQL_ROOT_USER: "{{cookiecutter.project_name}}"
133+
MYSQL_ROOT_USER: "root"
134134
MYSQL_ROOT_PASSWORD: "{{cookiecutter.project_name}}"
135+
MYSQL_USER: "{{cookiecutter.project_name}}"
136+
MYSQL_PASSWORD: "{{cookiecutter.project_name}}"
135137
MYSQL_DATABASE: "{{cookiecutter.project_name}}"
136-
MYSQL_AUTHENTICATION_PLUGIN: "mysql_native_password"
138+
MYSQL_HOST: "0.0.0.0"
137139
healthcheck:
138-
test: mysqladmin ping -h localhost
140+
test:
141+
- CMD
142+
- mysqladmin
143+
- ping
144+
- --user={{cookiecutter.project_name}}
145+
- --password={{cookiecutter.project_name}}
139146
interval: 10s
140147
timeout: 5s
141148
retries: 40
142149
volumes:
143-
- {{cookiecutter.project_name}}-db-data:/bitnami/mysql/data
150+
- "{{cookiecutter.project_name}}-db-data:/bitnami/mysql/data"
144151
{%- endif %}
145152

146153
{%- if cookiecutter.enable_migrations == 'True' %}

0 commit comments

Comments
 (0)