Skip to content

Commit f914c70

Browse files
authored
Merge pull request #40 from bnbong/dev
[RELEASE, DOCS, FIX] Fix fastkit init flow, address security advisories & review findings
2 parents 82b59dd + 9cbf801 commit f914c70

23 files changed

Lines changed: 1423 additions & 670 deletions

docs/en/contributing/code-guidelines.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,20 @@ def validate_email(e):
144144

145145
```python
146146
# Good ✅
147-
class ProjectTemplate:
148-
"""Represents a FastAPI project template."""
147+
class SomeClass:
148+
"""Represents example class of FastAPI-fastkit."""
149149
pass
150150

151-
class TemplateValidationError(Exception):
152-
"""Raised when template validation fails."""
151+
class SomeClassValidationError(Exception):
152+
"""Raised when example class validation fails."""
153153
pass
154154

155155
class UserInputHandler:
156156
"""Handles user input validation and processing."""
157157
pass
158158

159159
# Bad ❌
160-
class Template:
160+
class Class:
161161
pass
162162

163163
class Error(Exception):
@@ -409,6 +409,10 @@ def test_file_creation_with_permission_error(mock_open):
409409

410410
### Import Organization
411411

412+
!!! note
413+
414+
`isort` formatter will automatically organize imports, so you can organize imports easily just run `bash scripts/format.sh`.
415+
412416
1. **Standard library** imports first
413417
2. **Third-party** imports second
414418
3. **Local application** imports last
@@ -705,7 +709,9 @@ ci:
705709
autoupdate_commit_msg: ⬆ [pre-commit.ci] pre-commit autoupdate
706710
```
707711
708-
> **Note:** Pre-commit hooks use isolated Python environments (`language: python`).
712+
!!! note
713+
714+
Pre-commit hooks use isolated Python environments (`language: python`).
709715
710716
### IDE Configuration
711717

docs/en/contributing/development-setup.md

Lines changed: 54 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ This single command:
3535
- Sets up pre-commit hooks
3636
- Configures development tools
3737

38-
> **Note:** You should create and activate a virtual environment before running this command.
38+
!!! note
39+
40+
You should create and activate a virtual environment before running this command.
3941

4042
## Manual Setup
4143

@@ -95,7 +97,7 @@ pre-commit installed at .git/hooks/pre-commit
9597

9698
```console
9799
$ fastkit --version
98-
FastAPI-fastkit version 1.0.0-dev
100+
fastapi-fastkit, version 1.2.0
99101

100102
$ python -m pytest tests/
101103
======================== test session starts ========================
@@ -112,6 +114,25 @@ tests/test_templates.py::test_template_listing PASSED
112114

113115
The development environment includes several tools to maintain code quality:
114116

117+
### One-liner Commands
118+
119+
using Makefile:
120+
121+
```console
122+
$ make format lint
123+
Running isort...
124+
Running black...
125+
Running mypy...
126+
✅ All checks passed!
127+
```
128+
129+
using provided scripts:
130+
131+
```console
132+
$ ./scripts/format.sh
133+
$ ./scripts/lint.sh
134+
```
135+
115136
### Code Formatting
116137

117138
**Black** - Code formatter:
@@ -328,25 +349,23 @@ FastAPI-fastkit/
328349

329350
### Key Directories
330351

331-
**`src/fastapi_fastkit/`** - Main package source code
332-
- **`cli.py`** - Main CLI entry point
333-
- **`backend/`** - Core backend logic
334-
- **`inspector.py`** - Template inspector
335-
- **`interactive/`** - Interactive mode components (prompts, selectors, validators)
336-
- **`package_managers/`** - Package manager implementations (pip, uv, pdm, poetry)
337-
- **`project_builder/`** - Project building utilities
338-
- **`transducer.py`** - Template transducer
339-
- **`core/`** - Core configuration and exceptions
340-
- **`fastapi_project_template/`** - Project templates (fastapi-default, fastapi-async-crud, etc.)
341-
- **`utils/`** - Shared utility functions
342-
343-
**`tests/`** - Test suite
344-
- **`test_backends/`** - Backend-specific tests
345-
- **`test_cli_operations/`** - CLI operation tests
346-
- **`test_templates/`** - Template system tests
347-
348-
**`docs/`** - Documentation (MkDocs)
349-
- User guides, tutorials, and API reference
352+
- **`src/fastapi_fastkit/`** - Main package source code
353+
- **`cli.py`** - Main CLI entry point
354+
- **`backend/`** - Core backend logic
355+
- **`inspector.py`** - Template inspector
356+
- **`interactive/`** - Interactive mode components (prompts, selectors, validators)
357+
- **`package_managers/`** - Package manager implementations (pip, uv, pdm, poetry)
358+
- **`project_builder/`** - Project building utilities
359+
- **`transducer.py`** - Template transducer
360+
- **`core/`** - Core configuration and exceptions
361+
- **`fastapi_project_template/`** - Project templates (fastapi-default, fastapi-async-crud, etc.)
362+
- **`utils/`** - Shared utility functions
363+
- **`tests/`** - Test suite
364+
- **`test_backends/`** - Backend-specific tests
365+
- **`test_cli_operations/`** - CLI operation tests
366+
- **`test_templates/`** - Template system tests
367+
- **`docs/`** - Documentation (MkDocs)
368+
- User guides, tutorials, and API reference
350369

351370
## Development Workflow
352371

@@ -370,10 +389,10 @@ Edit code, add features, fix bugs...
370389
<div class="termy">
371390

372391
```console
373-
$ make check-all test
392+
$ make dev-check
374393
Running all quality checks...
375394
Running all tests...
376-
✅ All checks and tests passed!
395+
✅ All tests passed!
377396
```
378397

379398
</div>
@@ -445,18 +464,6 @@ $ python -m pytest --cov=src --cov-report=html
445464

446465
</div>
447466

448-
**Watch mode for development:**
449-
450-
<div class="termy">
451-
452-
```console
453-
$ make test-watch
454-
# or
455-
$ ptw tests/
456-
```
457-
458-
</div>
459-
460467
### Writing Tests
461468

462469
When adding new features, always include tests:
@@ -530,7 +537,7 @@ def test_full_project_creation_workflow(tmp_path):
530537
<div class="termy">
531538

532539
```console
533-
$ make docs-serve
540+
$ make serve-docs
534541
INFO - Building documentation...
535542
INFO - Cleaning site directory
536543
INFO - Documentation built in 0.43 seconds
@@ -544,7 +551,7 @@ INFO - [14:30:00] Serving on http://127.0.0.1:8000/
544551
<div class="termy">
545552

546553
```console
547-
$ make docs-build
554+
$ make build-docs
548555
INFO - Building documentation...
549556
INFO - Documentation built in 0.43 seconds
550557
```
@@ -582,6 +589,8 @@ $ fastkit new-feature --option value
582589
Use `--help` to see all available options.
583590
````
584591

592+
For detailed reference about using `mkdocs-material`, see [mkdocs-material documentation](https://squidfunk.github.io/mkdocs-material/reference/admonitions/).
593+
585594
## Code Style Guidelines
586595

587596
### Python Code Style
@@ -717,19 +726,18 @@ $ pip install -e .
717726

718727
### Getting Help
719728

720-
- **GitHub Issues**: Report bugs and request features
721-
- **GitHub Discussions**: Ask questions and share ideas
729+
- **[GitHub Issues](https://github.com/bnbong/FastAPI-fastkit/issues)**: Report bugs and request features
730+
- **[GitHub Discussions](https://github.com/bnbong/FastAPI-fastkit/discussions)**: Ask questions and share ideas
722731
- **Documentation**: Check the [User Guide](../user-guide/installation.md)
723732

724733
## Contributing Guidelines
725734

726735
### Before Submitting a PR
727736

728-
1. **Run all checks:** `make check-all test`
737+
1. **Run all checks:** `make dev-check`
729738
2. **Update documentation** if needed
730739
3. **Add tests** for new features
731-
4. **Update CHANGELOG.md**
732-
5. **Follow commit message conventions**
740+
4. **Follow commit message conventions**
733741

734742
### Commit Message Format
735743

@@ -793,15 +801,15 @@ $ git push origin v1.2.0
793801

794802
Now that your development environment is set up:
795803

796-
1. **Explore the codebase** to understand the architecture
804+
1. **[Explore the codebase](https://github.com/bnbong/FastAPI-fastkit/tree/main/src/fastapi_fastkit)** to understand the architecture
797805
2. **Run the test suite** to ensure everything works
798-
3. **Pick an issue** from GitHub to work on
799-
4. **Join discussions** to connect with other contributors
806+
3. **Pick an [issue](https://github.com/bnbong/FastAPI-fastkit/issues)** from GitHub to work on
807+
4. **Join [discussions](https://github.com/bnbong/FastAPI-fastkit/discussions)** to connect with other contributors
800808

801809
Happy coding! 🚀
802810

803811
!!! tip "Development Tips"
804-
- Use `make check-all` before committing
812+
- Use `make dev-check` before committing
805813
- Write tests first (TDD approach)
806814
- Keep commits small and focused
807815
- Update documentation with new features

docs/en/contributing/template-creation-guide.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Adding a new template follows a 5-step process:
1515
## 📋 Step 1: Planning & Design
1616

1717
### Define Template Purpose
18+
1819
Before creating a new template, answer these questions:
1920

2021
- **What is the unique value of this template?**
@@ -34,6 +35,7 @@ Examples:
3435
- `fastapi-auth-jwt` (JWT authentication template)
3536

3637
### Technology Stack Planning
38+
3739
Pre-define the main technologies to include:
3840

3941
```yaml
@@ -226,6 +228,7 @@ setup(
226228
```
227229

228230
#### 4. Writing Test Files
231+
229232
```python
230233
# tests/test_items.py-tpl
231234
"""
@@ -285,32 +288,39 @@ make inspect-template TEMPLATES="fastapi-your-template"
285288
python scripts/inspect-templates.py --templates "fastapi-your-template" --verbose
286289
```
287290

288-
> **Note:** When you submit a PR, the **Template PR Inspection** workflow will automatically run and validate your template changes. You'll receive feedback directly on your PR.
291+
!!! note
292+
293+
When you submit a PR, the **Template PR Inspection** workflow will automatically run and validate your template changes. You'll receive feedback directly on your PR.
289294

290295
### Validation Checklist
291296

292297
The inspector automatically validates the following items:
293298

294299
#### ✅ File Structure Validation
300+
295301
- [ ] `tests/` directory exists
296302
- [ ] `requirements.txt-tpl` file exists
297303
- [ ] `setup.py-tpl` file exists
298304
- [ ] `README.md-tpl` file exists
299305

300306
#### ✅ File Extension Validation
307+
301308
- [ ] All Python files use `.py-tpl` extension
302309
- [ ] No `.py` extension files exist
303310

304311
#### ✅ Dependencies Validation
312+
305313
- [ ] `requirements.txt-tpl` includes `fastapi`
306314
- [ ] `setup.py-tpl`'s `install_requires` includes `fastapi`
307315
- [ ] `setup.py-tpl`'s description includes `[fastapi-fastkit templated]`
308316

309317
#### ✅ FastAPI Implementation Validation
318+
310319
- [ ] `FastAPI` import exists in `main.py-tpl`
311320
- [ ] App creation like `app = FastAPI()` exists in `main.py-tpl`
312321

313322
#### ✅ Test Execution Validation
323+
314324
- [ ] Virtual environment creation successful
315325
- [ ] Dependencies installation successful
316326
- [ ] All pytest tests pass
@@ -345,7 +355,7 @@ New templates are **automatically discovered** and tested without manual configu
345355
4.**Comprehensive Validation**: Structure, metadata, and functionality checks
346356

347357
**What This Means for You:**
348-
- 🚀 **No Additional Test Files**: Your template is tested automatically
358+
- 🚀 **No Additional Test Files at `FastAPI-fastkit`'s main source testcases**: Your template is tested automatically
349359
-**Faster Development**: Focus on template content, not test setup
350360
- 🛡️ **Quality Assurance**: Consistent testing across all templates
351361
- 🔄 **CI/CD Integration**: Automatic testing in pull requests
@@ -374,18 +384,21 @@ $ fastkit startdemo your-template-name --package-manager uv
374384
In addition to automated validation, manually check the following items:
375385

376386
#### 🔧 Code Quality
387+
377388
- [ ] Code follows PEP 8 style guide
378389
- [ ] Appropriate type hints usage
379390
- [ ] Meaningful variable and function names
380391
- [ ] Proper comments and docstrings
381392

382393
#### 🏗️ Architecture
394+
383395
- [ ] Separation of concerns (API, business logic, data access separation)
384396
- [ ] Reusable component design
385397
- [ ] Scalable structure
386398
- [ ] Security best practices applied
387399

388400
#### 📚 Documentation
401+
389402
- [ ] README.md-tpl follows PROJECT_README_TEMPLATE.md format
390403
- [ ] Installation and execution methods specified
391404
- [ ] API documentation (OpenAPI/Swagger)
@@ -430,7 +443,7 @@ Write a brief description and use cases for your new template here.
430443
### PR Title and Description
431444

432445
```
433-
[FEAT] Add fastapi-{template-name} template
446+
[TEMPLATE] Add fastapi-{template-name} template
434447
435448
## Overview
436449
Adds a new {purpose} template.
@@ -465,23 +478,28 @@ Closes #issue-number
465478
4. **Documentation Review**: Review documentation accuracy and completeness
466479
5. **Approval & Merge**: Merge to main branch when all requirements are satisfied
467480

468-
> 💡 **Tip:** You'll receive automatic PR comments with validation results. Check these before requesting a review!
481+
!!! note
482+
483+
You'll receive automatic PR comments with validation results. Check these before requesting a review!
469484

470485
## 🎯 Best Practices
471486

472487
### Security Considerations
488+
473489
- Manage sensitive information with environment variables
474490
- Proper CORS configuration
475491
- Input data validation
476492
- SQL injection prevention
477493

478494
### Performance Optimization
495+
479496
- Utilize asynchronous processing
480497
- Optimize database queries
481498
- Appropriate caching strategies
482499
- Response compression settings
483500

484501
### Maintainability
502+
485503
- Clear code structure
486504
- Comprehensive test coverage
487505
- Detailed documentation

docs/en/contributing/translation-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ The script will create a Pull Request with the translations. Review the PR:
186186
3. Ensure code examples remain unchanged
187187
4. Check for language-specific issues
188188

189-
### 4. Approve and Merge
189+
### 4. Approve and Merge (for maintainers)
190190

191191
Once the translation is verified:
192192

0 commit comments

Comments
 (0)