You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[FEAT] enhance FastAPI-fastkit project templates and detection
- Updated project templates to include a standardized description marker "[FastAPI-fastkit templated]" in pyproject.toml files for better identification.
- Introduced a new section `[tool.fastapi-fastkit]` in pyproject.toml to indicate managed projects.
- Enhanced the `is_fastkit_project` function to detect FastAPI-fastkit projects using both the new TOML structure and legacy setup.py markers.
- Added comprehensive tests for the new detection logic, ensuring compatibility with existing templates and structures.
- Improved error handling and validation for project structure checks, particularly for templates with missing metadata files.
- Refactored tests to ensure clarity and maintainability, including checks for dependencies in pyproject.toml and legacy setup.py files.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,21 @@
1
1
# Changelog
2
2
3
+
## v1.3.0 (Unreleased)
4
+
5
+
### Maintenances
6
+
7
+
-**Modernize template contract to be pyproject-first** (#42)
8
+
- Template inspection now accepts `pyproject.toml-tpl` (PEP 621) as the primary metadata file. A template passes structural validation as long as `tests/`, `README.md-tpl`, and **at least one** of `pyproject.toml-tpl` / `setup.py-tpl` are present. `requirements.txt-tpl` is no longer strictly required when `pyproject.toml-tpl` declares `[project].dependencies`.
9
+
-`_check_dependencies` consults every available source (`requirements.txt-tpl`, `pyproject.toml-tpl``[project].dependencies`, `setup.py-tpl``install_requires`) independently and passes if **any** one declares `fastapi`. A template with a stale `requirements.txt-tpl` is no longer rejected when its `pyproject.toml-tpl` is authoritative.
10
+
-`read_template_stack` gained a pyproject fallback between the existing `requirements.txt-tpl` and `setup.py-tpl` paths; legacy templates resolve dependencies exactly as before.
11
+
- Template authoring docs (`src/fastapi_fastkit/fastapi_project_template/README.md`, `docs/en/contributing/template-creation-guide.md`, `docs/en/reference/template-quality-assurance.md`) now describe required vs optional files under the pyproject-first contract.
12
+
- Added focused tests for the new rules (pyproject-only structural and dependency validation, setup.py-only legacy validation, pyproject fallback in `read_template_stack`, and `requirements.txt-tpl`-over-pyproject precedence).
13
+
-**Pyproject-aware project identity detection** (follow-up to #42)
14
+
-`is_fastkit_project()` now recognises FastAPI-fastkit-managed projects from `pyproject.toml` in addition to legacy `setup.py`. Detection precedence: `[tool.fastapi-fastkit].managed = true` → `[project].description` contains the `[FastAPI-fastkit templated]` marker (case-insensitive) → `setup.py` contains `fastapi-fastkit` (case-insensitive). Keeps the pre-existing setup.py path working; the new pyproject paths prevent pyproject-only templates from being mistaken for unrelated FastAPI projects in the user's workspace.
15
+
- Canonical marker strings (`[FastAPI-fastkit templated]` and the `[tool.fastapi-fastkit]` table key `fastapi-fastkit`) are exported from `fastapi_fastkit.utils.main` as `FASTKIT_DESCRIPTION_MARKER` / `FASTKIT_TOOL_SECTION` so templates, metadata injection, and detection all reference the same strings.
16
+
-`_process_pyproject_file` idempotently ensures the description marker and `[tool.fastapi-fastkit]\nmanaged = true` section are present after placeholder replacement, providing a safety net when a template author forgets to include them.
17
+
- All 8 shipped `pyproject.toml-tpl` templates updated to carry `description = "[FastAPI-fastkit templated] <description>"` and a `[tool.fastapi-fastkit]` table with `managed = true`.
0 commit comments