Repository navigation
Sync fastapi-url-shortener with the updated tutorial - #926
Open
realpython-bot wants to merge 1 commit into
Open
realpython-bot wants to merge 1 commit into
realpython-bot wants to merge 1 commit into
Conversation
… Shortener With FastAPI and Python Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Syncs
fastapi-url-shortenerwith the maintenance update of the tutorial Build a URL Shortener With FastAPI and Python.What changed
In every step folder (
source_code_step_1tosource_code_step_3, plussource_code_final):config.pyimportsBaseSettingsandSettingsConfigDictfrom the newpydantic-settingspackage and usesmodel_config = SettingsConfigDict(env_file=".env")in place of the innerclass Config.schemas.pyusesmodel_config = ConfigDict(from_attributes=True)in place oform_mode = True.database.pyimportsdeclarative_basefromsqlalchemy.ormin place of the deprecatedsqlalchemy.ext.declarative.Before this change, the code doesn't run on any current FastAPI release, because
from pydantic import BaseSettingsraisesPydanticImportErroron Pydantic v2.Verification
requirements.txt. Each step folder was smoke-tested withTestClientand warnings turned into errors: settings load from.env. Step 2 creates a URL and rejects an invalid one (400). Step 3 also forwards (307). Final also checks the admin info (click count 1,admin_urlunder/admin/), deletes the URL, and gets a 404 afterward.source_code_finalalso passes on Python 3.11.17, the new minimum version.ruff@0.14.1 format --checkandruff@0.14.1 checkpass.Links
🤖 Generated with Claude Code