It is highly desirable to improve the project to provide better access for users who are new to Python and FastAPI.
Highly appreciate it for your interesting in this project and for your contribution by investing your precious time.
Before contributing to this open source, I strongly recommend that you read the SECURITY.md and CODE_OF_CONDUCT.md files to understand the direction of this project and the precautions for cooperation.
Before get started, you'd better take a look at MILESTONE of this project.
To provide good productivity and quality service, I opened the source code for this project, but the direction of the project must be properly and firmly to provide a good user experience, leaving a milestone for the project officially.
This document will also be a good indicator for you to gain insight into the direction of this project's contribution.
FastAPI-fastkit uses following stacks:
- Python 3.12+
- click 8.1.7+
- rich 13.9.2+
- pre-commit
- pytest for testing
- black for code formatting
- isort for import sorting
- mypy for static type checking
The easiest way to set up your development environment is using our Makefile:
- Clone repository:
git clone https://github.com/bnbong/FastAPI-fastkit.git
cd FastAPI-fastkit- Set up complete development environment:
make dev-setupThis single command will:
- Upgrade pip to the latest version
- Install the package in development mode with all dev dependencies
- Install documentation dependencies
- Set up pre-commit hooks
- Create a ready-to-use development environment
If you prefer manual setup or need more control:
- Create and activate virtual environment:
python -m venv .venv
source .venv/bin/activate # for Windows, use: .venv\Scripts\activate- Install development dependencies:
make install-devUse make help to see all available development commands:
make helpKey commands for contributors:
make dev-setup- Complete development environment setupmake dev-check- Run all development checks (format, lint, test)make dev-fix- Fix formatting and run testsmake quick-test- Quick test after code changes
make format- Format code using black and isortmake format-check- Check code formatting without making changesmake lint- Run all linting checks (isort, black, mypy)
make test- Run all testsmake test-verbose- Run tests with verbose outputmake test-coverage- Run tests with coverage report
make install-test- Install package for testing (uninstall + reinstall)make clean- Clean build artifacts and cache filesmake build- Build the package
make build-docs- Build documentationmake serve-docs- Serve documentation locally
-
Before making changes:
make dev-setup # First time only make dev-check # Ensure everything is working
-
During development:
make quick-test # After making changes -
Before committing:
make dev-check # Final verification
Code quality is maintained using these tools:
-
Black: Code formatting
make format
-
isort: Import sorting (integrated with black profile)
# Included in make format -
mypy: Static type checking
make lint
-
All checks together:
make dev-check
Run tests using these commands:
-
Basic test run:
make test -
Verbose output:
make test-verbose
-
Coverage report:
make test-coverage
Use these tags in PR title:
- [FEAT]: New feature
- [FIX]: Bug fix
- [DOCS]: Documentation changes
- [STYLE]: Code formatting
- [TEST]: Test code
- [REFACTOR]: Code refactoring
- [CHORE]: Build, config changes
Example:
# PR title example 1
'[FEAT] Add new FastAPI template for microservices'
# PR title example 2
'[FIX] Fix virtual environment activation in Windows'Pre-commit hooks are automatically installed with make dev-setup. The hooks will run automatically when you commit and include:
- Code formatting (black, isort)
- Linting checks
- Type checking (mypy)
If pre-commit finds issues, fix them and commit again:
make dev-fix # Fix common issues
git add .
git commit -m "Your commit message"Follow these documentation guidelines:
- Docstring for all functions/classes (not necessary, but recommended)
- Except for translations and typographical corrections, modifications to the core README.md, SECURITY.md, CONTRIBUTING.md, CODE_OF_CONDUCT.md files of the FastAPI-fastkit project itself are prohibited.
When adding a new FastAPI template project, follow these guidelines:
- Directory Structure:
template-name/
├── src/
│ ├── main.py-tpl
│ ├── config/
│ ├── models/
│ ├── routes/
│ └── utils/
├── tests/
├── scripts/
├── requirements.txt-tpl
├── setup.py-tpl
└── README.md-tpl
-
File Extensions:
- All Python source files must use
.py-tplextension - Template files must include proper configuration files (.env-tpl, etc.)
- All Python source files must use
-
Dependencies:
- Include
fastapi-fastkitin setup.py - Specify version numbers in requirements.txt
- Use latest stable versions of dependencies
- Include
-
Implementation Requirements:
- Environment variables management (.env)
- Basic authentication system
- CORS configuration
- Exception handling and logging
-
Security Checks:
- All template code must pass
inspector.pyvalidation - Include security middleware configurations
- Follow security guidelines in SECURITY.md
- All template code must pass
-
README.md Requirements:
- Use PROJECT_README_TEMPLATE.md format
- Include comprehensive setup instructions
- Document all environment variables
- List all major dependencies
- Provide API documentation
-
Code Documentation:
- Include docstrings for all functions/classes
- Document API endpoints
- Include example usage (not necessary, but recommended)
- Provide configuration explanations
FastAPI-fastkit includes automated template testing that provides comprehensive validation:
Zero Configuration Required:
- 🚀 New templates are automatically discovered and tested
- ⚡ No manual test file creation needed
- 🛡️ Consistent quality standards applied
Comprehensive Test Coverage:
- ✅ Project Creation: Template copying and metadata injection
- ✅ Package Manager Support: UV, PDM, Poetry, and PIP compatibility
- ✅ Virtual Environment: Creation and dependency installation
- ✅ Project Structure: File and directory validation
- ✅ FastAPI Integration: Project identification and functionality
Test Execution:
# Test all templates automatically
$ pytest tests/test_templates/test_all_templates.py -v
# Test your specific template
$ pytest tests/test_templates/test_all_templates.py::TestAllTemplates::test_template_creation[your-template-name] -v
# Test with PDM environment
$ pdm run pytest tests/test_templates/test_all_templates.py -vWhile basic functionality is automatically tested, you should include template-specific tests:
-
Required Template Tests:
- Basic CRUD operations (if applicable)
- Authentication/Authorization (if implemented)
- Error handling
- API endpoints
- Configuration validation
-
Test Coverage Goals:
- Minimum 80% code coverage for template-specific logic
- Include integration tests for external services
- API testing examples in template documentation
Test your template with all supported package managers:
# Test with different package managers
$ fastkit startdemo your-template-name --package-manager uv
$ fastkit startdemo your-template-name --package-manager pdm
$ fastkit startdemo your-template-name --package-manager poetry
$ fastkit startdemo your-template-name --package-manager pip-
Initial Setup:
git clone https://github.com/bnbong/FastAPI-fastkit.git cd FastAPI-fastkit make dev-setup -
Development:
# Create new branch git checkout -b feature/new-template-name # Implement your template # ... # Run development checks make dev-check
-
Pre-submission Checklist:
make dev-check # Must pass all checks- All files use .py-tpl extension
- FastAPI-fastkit dependency included
- Security requirements met
- Documentation complete
- inspector.py validation passes
- All make dev-check tests pass
- Automatic template tests pass (new templates tested automatically)
- Package manager compatibility verified (tested with UV, PDM, Poetry, PIP)
- Template-specific functionality tested (if applicable)
-
Pull Request:
- Provide detailed description
- Include test results from
make test-coverage - Document any special requirements
- Reference related issues
For more detailed information about security requirements and project guidelines, please refer to:
- SECURITY.md for security guidelines
- CODE_OF_CONDUCT.md for project principles
If you look at source codes, you will see a commentary at the top of the module that describes about the module.
In that section, I have my information as the manager of this project as author, but that doesn't mean I'm the only one who can modify the module.
I emphasize that the reason I left my information in the comment section is to specify the information about the project's final director and not to increase the barriers to entry into the open source contribution of other contributors.
However, I would like to inform you that I have only the right to modify the document file content itself of FastAPI-fastkit project's core documents (README.md, SECURITY.md, CODE_OF_CONDUCT.md, CONTRIBUTING.md) file.
If the contribution to the project includes the document contribution except translation and typographical corrections, there is a possibility that PR will be rejected.
@author bnbong bbbong9@gmail.com
