Repository navigation
[FEAT, TEMPLATE, DOCS] v2.0.0 stage 3: unified fastkit init with levels - #96
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
✅ Template Inspection Passed All changed templates have been validated successfully. Last updated: 2026-12-02T13:19:44.398Z |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 483ea4e778
ℹ️ 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".
| errors = validate_project_config(config) | ||
| if errors: | ||
| for error in errors: | ||
| print_error(f"Invalid project config '{path}': {error}") | ||
| return None |
There was a problem hiding this comment.
Apply level defaults before validating config combinations
A config such as {"project_name":"demo","level":"production","authentication":"FastAPI-Users"} is rejected here because validate_project_config checks feature combinations against the raw file, treating the omitted database as None. Production actually bundles PostgreSQL, and choice_from_config correctly accepts this same configuration after applying the level defaults, but the CLI exits before reaching it. Validate combinations on the effective level selection so valid partial production configs can be used with init --config.
Useful? React with 👍 / 👎.
| # Refuse unusable level flags before anything is asked. | ||
| if level is not None: | ||
| check(flag_choice(level)) |
There was a problem hiding this comment.
Defer database-dependent checks until after the database prompt
In a terminal, init --level domain --feature authentication=FastAPI-Users --project-name demo exits here with a SQL-database requirement error instead of asking for the missing database. check validates the complete specification while database is still unset, even though the database question runs later in the guided flow. The same premature rejection occurs without an explicit level through the first-preset check. Keep early validation of individual flag values, but defer combination checks involving unanswered choices until the user has supplied them.
Useful? React with 👍 / 👎.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
…abase before rule checks - init --config: a 2.0 config's feature combinations are checked after the level's defaults apply, so production with FastAPI-Users and no database key is accepted - init in a terminal: a rule that a database answer can satisfy no longer stops the run before the database question; an answer that does not satisfy it is refused with the reason and asked again - tests: read the summary table and wrapped messages in any box style (legacy Windows console), skip the responses test without pydantic Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Requesting Merging
Description
Third staged PR for v2.0.0.
fastkit initbecomes the single way to create a project:fastkit init --template <name>copies a bundled template,startdemostays as an alias, and without a terminal nothing is asked. The stack question (minimal/standard/full) and thefastapi-emptytemplate are removed. The level-to-project mapping lives in the generation layer, so the web generator in a later stage uses the same code.Type of Change
Test Environment
EncodingWarningfromfastapi_fastkitas errors: 4405 passed, 61 skippedLC_ALL=C,PYTHONUTF8=0),-m "not extended": 4309 passed, 61 skippedos/signalattributes removed): 4397 passed, 69 skippedmkdocs build --strict: passesdev: 99%hello, customisedproduction,--template fastapi-sqlmodel, fully non-interactiveminimalnow generatefastapi-single-module, as intended)ruff check,ruff format --check, black, isort,mypy srcand shipped lint scripts pass;/openapi.jsonis byte-identical before and after for all fifteenfastapi-empty,minimalpreset) still work withdoctor,addrouteandrunserverNot verified on real Windows. Docker images of three templates were built but not run.
Major Changes
fastkit inithello(onemain.py),single-file,layered,domain,production(domain plus PostgreSQL, Alembic, JWT, coverage, structured logs, ruff, CI, Docker). Default level ishello.productionalways, is generated from the feature selection. In the customise step every default equals what "No" would have produced.--level,--database,--feature AXIS=VALUE(repeatable),--extra-package,--template,--in-place,--name(alias of--project-name). No existing option is renamed.initnever prompts: it uses options and defaults and exits 1 naming the option it needs. Every question gives up after 10 invalid answers or when input ends.git config; the package manager defaults to uv when installed, otherwise pip.--save-configworks for every run except--dry-run, which writes nothing.project_nameis the only required config key;--project-name,--author,--author-emailand--descriptionoverride a config file's values.--interactiveis accepted and does nothing.-yuses the defaults without asking.Removed
fastapi-emptytemplate. Theminimalpreset is an alias ofsingle-module. Saved 1.x configs and projects generated by 1.x keep working.startdemofastkit init --template.Templates
fastapi-helloships the ruff configuration thatinit's ruff option writes, and passes it.requirements-dev.txt;requirements.txtlists runtime packages only.fastapi-single-moduleprojects pass isort andmypy src;fastapi-custom-responseuses the Python 3.12 type parameter syntax, andaddrouterecognises both the old and the new form.pyproject.tomlfor every package manager (it broke builds).Tooling
pdm.lockanduv.lock; a test fails when they drift. After pulling, runpdm sync -G dev --clean(oruv sync --extra dev).cli.pyis split:initandstartdemolive infastapi_fastkit/commands/.Docs
init --template. Translations are not re-synced;reference/translation-statuslists the pages.Screenshots (optional)
N/A
Etc
single-filewith a database becomes a multi-module project; projects generated from a feature selection list unpinned base dependencies while templates keep version floors.