Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ jobs:
path: .cache
restore-keys: |
mkdocs-material-
- run: mkdocs gh-deploy --force
- run: mkdocs gh-deploy --strict --force
2 changes: 1 addition & 1 deletion .github/workflows/translate-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
- anthropic
default: openai
specific_files:
description: 'Specific files to translate (space-separated, relative to docs/en/). Example: index.md user-guide/installation.md'
description: 'Specific files to translate (space-separated, relative to docs/en/). Example: index.md start/installation.md'
required: false
type: string
create_pr:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/web-generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ on:
pull_request:
paths:
- "src/**"
- "docs/js/**"
- "docs/css/web-generator.css"
- "docs/*/start/web-generator.md"
- "docs/**"
- "README.md"
- "CHANGELOG.md"
- "scripts/mkdocs_hooks/**"
- "scripts/docs_blocks.py"
- "scripts/web_generator/**"
- "tests/fixtures/web_generator/**"
- "pyproject.toml"
Expand Down
19 changes: 14 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ Every 401 carries `WWW-Authenticate`, and each project reads its configuration f
- Author and email default to `git config user.name` / `user.email`, and the package manager to uv when it is installed, otherwise pip. An empty author is left out of `pyproject.toml` for every package manager (Poetry also leaves out an email without a name).
- `--save-config` works for every `init` run except `--dry-run` and records the level or template; `project_name` is the only required config key, a config can name a `level` or a `template`, and `--project-name`, `--author`, `--author-email` and `--description` override the file's values.
- A config file may set `version` (a PEP 440 version such as `1.2.0`, quoted in YAML) to give the generated project that version instead of `0.1.0`; an invalid value is reported and nothing is written.
- A prompt that gets 10 invalid answers, or whose input ends, exits with status 1. `startdemo -y` also skips the creation prompt, and `runserver` rejects an invalid `app_module` in `[tool.fastapi-fastkit]`.
- A prompt that gets 10 invalid answers, or whose input ends, exits with status 1. `startdemo -y` asks only for the project name, and `runserver` rejects an invalid `app_module` in `[tool.fastapi-fastkit]`.
- `init --template` and `startdemo` check the template name before they ask anything, suggest close matches and point to `fastkit list-templates`; the internal template path is shown only with `--debug`.
- After `init` or `startdemo` creates a project, fastkit prints a "Next steps" panel with the commands that apply to that run (project folder, environment, reviewing `.env`, database, server, tests, `addroute`, the next level), and puts the same list in the project's `README.md`. The old "To start your project" line is gone.
- `runserver` in a project without `.venv` prints the commands that create it for the project's package manager (for PDM, ones that keep the `.venv` inside the project) before offering to continue. If you continue, it runs the uvicorn of the Python that runs fastkit and exits with a clear message if that Python has none.
- `addroute` on a real single-file project such as `fastapi-hello` explains how to extend it by hand instead of adding packages. Projects that keep `main.py` at the root with their code in packages are handled as before.
- `doctor` passed checks say only what was verified, with no severity, and checks that do not apply to a project (secrets, settings, `.gitattributes`) are skipped. JSON output is unchanged.
- `list-features` shows the utility and tooling options that `init` offers and lists CORS and pagination as built into every project.
- `list-features` shows the utility, tooling and deployment options that `init` offers, with package extras such as `pyjwt[crypto]`, and lists CORS and pagination as built into every project.
- Projects created with Poetry now get a working virtual environment and install with `poetry install`; fastkit sets `package-mode = false` so Poetry installs the dependencies without packaging the application. Poetry 2 or later is required: with an older Poetry, fastkit stops before creating anything, reports the version it found and explains how to upgrade or choose another package manager.
- Projects created with PDM now get their `.venv` inside the project even when PDM is configured with `venv.in_project = false`, and `fastapi-hello` installs with PDM without being built as a package.
- `list-templates` lists templates from the simplest to the most involved, in the same order on every operating system. `fastkit --help` has a one-sentence description and a "Start here" section.
Expand All @@ -63,6 +63,10 @@ Every 401 carries `WWW-Authenticate`, and each project reads its configuration f
- `startdemo` and `init` refuse to write through a symbolic link in the target directory and list the links before writing anything.
- When `startdemo` or `init` fails or is interrupted after overwriting files in an existing directory, those files get their original content back and the files the run created are removed; a file that cannot be restored keeps its original copy in a backup directory whose path is printed. An existing `.env` is kept even when a custom template ships one.
- `addroute` no longer treats a router registration or import under `if TYPE_CHECKING:` or `if False:` as present, and inserts imports below `from __future__` imports when the import anchor sits above them.
- `init` prints the summary, the files it created and the next steps; its internal steps are shown only with `fastkit --debug init`.
- `init` refuses a project name that is also the name of one of the project's dependencies (such as `sqlmodel` for `fastapi-sqlmodel`), because the package manager would then not install that dependency; the web generator refuses it too.
- `runserver` exits with the server's own exit status and a one-line message when the server stops with an error. Error tracebacks no longer show local variables, which could print environment variables and the secrets in them.
- In layered projects `addroute` adds the new resource's dependency to `src/api/deps.py`, and the routes it writes follow the example `items` routes: the return annotation is the response model and the 404 answer is documented.

