Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Sync fastapi-url-shortener with the full update of the FastAPI URL shortener tutorial - #926

Open
realpython-bot wants to merge 3 commits into
masterfrom
maintenance/build-a-python-url-shortener-with-fastapi-20261027
Open

realpython-bot wants to merge 3 commits into
masterfrom
maintenance/build-a-python-url-shortener-with-fastapi-20261027

Conversation

@realpython-bot

@realpython-bot realpython-bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Sync fastapi-url-shortener with the full update draft of Build a URL Shortener With FastAPI and Python.

What changed (second commit, on top of the October maintenance sync):

  • SQLAlchemy 2.0 declarative models: DeclarativeBase, Mapped[...], mapped_column()
  • select() + Session.scalars() queries instead of the legacy Query API; sessionmaker(autoflush=False, bind=engine) (the autocommit keyword is legacy and must stay False)
  • FastAPI dependencies as Annotated[Session, Depends(get_db)]
  • Return type hints that admit None where the functions return None; update_db_clicks() takes a models.URL
  • Re-pinned requirements.txt in all four step folders: fastapi 0.165.1, uvicorn 0.55.0, sqlalchemy 2.1.10, pydantic-settings 2.16.4, python-dotenv 1.2.4, validators 0.36.0
  • READMEs: Python 3.11 or later floor, fixed the REPL output and a typo

Verified: every step folder run from the article's transcripts and a TestClient flow (create, forward, admin info, click count, delete, 404s) on Python 3.15.2 and 3.11.18 with -W error (only upstream warnings ignored: fastapi importing the deprecated opentelemetry._logs, and Starlette's test client preferring httpx2). Final app also exercised through a real uvicorn --reload process with curl. ruff 0.14.1 format --check and check clean; dircheck.py passes.

🤖 Generated with Claude Code

realpython-bot and others added 2 commits October 27, 2026 06:08
… Shortener With FastAPI and Python

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ner With FastAPI and Python

- SQLAlchemy 2.0 declarative models (DeclarativeBase, Mapped, mapped_column)
- select()/Session.scalars() queries instead of the legacy Query API
- Annotated[Session, Depends(get_db)] dependencies
- Return type hints that admit None where the functions return None
- Re-pinned requirements (fastapi 0.165.1, uvicorn 0.55.0, sqlalchemy 2.1.10,
  pydantic-settings 2.16.4), Python 3.11+ floor in the READMEs, README fixes
@realpython-bot realpython-bot changed the title Sync fastapi-url-shortener with the updated tutorial Sync fastapi-url-shortener with the full update of the FastAPI URL shortener tutorial Dec 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant