Skip to content

Commit a903ff6

Browse files
committed
[DOCS] update core docs
1 parent f32d505 commit a903ff6

File tree

6 files changed

+378
-59
lines changed

6 files changed

+378
-59
lines changed

CONTRIBUTING.md

Lines changed: 156 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -20,52 +20,151 @@ This document will also be a good indicator for you to gain insight into the dir
2020

2121
FastAPI-fastkit uses following stacks:
2222

23-
- Python 3.12.4
24-
- click 8.1.7
25-
- rich 13.9.2
23+
- Python 3.12+
24+
- click 8.1.7+
25+
- rich 13.9.2+
2626
- pre-commit
27+
- pytest for testing
28+
- black for code formatting
29+
- isort for import sorting
30+
- mypy for static type checking
2731

28-
### Local dev configuration
32+
### Quick Setup with Makefile
33+
34+
The easiest way to set up your development environment is using our Makefile:
2935

3036
1. Clone repository:
3137

3238
```bash
3339
git clone https://github.com/bnbong/FastAPI-fastkit.git
40+
cd FastAPI-fastkit
3441
```
3542

36-
2. Set up virtual environment & Install dependencies:
43+
2. Set up complete development environment:
3744

3845
```bash
39-
cd FastAPI-fastkit
40-
41-
python -m venv .venv
42-
source .venv/bin/activate # for Windows, use: .venv\Scripts\activate
43-
44-
pip install -r requirements.txt
46+
make dev-setup
4547
```
4648

47-
### Linting & Formatting
49+
This single command will:
50+
- Upgrade pip to the latest version
51+
- Install the package in development mode with all dev dependencies
52+
- Install documentation dependencies
53+
- Set up pre-commit hooks
54+
- Create a ready-to-use development environment
55+
56+
### Manual Setup (Alternative)
4857

49-
Use these tools for code quality:
58+
If you prefer manual setup or need more control:
5059

51-
1. Black: Code formatting
60+
1. Create and activate virtual environment:
5261

5362
```bash
54-
bash scripts/format.sh
63+
python -m venv .venv
64+
source .venv/bin/activate # for Windows, use: .venv\Scripts\activate
5565
```
5666

57-
2. isort: Import sorting
67+
2. Install development dependencies:
5868

5969
```bash
60-
bash scripts/sort.sh
70+
make install-dev
6171
```
6272

63-
3. mypy: Static type checking
73+
### Available Development Commands
74+
75+
Use `make help` to see all available development commands:
6476

6577
```bash
66-
bash scripts/lint.sh
78+
make help
6779
```
6880

81+
Key commands for contributors:
82+
83+
#### Development Workflow
84+
- `make dev-setup` - Complete development environment setup
85+
- `make dev-check` - Run all development checks (format, lint, test)
86+
- `make dev-fix` - Fix formatting and run tests
87+
- `make quick-test` - Quick test after code changes
88+
89+
#### Code Quality
90+
- `make format` - Format code using black and isort
91+
- `make format-check` - Check code formatting without making changes
92+
- `make lint` - Run all linting checks (isort, black, mypy)
93+
94+
#### Testing
95+
- `make test` - Run all tests
96+
- `make test-verbose` - Run tests with verbose output
97+
- `make test-coverage` - Run tests with coverage report
98+
99+
#### Installation and Building
100+
- `make install-test` - Install package for testing (uninstall + reinstall)
101+
- `make clean` - Clean build artifacts and cache files
102+
- `make build` - Build the package
103+
104+
#### Documentation
105+
- `make build-docs` - Build documentation
106+
- `make serve-docs` - Serve documentation locally
107+
108+
### Development Workflow
109+
110+
1. **Before making changes:**
111+
```bash
112+
make dev-setup # First time only
113+
make dev-check # Ensure everything is working
114+
```
115+
116+
2. **During development:**
117+
```bash
118+
make quick-test # After making changes
119+
```
120+
121+
3. **Before committing:**
122+
```bash
123+
make dev-check # Final verification
124+
```
125+
126+
### Linting & Formatting
127+
128+
Code quality is maintained using these tools:
129+
130+
1. **Black**: Code formatting
131+
```bash
132+
make format
133+
```
134+
135+
2. **isort**: Import sorting (integrated with black profile)
136+
```bash
137+
# Included in make format
138+
```
139+
140+
3. **mypy**: Static type checking
141+
```bash
142+
make lint
143+
```
144+
145+
4. **All checks together**:
146+
```bash
147+
make dev-check
148+
```
149+
150+
### Testing
151+
152+
Run tests using these commands:
153+
154+
1. **Basic test run:**
155+
```bash
156+
make test
157+
```
158+
159+
2. **Verbose output:**
160+
```bash
161+
make test-verbose
162+
```
163+
164+
3. **Coverage report:**
165+
```bash
166+
make test-coverage
167+
```
69168

70169
### Making PRs
71170

@@ -91,16 +190,19 @@ Example:
91190

92191
#### Pre-commit
93192

94-
You can use pre-commit to automatically run linting, formatting, and type checking before committing.
193+
Pre-commit hooks are automatically installed with `make dev-setup`. The hooks will run automatically when you commit and include:
95194

96-
```bash
97-
# Install pre-commit hooks
98-
pre-commit install
99-
```
195+
- Code formatting (black, isort)
196+
- Linting checks
197+
- Type checking (mypy)
100198

101-
After installing pre-commit hooks, the pre-commit hooks will be run automatically when you commit.
199+
If pre-commit finds issues, fix them and commit again:
102200

103-
Check the pre-commit's output when you making new commit, and fix the code if there are any errors.
201+
```bash
202+
make dev-fix # Fix common issues
203+
git add .
204+
git commit -m "Your commit message"
205+
```
104206

105207
## Documentation
106208

@@ -109,22 +211,6 @@ Follow these documentation guidelines:
109211
1. Docstring for all functions/classes (not necessary, but recommended)
110212
2. Except for translations and typographical corrections, modifications to the core [README.md](README.md), [SECURITY.md](SECURITY.md), [CONTRIBUTING.md](CONTRIBUTING.md), [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) files of the FastAPI-fastkit project itself are prohibited.
111213

112-
## Testing
113-
114-
After writing new tests or modifying existing tests, run these commands to ensure the tests pass:
115-
116-
1. Run tests:
117-
118-
```bash
119-
pytest tests/
120-
```
121-
122-
2. Check coverage:
123-
124-
```bash
125-
pytest --cov=src tests/
126-
```
127-
128214
## Adding new FastAPI-based template project
129215

130216
When adding a new FastAPI template project, follow these guidelines:
@@ -201,31 +287,45 @@ template-name/
201287

202288
### Submission Process
203289

204-
1. Initial Setup:
205-
- Clone or Fork the repository
206-
- Create a new branch for your template
207-
- Follow the template structure
208-
209-
2. Development:
210-
- Implement required features
211-
- Add comprehensive tests
212-
- Document all components
213-
- Run inspector.py validation
214-
215-
3. Pre-submission Checklist:
290+
1. **Initial Setup:**
291+
```bash
292+
git clone https://github.com/bnbong/FastAPI-fastkit.git
293+
cd FastAPI-fastkit
294+
make dev-setup
295+
```
296+
297+
2. **Development:**
298+
```bash
299+
# Create new branch
300+
git checkout -b feature/new-template-name
301+
302+
# Implement your template
303+
# ...
304+
305+
# Run development checks
306+
make dev-check
307+
```
308+
309+
3. **Pre-submission Checklist:**
310+
```bash
311+
make dev-check # Must pass all checks
312+
```
216313
- [ ] All files use .py-tpl extension
217314
- [ ] FastAPI-fastkit dependency included
218315
- [ ] Security requirements met
219316
- [ ] Tests implemented and passing
220317
- [ ] Documentation complete
221318
- [ ] inspector.py validation passes
319+
- [ ] All make dev-check tests pass
222320

223-
4. Pull Request:
321+
4. **Pull Request:**
224322
- Provide detailed description
225-
- Include test results
323+
- Include test results from `make test-coverage`
226324
- Document any special requirements
227325
- Reference related issues
228326

327+
<br>
328+
229329
For more detailed information about security requirements and project guidelines, please refer to:
230330
- [SECURITY.md](SECURITY.md) for security guidelines
231331
- [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for project principles

0 commit comments

Comments
 (0)