Skip to content

Commit 2d1cb93

Browse files
Merge branch 'fastapi:master' into upgrade-docker
2 parents e75b552 + 0a5f102 commit 2d1cb93

File tree

10 files changed

+60
-12
lines changed

10 files changed

+60
-12
lines changed

.github/workflows/generate-client.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ jobs:
1212
contents: write
1313
runs-on: ubuntu-latest
1414
steps:
15+
# For PRs from forks
1516
- uses: actions/checkout@v4
17+
# For PRs from the same repo
18+
- uses: actions/checkout@v4
19+
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' )
1620
with:
1721
ref: ${{ github.head_ref }}
1822
token: ${{ secrets.FULL_STACK_FASTAPI_TEMPLATE_REPO_TOKEN }}
@@ -23,7 +27,7 @@ jobs:
2327
with:
2428
python-version: "3.10"
2529
- name: Install uv
26-
uses: astral-sh/setup-uv@v2
30+
uses: astral-sh/setup-uv@v3
2731
with:
2832
version: "0.4.15"
2933
enable-cache: true
@@ -35,10 +39,19 @@ jobs:
3539
- run: uv run bash scripts/generate-client.sh
3640
env:
3741
VIRTUAL_ENV: backend/.venv
38-
- name: Commit changes
42+
- name: Add changes to git
3943
run: |
4044
git config --local user.email "github-actions@github.com"
4145
git config --local user.name "github-actions"
4246
git add frontend/src/client
47+
# Same repo PRs
48+
- name: Push changes
49+
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' )
50+
run: |
4351
git diff --staged --quiet || git commit -m "✨ Autogenerate frontend client"
4452
git push
53+
# Fork PRs
54+
- name: Check changes
55+
if: ( github.event_name == 'pull_request' && github.secret_source != 'Actions' )
56+
run: |
57+
git diff --staged --quiet || (echo "Changes detected in generated client, run scripts/generate-client.sh and commit the changes" && exit 1)

.github/workflows/issue-manager.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
env:
2828
GITHUB_CONTEXT: ${{ toJson(github) }}
2929
run: echo "$GITHUB_CONTEXT"
30-
- uses: tiangolo/issue-manager@0.5.0
30+
- uses: tiangolo/issue-manager@0.5.1
3131
with:
3232
token: ${{ secrets.GITHUB_TOKEN }}
3333
config: >

.github/workflows/lint-backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
python-version: "3.10"
2222
- name: Install uv
23-
uses: astral-sh/setup-uv@v2
23+
uses: astral-sh/setup-uv@v3
2424
with:
2525
version: "0.4.15"
2626
enable-cache: true

.github/workflows/test-backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
python-version: "3.10"
2222
- name: Install uv
23-
uses: astral-sh/setup-uv@v2
23+
uses: astral-sh/setup-uv@v3
2424
with:
2525
version: "0.4.15"
2626
enable-cache: true

.pre-commit-config.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ repos:
1010
args:
1111
- --unsafe
1212
- id: end-of-file-fixer
13-
exclude: ^frontend/src/client/.*
13+
exclude: |
14+
(?x)^(
15+
frontend/src/client/.*|
16+
backend/app/email-templates/build/.*
17+
)$
1418
- id: trailing-whitespace
1519
exclude: ^frontend/src/client/.*
1620
- repo: https://github.com/charliermarsh/ruff-pre-commit

backend/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM python:3
22

3+
ENV PYTHONUNBUFFERED=1
4+
35
WORKDIR /app/
46

57
# Install uv

backend/app/core/db.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def init_db(session: Session) -> None:
1818
# the tables un-commenting the next lines
1919
# from sqlmodel import SQLModel
2020

21-
# from app.core.engine import engine
2221
# This works because the models are already imported and registered from app.models
2322
# SQLModel.metadata.create_all(engine)
2423

backend/app/utils.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@
99
from jinja2 import Template
1010
from jwt.exceptions import InvalidTokenError
1111

12+
from app.core import security
1213
from app.core.config import settings
1314

15+
logging.basicConfig(level=logging.INFO)
16+
logger = logging.getLogger(__name__)
17+
1418

1519
@dataclass
1620
class EmailData:
@@ -48,7 +52,7 @@ def send_email(
4852
if settings.SMTP_PASSWORD:
4953
smtp_options["password"] = settings.SMTP_PASSWORD
5054
response = message.send(to=email_to, smtp=smtp_options)
51-
logging.info(f"send email result: {response}")
55+
logger.info(f"send email result: {response}")
5256

5357

5458
def generate_test_email(email_to: str) -> EmailData:
@@ -104,14 +108,16 @@ def generate_password_reset_token(email: str) -> str:
104108
encoded_jwt = jwt.encode(
105109
{"exp": exp, "nbf": now, "sub": email},
106110
settings.SECRET_KEY,
107-
algorithm="HS256",
111+
algorithm=security.ALGORITHM,
108112
)
109113
return encoded_jwt
110114

111115

112116
def verify_password_reset_token(token: str) -> str | None:
113117
try:
114-
decoded_token = jwt.decode(token, settings.SECRET_KEY, algorithms=["HS256"])
118+
decoded_token = jwt.decode(
119+
token, settings.SECRET_KEY, algorithms=[security.ALGORITHM]
120+
)
115121
return str(decoded_token["sub"])
116122
except InvalidTokenError:
117123
return None

copier.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,4 @@ _exclude:
9797
_answers_file: .copier/.copier-answers.yml
9898

9999
_tasks:
100-
- "python .copier/update_dotenv.py"
100+
- ["{{ _copier_python }}", .copier/update_dotenv.py]

release-notes.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,30 @@
22

33
## Latest Changes
44

5-
* 👷 Do not sync labels as it overrides manually added labels. PR [#1307](https://github.com/fastapi/full-stack-fastapi-template/pull/1307) by [@tiangolo](https://github.com/tiangolo).
5+
### Refactors
6+
7+
* ♻️ Refactored code to use encryption algorithm name from settings for consistency. PR [#1160](https://github.com/fastapi/full-stack-fastapi-template/pull/1160) by [@sameeramin](https://github.com/sameeramin).
8+
* 🔊 Enable logging for email utils by default. PR [#1374](https://github.com/fastapi/full-stack-fastapi-template/pull/1374) by [@ihmily](https://github.com/ihmily).
9+
* 🔧 Add `ENV PYTHONUNBUFFERED=1` to log output directly to Docker. PR [#1378](https://github.com/fastapi/full-stack-fastapi-template/pull/1378) by [@tiangolo](https://github.com/tiangolo).
10+
* 💡 Remove unnecessary comment. PR [#1260](https://github.com/fastapi/full-stack-fastapi-template/pull/1260) by [@sebhani](https://github.com/sebhani).
11+
12+
### Internal
13+
14+
* ⬆ Bump astral-sh/setup-uv from 2 to 3. PR [#1364](https://github.com/fastapi/full-stack-fastapi-template/pull/1364) by [@dependabot[bot]](https://github.com/apps/dependabot).
15+
* 👷 Update pre-commit end-of-file-fixer hook to exclude email-templates. PR [#1296](https://github.com/fastapi/full-stack-fastapi-template/pull/1296) by [@goabonga](https://github.com/goabonga).
16+
* ⬆ Bump tiangolo/issue-manager from 0.5.0 to 0.5.1. PR [#1332](https://github.com/fastapi/full-stack-fastapi-template/pull/1332) by [@dependabot[bot]](https://github.com/apps/dependabot).
17+
* 🔧 Run task by the same Python environment used to run Copier. PR [#1157](https://github.com/fastapi/full-stack-fastapi-template/pull/1157) by [@waketzheng](https://github.com/waketzheng).
18+
* 👷 Tweak generate client to error out if there are errors. PR [#1377](https://github.com/fastapi/full-stack-fastapi-template/pull/1377) by [@tiangolo](https://github.com/tiangolo).
19+
* 👷 Generate and commit client only on same repo PRs, on forks, show the error. PR [#1376](https://github.com/fastapi/full-stack-fastapi-template/pull/1376) by [@tiangolo](https://github.com/tiangolo).
20+
21+
## 0.7.1
22+
23+
### Highlights
24+
25+
* Migrate from Poetry to [`uv`](https://github.com/astral-sh/uv).
26+
* Simplifications and improvements for Docker Compose files, Traefik Dockerfiles.
27+
* Make the API use its own domain `api.example.com` and the frontend use `dashboard.example.com`. This would make it easier to deploy them separately if you needed that.
28+
* The backend and frontend on Docker Compose now listen on the same port as the local development servers, this way you can stop the Docker Compose services and run the local development servers without changing the frontend configuration.
629

730
### Features
831

@@ -34,6 +57,7 @@
3457

3558
### Internal
3659

60+
* 👷 Do not sync labels as it overrides manually added labels. PR [#1307](https://github.com/fastapi/full-stack-fastapi-template/pull/1307) by [@tiangolo](https://github.com/tiangolo).
3761
* 👷 Use uv cache on GitHub Actions. PR [#1366](https://github.com/fastapi/full-stack-fastapi-template/pull/1366) by [@tiangolo](https://github.com/tiangolo).
3862
* 👷 Update GitHub Actions format. PR [#1363](https://github.com/fastapi/full-stack-fastapi-template/pull/1363) by [@tiangolo](https://github.com/tiangolo).
3963
* 👷 Use `uv` for Python env to generate client. PR [#1362](https://github.com/fastapi/full-stack-fastapi-template/pull/1362) by [@tiangolo](https://github.com/tiangolo).

0 commit comments

Comments
 (0)