Skip to content

Commit

Permalink
Dependencies update. (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
s3rius authored Jun 30, 2024
1 parent 63d7f21 commit 5540ffc
Show file tree
Hide file tree
Showing 20 changed files with 170 additions and 256 deletions.
11 changes: 2 additions & 9 deletions fastapi_template/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def checker(ctx: BuilderContext) -> bool:
),
additional_info=Database(
name="mysql",
image="bitnami/mysql:8.0.30",
image="mysql:8.4",
async_driver="mysql+aiomysql",
driver_short="mysql",
driver="mysql",
Expand All @@ -178,7 +178,7 @@ def checker(ctx: BuilderContext) -> bool:
),
additional_info=Database(
name="postgresql",
image="postgres:13.8-bullseye",
image="postgres:16.3-bullseye",
async_driver="postgresql+asyncpg",
driver_short="postgres",
driver="postgresql",
Expand Down Expand Up @@ -274,7 +274,6 @@ def checker(ctx: BuilderContext) -> bool:
code="ormar",
user_view="Ormar",
is_hidden=check_db(["sqlite", "mysql", "postgresql"]),
pydantic_v1=True,
description=(
"{what} is a great {feature} ORM.\n"
"It's compatible with pydantic models and alembic migrator.".format(
Expand Down Expand Up @@ -354,12 +353,6 @@ def checker(ctx: BuilderContext) -> bool:
multiselect=True,
before_ask=do_not_ask_features_if_quiet,
entries=[
MenuEntry(
code="pydanticv1",
cli_name="pydantic-v1",
user_view="Use older version of pydantic",
description="Use pydantic version ^1 instead of ^2",
),
MenuEntry(
code="enable_redis",
cli_name="redis",
Expand Down
7 changes: 0 additions & 7 deletions fastapi_template/input_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class MenuEntry(BaseModel):
description: str
is_hidden: Optional[Callable[["BuilderContext"], bool]] = None
additional_info: Any = None
pydantic_v1: bool = False

@property
def generated_name(self) -> str:
Expand Down Expand Up @@ -159,8 +158,6 @@ def ask(self, context: "BuilderContext") -> Optional["BuilderContext"]:
return

setattr(context, self.code, chosen_entry.code)
if chosen_entry.pydantic_v1:
context.pydanticv1 = True

return context

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

for ch_entry in chosen_entries:
if ch_entry.pydantic_v1:
context.pydanticv1 = True

return context


Expand Down
3 changes: 0 additions & 3 deletions fastapi_template/template/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@
"otlp_enabled": {
"type": "bool"
},
"pydanticv1": {
"type": "bool"
},
"gunicorn": {
"type": "bool"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,24 @@ name: Testing {{cookiecutter.project_name}}
on: push

jobs:
black:
lint:
strategy:
matrix:
cmd:
- black
- ruff
- mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install deps
uses: knowsuchagency/poetry-install@v1
env:
POETRY_VIRTUALENVS_CREATE: false
- name: Run black check
run: poetry run black --check .
flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install deps
uses: knowsuchagency/poetry-install@v1
env:
POETRY_VIRTUALENVS_CREATE: false
- name: Run flake8 check
run: poetry run flake8 --count .
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.11'
- name: Install deps
uses: knowsuchagency/poetry-install@v1
env:
POETRY_VIRTUALENVS_CREATE: false
- name: Run mypy check
run: poetry run mypy .
run: poetry install
- name: Run lint check
run: poetry run pre-commit run -a {{ '${{' }} matrix.cmd {{ '}}' }}
pytest:
runs-on: ubuntu-latest
{%- if ((cookiecutter.db_info.name != "none" and cookiecutter.db_info.name != "sqlite") or
Expand All @@ -63,17 +39,16 @@ jobs:
{%- endif %}
{%- if cookiecutter.db_info.name == "mysql" %}
MYSQL_ROOT_PASSWORD: "{{ cookiecutter.project_name }}"
MYSQL_ROOT_USER: "{{ cookiecutter.project_name }}"
MYSQL_USER: "{{ cookiecutter.project_name }}"
MYSQL_DATABASE: "{{ cookiecutter.project_name }}"
MYSQL_AUTHENTICATION_PLUGIN: "mysql_native_password"
{%- endif %}
{%- if cookiecutter.db_info.name == "mongodb" %}
MONGO_INITDB_ROOT_USERNAME: "{{ cookiecutter.project_name }}"
MONGO_INITDB_ROOT_PASSWORD: "{{ cookiecutter.project_name }}"
{%- endif %}
{%- if cookiecutter.db_info.name == "mysql" %}
options: >-
--health-cmd="mysqladmin ping -u root"
--health-cmd="mysqladmin ping --user={{ cookiecutter.project_name }} --password={{ cookiecutter.project_name }}"
--health-interval=15s
--health-timeout=5s
--health-retries=6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,24 @@ services:
hostname: {{cookiecutter.project_name}}-db
restart: always
environment:
MYSQL_ROOT_USER: "{{cookiecutter.project_name}}"
MYSQL_ROOT_USER: "root"
MYSQL_ROOT_PASSWORD: "{{cookiecutter.project_name}}"
MYSQL_USER: "{{cookiecutter.project_name}}"
MYSQL_PASSWORD: "{{cookiecutter.project_name}}"
MYSQL_DATABASE: "{{cookiecutter.project_name}}"
MYSQL_AUTHENTICATION_PLUGIN: "mysql_native_password"
MYSQL_HOST: "0.0.0.0"
healthcheck:
test: mysqladmin ping -h localhost
test:
- CMD
- mysqladmin
- ping
- --user={{cookiecutter.project_name}}
- --password={{cookiecutter.project_name}}
interval: 10s
timeout: 5s
retries: 40
volumes:
- {{cookiecutter.project_name}}-db-data:/bitnami/mysql/data
- "{{cookiecutter.project_name}}-db-data:/bitnami/mysql/data"
{%- endif %}

{%- if cookiecutter.enable_migrations == 'True' %}
Expand Down
Loading

0 comments on commit 5540ffc

Please sign in to comment.