### Web generator

Expand All @@ -87,6 +91,9 @@ Every 401 carries `WWW-Authenticate`, and each project reads its configuration f
- **Docker Compose:** the containers always reach the compose database at its service name (a `DATABASE_URL` or `MONGODB_URL` in `.env` or the shell no longer redirects them), and the app, `migrate` and worker services share one image built once.
- **Dev tools:** test and lint tools (pytest and its plugins, ruff, pre-commit) stay out of runtime dependencies. They go to the dev dependency group and to a new `requirements-dev.txt` that includes `requirements.txt`. Generated Dockerfiles install runtime dependencies only; the Makefile, GitHub Actions workflow and devcontainer install `requirements-dev.txt`.
- **ruff:** projects created with the ruff option pass their own `ruff check`; generic classes use the Python 3.12 type parameter syntax.
- **Testing:** pytest and coverage settings go to `pyproject.toml`; no `pytest.ini` is generated.
- **Structured logging** writes one JSON access line per request (logger `app.access`) with the request id, method, path, status code and duration, and turns off uvicorn's own access log.
- **Docker Compose:** a comment in `docker-compose.yml` and a sentence in the README explain that `.env` runs the containers in development mode and how to switch.

### Templates

Expand All @@ -100,12 +107,14 @@ Every 401 carries `WWW-Authenticate`, and each project reads its configuration f
- Unused dependencies and `setup.cfg` files are removed. Template Dockerfiles run as a non-root user and ship a `.dockerignore`.
- Generated code carries short comments that explain a FastAPI concept at its first use, each ending with a link to the matching FastAPI documentation page; a concept is explained once per project.
- Every template ships a `requirements-dev.txt` for test and lint tools and keeps them out of `requirements.txt`, so the Docker images of `fastapi-sqlmodel`, `fastapi-auth-jwt` and `fastapi-llm-agent` no longer contain them.
- Every template except `fastapi-hello` ships the ruff configuration that `init`'s ruff option writes. `fastapi-single-module` projects pass isort and `mypy src`, and `fastapi-custom-response` uses Python 3.12 generic syntax for its response envelope.
- `fastapi-single-module`, `fastapi-default` and `fastapi-domain-starter` ship pytest-cov with coverage settings and ruff in their dev dependencies, and keep their pytest settings in `pyproject.toml`. The `scripts/lint.sh` of `fastapi-default` and `fastapi-domain-starter` runs black, isort, mypy and ruff.
- `fastapi-sqlmodel` leaves the schema to Alembic by default (`CREATE_TABLES_ON_STARTUP=false`), so run `alembic upgrade head` before the first start.
- Every template except `fastapi-hello` ships the ruff configuration that `init`'s ruff option writes; the example templates also install ruff and run it from their lint scripts. `fastapi-single-module` projects pass isort and `mypy src`, and `fastapi-custom-response` uses Python 3.12 generic syntax for its response envelope.

### Documentation

- The English docs cover the changes above, including a `fastkit doctor` section in the CLI reference and the conventions a new template must follow.
- The translated locales are not re-synced in this release; `reference/translation-status` lists the affected pages.
- The documentation is reorganised into Start, Learn, How-to, Reference and Contributing; the Learn track follows one project from `hello` to `production`, and old page addresses redirect to their new pages.
- CLI reference tables and help texts are generated from the catalog and the CLI, and the configuration-file and environment-variable sections that described settings fastkit never read are removed.

### Upgrade notes for existing projects

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ make translate LANG=ko PROVIDER=openai MODEL=gpt-4
python scripts/translate.py --target-lang ko --api-provider openai

# Translate specific files (paths relative to docs/en/)
python scripts/translate.py --target-lang ko --files index.md user-guide/installation.md --api-provider openai
python scripts/translate.py --target-lang ko --files index.md start/installation.md --api-provider openai

# Translate without creating PR (for local testing)
python scripts/translate.py --target-lang ko --no-pr --api-provider openai
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ serve-docs: ## Serve documentation locally
mkdocs serve

# Development workflow commands
# docs is a dependency group, not an extra: install its export,
# requirements-docs.txt, as the docs workflow does.
dev-setup: ## Set up development environment from scratch
@echo "Setting up development environment..."
pip install --upgrade pip
pip install -e ".[dev]"
pip install -e ".[docs]" || pip install -r requirements-docs.txt
pip install -r requirements-docs.txt
pre-commit install
@echo "Development environment setup complete!"

Expand Down
Loading
Loading