Skip to content

[FEAT, TEMPLATE, DOCS] v2.0.0 stage 1: fastkit doctor, unified API conventions, template set - #94

Merged
bnbong merged 5 commits into
devfrom
feat/v2.0.0
Dec 2, 2026
Merged

bnbong merged 5 commits into
devfrom
feat/v2.0.0

Conversation

@bnbong

@bnbong bnbong commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Requesting Merging

Description

First of several staged PRs for v2.0.0. This one contains two commits:

  1. fastkit doctor, addroute --dry-run/--diff/--entity, and one HTTP contract for every template, every fastkit init option and addroute output.
  2. The template set for 2.0.0: three templates removed, fastapi-hello added, fastapi-sqlmodel on three databases, plus fixes to CLI messages and to project creation with Poetry and PDM.

Later stages (catalog and generation API, unified fastkit init, post-generation guidance, web generator, docs rebuild, translations) follow in separate PRs. __version__ is already 2.0.0; the CHANGELOG heading has no release date yet.

Type of Change

  • BUG FIX
  • ADDING NEW TEMPLATE
  • FEATURE ADDED/UPDATED
  • HOTFIX
  • DELETING UNNECESSARY FEATURES
  • DOCUMENTATION & DEVOPS
  • Etc..

Test Environment

  • macOS (Apple Silicon), Python 3.12
  • Full suite: 3207 passed, 21 skipped
  • Full suite with EncodingWarning from fastapi_fastkit as errors: 3207 passed, 21 skipped
  • C locale (LC_ALL=C, PYTHONUTF8=0), -m "not extended": 3116 passed, 21 skipped
  • Simulated Windows (POSIX-only os / signal attributes removed): 3199 passed, 29 skipped
  • mypy src, black --check, isort --check: clean
  • mkdocs build --strict: no warnings
  • Diff coverage against dev: 98%
  • fastapi-sqlmodel generated and run against SQLite, PostgreSQL 17 and MySQL 8.4 (migrations up and down, CRUD, timestamps, /ready; its 124 tests pass on each)
  • fastapi-hello generated, installed and run with uv, pip, Poetry 2.5.2 and PDM 2.29.8
  • Poetry 1.7.1: refused with the new message, nothing created

Not verified on real Windows. The windows-latest job runs this code for the first time on this PR.

Major Changes

Breaking

  • Generated projects share one HTTP contract: routes under /api/v1, GET /health at the root, GET /ready where a database or cache exists, paginated list envelope, 201 with Location, 204 on delete, PUT replaces and PATCH updates. The CHANGELOG has the before/after table.
  • Removed fastapi-async-crud, fastapi-dockerized and fastapi-psql-orm with their tutorials. Existing projects keep working.
  • Every ENVIRONMENT other than development refuses a missing, example or short SECRET_KEY.
  • startdemo, addroute and deleteproject exit 1 on refusal or failure. runserver without .venv exits 1 unless the user continues with the current Python.
  • Interactive init no longer offers CORS and Pagination; every project includes them.

CLI

  • New fastkit doctor [PATH] with --fix, --dry-run/--diff, --yes, --format json. Passed checks read as passes; checks that do not apply are skipped.
  • addroute generates a typed CRUD resource with tests in both layouts; --dry-run, --diff, --entity. It refuses only real single-file projects.
  • startdemo validates the template name before prompting and suggests close matches.
  • runserver prints the commands that create .venv for the project's package manager and uses the current interpreter's uvicorn.
  • list-templates is ordered from simplest to most involved; list-features shows built-in utilities; --help has a "Start here" section.
  • Project creation with Poetry and PDM works again (it failed for every template). Poetry 2 or later is required and checked up front.

Templates

  • New fastapi-hello: one main.py, three endpoints, tests, concept comments linking to the FastAPI docs.
  • fastapi-sqlmodel: SQLite, PostgreSQL or MySQL through DATABASE_URL, optional driver extras, a compose file for local servers, migrations that work on all three.
  • fastkit init options: JWT and FastAPI-Users are implemented; session logout invalidates the session; rate limiting uses limits; MongoDB uses PyMongo's async client.

Docs

  • English docs and CHANGELOG updated for the above. Tutorials of the removed templates are deleted in all seven locales; the translated locales are otherwise not re-synced (reference/translation-status lists the pages).

Screenshots (optional)

N/A

Etc

  • Known, deferred to stage 2: the startdemo dependency table lists test tools and comment lines from requirements.txt; the fastapi-sqlmodel Docker image installs development tools.

bnbong and others added 4 commits December 1, 2026 17:32
[FIX, TEMPLATE, CICD] harden generated secrets and auth, add Windows support (v1.5.2)
…tions

- add `fastkit doctor` with --fix, --dry-run and --format json
- addroute: --dry-run/--diff/--entity, full CRUD for both layouts
- one HTTP contract for all templates, init options and addroute output
- pagination built in; JWT and FastAPI-Users options implemented
- session invalidation, stricter SECRET_KEY rule outside development
- startdemo/addroute exit 1 on failure
- bump version to 2.0.0 (unreleased; base of the 2.0.0 work)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@bnbong bnbong self-assigned this Dec 2, 2026
@bnbong bnbong added documentation Improvements or additions to documentation enhancement New feature or request template Add or editing a FastAPI template fix Fix or improve source codes labels Dec 2, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-02T02:22:06.332118Z d33cf31 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Template Inspection Passed

All changed templates have been validated successfully.


Last updated: 2026-12-02T02:47:14.782Z

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d33cf31900

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

) -> <entity_class>Read:
"""Create a record; the Location header points at it."""
record = repository.add(payload.model_dump())
location = request.url_for("get_<entity_snake>", <entity_snake>_id=record.id)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make reverse-route names unique to each route module

When two routes use the same entity name—for example, orders and archived_orders --entity Order—both generated routers register a getter named get_order with the same order_id parameter. The planner permits this because their files and module-level bindings do not collide, but request.url_for() resolves the first matching route, so creating an archived order returns a Location pointing into the orders collection instead. Use a route-specific name for reverse lookup rather than deriving it solely from the entity. The domain and enveloped route templates need the same treatment.

Useful? React with 👍 / 👎.

Comment on lines +218 to +219
write_generated_text(planned.path, planned.content)
created_files.append(planned.path)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include partially written new files in rollback

If writing a new file fails after opening it, such as when the filesystem runs out of space, write_generated_text() leaves an empty or partial file behind but execution never reaches created_files.append(). Rollback therefore does not remove that file, and its nonempty parent directories also remain. This defeats the new all-or-nothing route application behavior and causes a subsequent addroute attempt to reject the leftover files as an existing route. Record the destination before writing, or write through a temporary file that is cleaned up on failure.

Useful? React with 👍 / 👎.

@codecov

codecov Bot commented Dec 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

- Location header resolved another router's route when two routes shared an entity name
- a new file left half-written by a failed write is now removed on rollback

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@bnbong
bnbong merged commit 4cd109a into dev Dec 2, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request fix Fix or improve source codes template Add or editing a FastAPI template

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant