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
2. Set up virtual environment & Install dependencies:
43
+
2. Set up complete development environment:
37
44
38
45
```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
45
47
```
46
48
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)
48
57
49
-
Use these tools for code quality:
58
+
If you prefer manual setup or need more control:
50
59
51
-
1.Black: Code formatting
60
+
1.Create and activate virtual environment:
52
61
53
62
```bash
54
-
bash scripts/format.sh
63
+
python -m venv .venv
64
+
source .venv/bin/activate # for Windows, use: .venv\Scripts\activate
55
65
```
56
66
57
-
2.isort: Import sorting
67
+
2.Install development dependencies:
58
68
59
69
```bash
60
-
bash scripts/sort.sh
70
+
make install-dev
61
71
```
62
72
63
-
3. mypy: Static type checking
73
+
### Available Development Commands
74
+
75
+
Use `make help` to see all available development commands:
64
76
65
77
```bash
66
-
bash scripts/lint.sh
78
+
make help
67
79
```
68
80
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
+
```
69
168
70
169
### Making PRs
71
170
@@ -91,16 +190,19 @@ Example:
91
190
92
191
#### Pre-commit
93
192
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:
95
194
96
-
```bash
97
-
# Install pre-commit hooks
98
-
pre-commit install
99
-
```
195
+
- Code formatting (black, isort)
196
+
- Linting checks
197
+
- Type checking (mypy)
100
198
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:
102
200
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
+
```
104
206
105
207
## Documentation
106
208
@@ -109,22 +211,6 @@ Follow these documentation guidelines:
109
211
1. Docstring for all functions/classes (not necessary, but recommended)
110
212
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.
111
213
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
-
128
214
## Adding new FastAPI-based template project
129
215
130
216
When adding a new FastAPI template project, follow these guidelines:
0 commit comments