Skip to content

Sync flask-connexion-rest-part-1 with the updated tutorial - #852

Open
realpython-bot wants to merge 1 commit into
masterfrom
maintenance/flask-connexion-rest-api-20260918
Open

realpython-bot wants to merge 1 commit into
masterfrom
maintenance/flask-connexion-rest-api-20260918

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Syncs flask-connexion-rest-part-1/ with the maintenance update of the tutorial Python REST APIs With Flask, Connexion, and SQLAlchemy – Part 1.

The folder still shipped Flask 2.2.2 / Connexion 2.14.1. That pin set no longer installs into a working environment (pip resolves Flask 2.2.2 against Werkzeug 3.x, so from flask import Flask raises ImportError: cannot import name 'url_quote'), and Connexion 3 introduced two breaking changes the code hits.

What changed

  • requirements.txt — re-pinned to a clean-room resolution of Flask==3.1.3 plus connexion[flask,swagger-ui,uvicorn]==3.3.0 on Python 3.14. Every line is == pinned, matching the article's dependencies field (flask==3.1.3, connexion==3.3.0, python==3.14).
  • rp_flask_api/app.py — dropped debug=True from app.run(). On Connexion 3, App.run() forwards its keyword arguments to uvicorn.run(), which has no debug parameter, so python app.py died with TypeError: run() got an unexpected keyword argument 'debug' before the server started.
  • rp_flask_api/swagger.yml — moved x-body-name: "person" from inside schema up onto requestBody for both the post and the put operations. Connexion 3 dropped support for the nested form, so POST /api/people returned HTTP 500 with TypeError: create() missing 1 required positional argument: 'person' (and the same for update() on PUT).

flask_starter/ is unchanged: it runs on plain Flask, whose run() still accepts debug.

How it was verified

In a fresh Python 3.14.6 venv installed from the new requirements.txt (pip check clean):

Request Result
GET / 200 (home page renders)
GET /api/people 200
POST /api/people 201
POST /api/people (duplicate) 406
GET /api/people/Pan 200
PUT /api/people/Pan 200
DELETE /api/people/Pan 200
GET /api/people/Pan (after delete) 404
GET /api/ui/ 200 (Swagger UI)

flask_starter/app.py also boots and serves GET / with 200.

Repo gates: uvx ruff@0.14.1 format --check flask-connexion-rest-part-1 → 3 files already formatted; uvx ruff@0.14.1 check flask-connexion-rest-part-1 → all checks passed.

Links

🤖 Generated with Claude Code

…n REST APIs With Flask, Connexion, and SQLAlchemy – Part 1
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