fastapi-gen 0.9.0__tar.gz → 0.9.3.dev4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/PKG-INFO +79 -77
- fastapi_gen-0.9.3.dev4/README.md +259 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/pyproject.toml +39 -8
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/cli/__main__.py +25 -9
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/advanced/README.md +55 -55
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/advanced/main.py +75 -14
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/advanced/requirements.txt +8 -8
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/advanced/tests/test_main.py +38 -1
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/hello_world/README.md +37 -37
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/hello_world/main.py +6 -0
- fastapi_gen-0.9.3.dev4/src/templates/hello_world/requirements.txt +8 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/hello_world/tests/test_main.py +2 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/langchain/README.md +52 -52
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/langchain/main.py +9 -7
- fastapi_gen-0.9.3.dev4/src/templates/langchain/requirements.txt +14 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/llama/Makefile +12 -1
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/llama/README.md +56 -56
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/llama/main.py +7 -7
- fastapi_gen-0.9.3.dev4/src/templates/llama/requirements.txt +8 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/llama/tests/test_main.py +6 -18
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/nlp/Makefile +4 -1
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/nlp/README.md +58 -58
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/nlp/conftest.py +2 -1
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/nlp/main.py +12 -14
- fastapi_gen-0.9.3.dev4/src/templates/nlp/requirements.txt +11 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/nlp/tests/test_main.py +17 -51
- fastapi_gen-0.9.0/README.md +0 -259
- fastapi_gen-0.9.0/src/cli/__about__.py +0 -1
- fastapi_gen-0.9.0/src/templates/hello_world/.env_dev +0 -1
- fastapi_gen-0.9.0/src/templates/hello_world/requirements.txt +0 -8
- fastapi_gen-0.9.0/src/templates/langchain/.env_dev +0 -2
- fastapi_gen-0.9.0/src/templates/langchain/requirements.txt +0 -15
- fastapi_gen-0.9.0/src/templates/llama/.env_dev +0 -7
- fastapi_gen-0.9.0/src/templates/llama/requirements.txt +0 -8
- fastapi_gen-0.9.0/src/templates/nlp/.env_dev +0 -37
- fastapi_gen-0.9.0/src/templates/nlp/requirements.txt +0 -12
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/.gitignore +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/LICENSE +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/__init__.py +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/cli/__init__.py +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/__init__.py +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/advanced/Makefile +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/advanced/__init__.py +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/advanced/ruff.toml +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/advanced/tests/__init__.py +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/hello_world/.gitignore +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/hello_world/Makefile +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/hello_world/__init__.py +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/hello_world/tests/__init__.py +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/langchain/.gitignore +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/langchain/Makefile +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/langchain/__init__.py +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/langchain/ruff.toml +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/langchain/tests/__init__.py +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/langchain/tests/test_main.py +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/llama/.gitignore +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/llama/__init__.py +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/llama/models/.gitkeep +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/llama/ruff.toml +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/llama/tests/__init__.py +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/nlp/.gitignore +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/nlp/__init__.py +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/nlp/ruff.toml +0 -0
- {fastapi_gen-0.9.0 → fastapi_gen-0.9.3.dev4}/src/templates/nlp/tests/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-gen
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.3.dev4
|
|
4
4
|
Summary: Set up a modern REST API by running one command.
|
|
5
5
|
Project-URL: Documentation, https://github.com/mirpo/fastapi-gen#readme
|
|
6
6
|
Project-URL: Issues, https://github.com/mirpo/fastapi-gen/issues
|
|
@@ -34,17 +34,19 @@ Classifier: Topic :: Software Development :: Libraries
|
|
|
34
34
|
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
35
35
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
36
36
|
Classifier: Typing :: Typed
|
|
37
|
-
Requires-Python: >=3.
|
|
38
|
-
Requires-Dist: click==8.
|
|
37
|
+
Requires-Python: >=3.11
|
|
38
|
+
Requires-Dist: click==8.3.0
|
|
39
39
|
Requires-Dist: colorama==0.4.6
|
|
40
40
|
Requires-Dist: importlib-resources==6.5.2
|
|
41
41
|
Provides-Extra: dev
|
|
42
|
-
Requires-Dist:
|
|
42
|
+
Requires-Dist: coverage[toml]==7.11.0; extra == 'dev'
|
|
43
|
+
Requires-Dist: pytest==8.4.2; extra == 'dev'
|
|
44
|
+
Requires-Dist: ruff==0.14.1; extra == 'dev'
|
|
43
45
|
Description-Content-Type: text/markdown
|
|
44
46
|
|
|
45
47
|
<div align="center">
|
|
46
48
|
|
|
47
|
-
#
|
|
49
|
+
# FastAPI Gen
|
|
48
50
|
|
|
49
51
|
**Create production-ready FastAPI applications in seconds**
|
|
50
52
|
|
|
@@ -70,7 +72,7 @@ Description-Content-Type: text/markdown
|
|
|
70
72
|
|
|
71
73
|
</div>
|
|
72
74
|
|
|
73
|
-
##
|
|
75
|
+
## Quick Start
|
|
74
76
|
|
|
75
77
|
Get a fully functional FastAPI app running in **30 seconds**:
|
|
76
78
|
|
|
@@ -91,15 +93,15 @@ pipx run fastapi-gen my_app
|
|
|
91
93
|
cd my_app && make start
|
|
92
94
|
```
|
|
93
95
|
|
|
94
|
-
|
|
96
|
+
**That's it!** Open [http://localhost:8000/docs](http://localhost:8000/docs) to see your OpenAPI documentation.
|
|
95
97
|
|
|
96
|
-
>
|
|
98
|
+
> **Platform Support:** Works on macOS and Linux | [Report Issues](https://github.com/mirpo/fastapi-gen/issues/new)
|
|
97
99
|
|
|
98
|
-
##
|
|
100
|
+
## Why FastAPI Gen?
|
|
99
101
|
|
|
100
102
|
<div align="center">
|
|
101
103
|
|
|
102
|
-
|
|
|
104
|
+
| **Focus on Code** | **Production Ready** | **Testing Included** | **Zero Config** |
|
|
103
105
|
|:---:|:---:|:---:|:---:|
|
|
104
106
|
| Skip boilerplate setup | Enterprise patterns | Real test coverage | Ready-to-run templates |
|
|
105
107
|
|
|
@@ -107,94 +109,94 @@ cd my_app && make start
|
|
|
107
109
|
|
|
108
110
|
---
|
|
109
111
|
|
|
110
|
-
##
|
|
112
|
+
## Templates Overview
|
|
111
113
|
|
|
112
114
|
<details>
|
|
113
|
-
<summary><strong
|
|
115
|
+
<summary><strong>Hello World</strong> - Perfect for Learning FastAPI</summary>
|
|
114
116
|
|
|
115
|
-
|
|
117
|
+
**Best for:** Learning FastAPI fundamentals and starting new projects
|
|
116
118
|
|
|
117
|
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
119
|
+
**Key Features:**
|
|
120
|
+
- **REST API Fundamentals** - Complete CRUD with validation
|
|
121
|
+
- **Configuration Management** - Both pydantic-settings & dotenv
|
|
122
|
+
- **Dependency Injection** - Clean architecture with `Depends()`
|
|
123
|
+
- **Background Tasks** - Async processing with logging
|
|
124
|
+
- **Exception Handling** - Professional error responses
|
|
125
|
+
- **Input Validation** - Advanced Pydantic constraints
|
|
126
|
+
- **Health Monitoring** - Built-in health endpoints
|
|
127
|
+
- **Complete Tests** - 100% test coverage
|
|
126
128
|
|
|
127
129
|
[📖 View Details →](src/templates/hello_world/README.md)
|
|
128
130
|
|
|
129
131
|
</details>
|
|
130
132
|
|
|
131
133
|
<details>
|
|
132
|
-
<summary><strong
|
|
134
|
+
<summary><strong>Advanced</strong> - Enterprise Production Template</summary>
|
|
133
135
|
|
|
134
|
-
|
|
136
|
+
**Best for:** Production applications with enterprise features
|
|
135
137
|
|
|
136
|
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
138
|
+
**Key Features:**
|
|
139
|
+
- **JWT Authentication** - Registration, login, protected routes
|
|
140
|
+
- **Database Integration** - SQLAlchemy 2.0 async (SQLite/PostgreSQL)
|
|
141
|
+
- **Rate Limiting** - DDoS protection per endpoint
|
|
142
|
+
- **Caching System** - In-memory + Redis integration ready
|
|
143
|
+
- **WebSocket Support** - Real-time communication
|
|
144
|
+
- **File Upload** - Secure handling + cloud storage ready
|
|
145
|
+
- **Enhanced Security** - CORS, validation, production patterns
|
|
146
|
+
- **Full Test Suite** - Auth, CRUD, WebSocket, integration
|
|
145
147
|
|
|
146
148
|
[📖 View Details →](src/templates/advanced/README.md)
|
|
147
149
|
|
|
148
150
|
</details>
|
|
149
151
|
|
|
150
152
|
<details>
|
|
151
|
-
<summary><strong
|
|
153
|
+
<summary><strong>NLP</strong> - Comprehensive AI Language Processing</summary>
|
|
152
154
|
|
|
153
|
-
|
|
155
|
+
**Best for:** AI applications with natural language processing
|
|
154
156
|
|
|
155
|
-
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
-
|
|
160
|
-
-
|
|
161
|
-
-
|
|
157
|
+
**Key Features:**
|
|
158
|
+
- **8 NLP Capabilities** - Summarization, NER, generation, QA, embeddings, sentiment, classification, similarity
|
|
159
|
+
- **Production Architecture** - Startup model loading, device auto-detection
|
|
160
|
+
- **Smart Configuration** - Environment-based config, multiple models
|
|
161
|
+
- **Performance Optimized** - Model caching, concurrent handling, hardware acceleration
|
|
162
|
+
- **Production Monitoring** - Health checks, model status, logging
|
|
163
|
+
- **Real AI Testing** - Actual model inference validation
|
|
162
164
|
|
|
163
165
|
[📖 View Details →](src/templates/nlp/README.md)
|
|
164
166
|
|
|
165
167
|
</details>
|
|
166
168
|
|
|
167
169
|
<details>
|
|
168
|
-
<summary><strong
|
|
170
|
+
<summary><strong>LangChain</strong> - Modern LLM Integration</summary>
|
|
169
171
|
|
|
170
|
-
|
|
172
|
+
**Best for:** Applications using LangChain for LLM workflows
|
|
171
173
|
|
|
172
|
-
|
|
173
|
-
-
|
|
174
|
-
-
|
|
175
|
-
-
|
|
176
|
-
-
|
|
177
|
-
-
|
|
178
|
-
-
|
|
174
|
+
**Key Features:**
|
|
175
|
+
- **Optimized Loading** - Startup caching, memory management
|
|
176
|
+
- **Modern Patterns** - Latest LangChain best practices
|
|
177
|
+
- **Smart Config** - Auto device detection (CPU/GPU)
|
|
178
|
+
- **Production Ready** - Health checks, monitoring, error handling
|
|
179
|
+
- **Real Testing** - Actual model inference tests
|
|
180
|
+
- **Dual Endpoints** - Text generation & question answering
|
|
179
181
|
|
|
180
182
|
[📖 View Details →](src/templates/langchain/README.md)
|
|
181
183
|
|
|
182
184
|
</details>
|
|
183
185
|
|
|
184
186
|
<details>
|
|
185
|
-
<summary><strong
|
|
187
|
+
<summary><strong>Llama</strong> - Local LLM Powerhouse</summary>
|
|
186
188
|
|
|
187
|
-
|
|
189
|
+
**Best for:** Local LLM inference with llama-cpp-python
|
|
188
190
|
|
|
189
|
-
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
-
|
|
193
|
-
-
|
|
194
|
-
-
|
|
195
|
-
-
|
|
191
|
+
**Key Features:**
|
|
192
|
+
- **Local LLM Focus** - Optimized for Gemma/Llama GGUF models
|
|
193
|
+
- **GPU Acceleration** - Auto GPU detection, configurable layers
|
|
194
|
+
- **Advanced Config** - Context windows, threading, performance tuning
|
|
195
|
+
- **Production Ready** - Lifecycle management, health monitoring
|
|
196
|
+
- **Real Testing** - Actual model inference validation
|
|
197
|
+
- **Easy Setup** - Auto model download, optimized defaults
|
|
196
198
|
|
|
197
|
-
>
|
|
199
|
+
> **Requirements:** ~4GB model download + 4GB+ RAM
|
|
198
200
|
|
|
199
201
|
[📖 View Details →](src/templates/llama/README.md)
|
|
200
202
|
|
|
@@ -202,25 +204,25 @@ cd my_app && make start
|
|
|
202
204
|
|
|
203
205
|
---
|
|
204
206
|
|
|
205
|
-
##
|
|
207
|
+
## Template Comparison
|
|
206
208
|
|
|
207
209
|
| Template | Best For | Complexity | AI/ML | Database | Auth |
|
|
208
210
|
|----------|----------|------------|--------|----------|------|
|
|
209
|
-
|
|
|
210
|
-
|
|
|
211
|
-
|
|
|
212
|
-
|
|
|
213
|
-
|
|
|
211
|
+
| **Hello World** | Learning, Simple APIs | ⭐ | ❌ | ❌ | ❌ |
|
|
212
|
+
| **Advanced** | Production Apps | ⭐⭐⭐ | ❌ | ✅ | ✅ |
|
|
213
|
+
| **NLP** | AI Text Processing | ⭐⭐⭐⭐ | ✅ | ❌ | ❌ |
|
|
214
|
+
| **LangChain** | LLM Workflows | ⭐⭐⭐⭐ | ✅ | ❌ | ❌ |
|
|
215
|
+
| **Llama** | Local LLM | ⭐⭐⭐⭐⭐ | ✅ | ❌ | ❌ |
|
|
214
216
|
|
|
215
|
-
##
|
|
217
|
+
## What You Get Out of the Box
|
|
216
218
|
|
|
217
219
|
<div align="center">
|
|
218
220
|
|
|
219
|
-
|
|
221
|
+
**Zero Configuration** • **Production Patterns** • **Complete Testing** • **Code Quality** • **Auto Documentation** • **Deployment Ready**
|
|
220
222
|
|
|
221
223
|
</div>
|
|
222
224
|
|
|
223
|
-
|
|
225
|
+
**Focus on Your Code, Not Setup**
|
|
224
226
|
|
|
225
227
|
All dependencies (FastAPI, Pydantic, Pytest, etc.) are preconfigured. Just create and run:
|
|
226
228
|
|
|
@@ -230,13 +232,13 @@ cd my_app # Enter
|
|
|
230
232
|
make start # Run!
|
|
231
233
|
```
|
|
232
234
|
|
|
233
|
-
|
|
234
|
-
-
|
|
235
|
-
-
|
|
236
|
-
-
|
|
237
|
-
-
|
|
238
|
-
-
|
|
239
|
-
-
|
|
235
|
+
**Every Template Includes:**
|
|
236
|
+
- **Ready-to-run** development environment
|
|
237
|
+
- **Industry-standard** project structure
|
|
238
|
+
- **Comprehensive** test suites with examples
|
|
239
|
+
- **Ruff** linting and formatting
|
|
240
|
+
- **Auto-generated** OpenAPI documentation
|
|
241
|
+
- **Makefile** with common development commands
|
|
240
242
|
|
|
241
243
|
## Creating an App
|
|
242
244
|
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# FastAPI Gen
|
|
4
|
+
|
|
5
|
+
**Create production-ready FastAPI applications in seconds**
|
|
6
|
+
|
|
7
|
+
*From simple APIs to LLM-enabled applications, all without build configuration.*
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://github.com/mirpo/fastapi-gen/actions/workflows/test.yml?query=workflow%3Atest+event%3Apush+branch%main">
|
|
11
|
+
<img src="https://github.com/mirpo/fastapi-gen/actions/workflows/test.yml/badge.svg?branch=main" alt="Test Status">
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://pypi.org/project/fastapi-gen">
|
|
14
|
+
<img src="https://img.shields.io/pypi/v/fastapi-gen?color=%2334D058&label=pypi" alt="PyPI version">
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://pypi.org/project/fastapi-gen">
|
|
17
|
+
<img src="https://img.shields.io/pypi/pyversions/fastapi-gen.svg?color=%2334D058" alt="Python versions">
|
|
18
|
+
</a>
|
|
19
|
+
<a href="https://pypi.org/project/fastapi-gen">
|
|
20
|
+
<img src="https://img.shields.io/pypi/dm/fastapi-gen?color=blue" alt="Downloads">
|
|
21
|
+
</a>
|
|
22
|
+
<a href="https://github.com/mirpo/fastapi-gen/blob/main/LICENSE">
|
|
23
|
+
<img src="https://img.shields.io/badge/license-MIT-green" alt="License">
|
|
24
|
+
</a>
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
Get a fully functional FastAPI app running in **30 seconds**:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Install
|
|
35
|
+
pip install fastapi-gen
|
|
36
|
+
|
|
37
|
+
# Create your app
|
|
38
|
+
fastapi-gen my_app
|
|
39
|
+
|
|
40
|
+
# Run it
|
|
41
|
+
cd my_app && make start
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Or use pipx for one-time execution:**
|
|
45
|
+
```bash
|
|
46
|
+
pipx run fastapi-gen my_app
|
|
47
|
+
cd my_app && make start
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**That's it!** Open [http://localhost:8000/docs](http://localhost:8000/docs) to see your OpenAPI documentation.
|
|
51
|
+
|
|
52
|
+
> **Platform Support:** Works on macOS and Linux | [Report Issues](https://github.com/mirpo/fastapi-gen/issues/new)
|
|
53
|
+
|
|
54
|
+
## Why FastAPI Gen?
|
|
55
|
+
|
|
56
|
+
<div align="center">
|
|
57
|
+
|
|
58
|
+
| **Focus on Code** | **Production Ready** | **Testing Included** | **Zero Config** |
|
|
59
|
+
|:---:|:---:|:---:|:---:|
|
|
60
|
+
| Skip boilerplate setup | Enterprise patterns | Real test coverage | Ready-to-run templates |
|
|
61
|
+
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Templates Overview
|
|
67
|
+
|
|
68
|
+
<details>
|
|
69
|
+
<summary><strong>Hello World</strong> - Perfect for Learning FastAPI</summary>
|
|
70
|
+
|
|
71
|
+
**Best for:** Learning FastAPI fundamentals and starting new projects
|
|
72
|
+
|
|
73
|
+
**Key Features:**
|
|
74
|
+
- **REST API Fundamentals** - Complete CRUD with validation
|
|
75
|
+
- **Configuration Management** - Both pydantic-settings & dotenv
|
|
76
|
+
- **Dependency Injection** - Clean architecture with `Depends()`
|
|
77
|
+
- **Background Tasks** - Async processing with logging
|
|
78
|
+
- **Exception Handling** - Professional error responses
|
|
79
|
+
- **Input Validation** - Advanced Pydantic constraints
|
|
80
|
+
- **Health Monitoring** - Built-in health endpoints
|
|
81
|
+
- **Complete Tests** - 100% test coverage
|
|
82
|
+
|
|
83
|
+
[📖 View Details →](src/templates/hello_world/README.md)
|
|
84
|
+
|
|
85
|
+
</details>
|
|
86
|
+
|
|
87
|
+
<details>
|
|
88
|
+
<summary><strong>Advanced</strong> - Enterprise Production Template</summary>
|
|
89
|
+
|
|
90
|
+
**Best for:** Production applications with enterprise features
|
|
91
|
+
|
|
92
|
+
**Key Features:**
|
|
93
|
+
- **JWT Authentication** - Registration, login, protected routes
|
|
94
|
+
- **Database Integration** - SQLAlchemy 2.0 async (SQLite/PostgreSQL)
|
|
95
|
+
- **Rate Limiting** - DDoS protection per endpoint
|
|
96
|
+
- **Caching System** - In-memory + Redis integration ready
|
|
97
|
+
- **WebSocket Support** - Real-time communication
|
|
98
|
+
- **File Upload** - Secure handling + cloud storage ready
|
|
99
|
+
- **Enhanced Security** - CORS, validation, production patterns
|
|
100
|
+
- **Full Test Suite** - Auth, CRUD, WebSocket, integration
|
|
101
|
+
|
|
102
|
+
[📖 View Details →](src/templates/advanced/README.md)
|
|
103
|
+
|
|
104
|
+
</details>
|
|
105
|
+
|
|
106
|
+
<details>
|
|
107
|
+
<summary><strong>NLP</strong> - Comprehensive AI Language Processing</summary>
|
|
108
|
+
|
|
109
|
+
**Best for:** AI applications with natural language processing
|
|
110
|
+
|
|
111
|
+
**Key Features:**
|
|
112
|
+
- **8 NLP Capabilities** - Summarization, NER, generation, QA, embeddings, sentiment, classification, similarity
|
|
113
|
+
- **Production Architecture** - Startup model loading, device auto-detection
|
|
114
|
+
- **Smart Configuration** - Environment-based config, multiple models
|
|
115
|
+
- **Performance Optimized** - Model caching, concurrent handling, hardware acceleration
|
|
116
|
+
- **Production Monitoring** - Health checks, model status, logging
|
|
117
|
+
- **Real AI Testing** - Actual model inference validation
|
|
118
|
+
|
|
119
|
+
[📖 View Details →](src/templates/nlp/README.md)
|
|
120
|
+
|
|
121
|
+
</details>
|
|
122
|
+
|
|
123
|
+
<details>
|
|
124
|
+
<summary><strong>LangChain</strong> - Modern LLM Integration</summary>
|
|
125
|
+
|
|
126
|
+
**Best for:** Applications using LangChain for LLM workflows
|
|
127
|
+
|
|
128
|
+
**Key Features:**
|
|
129
|
+
- **Optimized Loading** - Startup caching, memory management
|
|
130
|
+
- **Modern Patterns** - Latest LangChain best practices
|
|
131
|
+
- **Smart Config** - Auto device detection (CPU/GPU)
|
|
132
|
+
- **Production Ready** - Health checks, monitoring, error handling
|
|
133
|
+
- **Real Testing** - Actual model inference tests
|
|
134
|
+
- **Dual Endpoints** - Text generation & question answering
|
|
135
|
+
|
|
136
|
+
[📖 View Details →](src/templates/langchain/README.md)
|
|
137
|
+
|
|
138
|
+
</details>
|
|
139
|
+
|
|
140
|
+
<details>
|
|
141
|
+
<summary><strong>Llama</strong> - Local LLM Powerhouse</summary>
|
|
142
|
+
|
|
143
|
+
**Best for:** Local LLM inference with llama-cpp-python
|
|
144
|
+
|
|
145
|
+
**Key Features:**
|
|
146
|
+
- **Local LLM Focus** - Optimized for Gemma/Llama GGUF models
|
|
147
|
+
- **GPU Acceleration** - Auto GPU detection, configurable layers
|
|
148
|
+
- **Advanced Config** - Context windows, threading, performance tuning
|
|
149
|
+
- **Production Ready** - Lifecycle management, health monitoring
|
|
150
|
+
- **Real Testing** - Actual model inference validation
|
|
151
|
+
- **Easy Setup** - Auto model download, optimized defaults
|
|
152
|
+
|
|
153
|
+
> **Requirements:** ~4GB model download + 4GB+ RAM
|
|
154
|
+
|
|
155
|
+
[📖 View Details →](src/templates/llama/README.md)
|
|
156
|
+
|
|
157
|
+
</details>
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Template Comparison
|
|
162
|
+
|
|
163
|
+
| Template | Best For | Complexity | AI/ML | Database | Auth |
|
|
164
|
+
|----------|----------|------------|--------|----------|------|
|
|
165
|
+
| **Hello World** | Learning, Simple APIs | ⭐ | ❌ | ❌ | ❌ |
|
|
166
|
+
| **Advanced** | Production Apps | ⭐⭐⭐ | ❌ | ✅ | ✅ |
|
|
167
|
+
| **NLP** | AI Text Processing | ⭐⭐⭐⭐ | ✅ | ❌ | ❌ |
|
|
168
|
+
| **LangChain** | LLM Workflows | ⭐⭐⭐⭐ | ✅ | ❌ | ❌ |
|
|
169
|
+
| **Llama** | Local LLM | ⭐⭐⭐⭐⭐ | ✅ | ❌ | ❌ |
|
|
170
|
+
|
|
171
|
+
## What You Get Out of the Box
|
|
172
|
+
|
|
173
|
+
<div align="center">
|
|
174
|
+
|
|
175
|
+
**Zero Configuration** • **Production Patterns** • **Complete Testing** • **Code Quality** • **Auto Documentation** • **Deployment Ready**
|
|
176
|
+
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
**Focus on Your Code, Not Setup**
|
|
180
|
+
|
|
181
|
+
All dependencies (FastAPI, Pydantic, Pytest, etc.) are preconfigured. Just create and run:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
fastapi-gen my_app # Create
|
|
185
|
+
cd my_app # Enter
|
|
186
|
+
make start # Run!
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Every Template Includes:**
|
|
190
|
+
- **Ready-to-run** development environment
|
|
191
|
+
- **Industry-standard** project structure
|
|
192
|
+
- **Comprehensive** test suites with examples
|
|
193
|
+
- **Ruff** linting and formatting
|
|
194
|
+
- **Auto-generated** OpenAPI documentation
|
|
195
|
+
- **Makefile** with common development commands
|
|
196
|
+
|
|
197
|
+
## Creating an App
|
|
198
|
+
|
|
199
|
+
**You'll need to have Python 3.12+ or later version on your local development machine**. We recommend using the latest LTS version. You can use [pyenv](https://github.com/pyenv/pyenv) (macOS/Linux) to switch Python versions between different projects.
|
|
200
|
+
|
|
201
|
+
### Basic template
|
|
202
|
+
|
|
203
|
+
```console
|
|
204
|
+
pip3 install fastapi-gen
|
|
205
|
+
fastapi-gen my_app
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
or
|
|
209
|
+
|
|
210
|
+
```console
|
|
211
|
+
pip3 install fastapi-gen
|
|
212
|
+
fastapi-gen my_app --template hello_world
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Advanced template
|
|
216
|
+
|
|
217
|
+
```console
|
|
218
|
+
pip3 install fastapi-gen
|
|
219
|
+
fastapi-gen my_app --template advanced
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### NLP template
|
|
223
|
+
|
|
224
|
+
```console
|
|
225
|
+
pip install fastapi-gen
|
|
226
|
+
fastapi-gen my_app --template nlp
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Langchain template
|
|
230
|
+
|
|
231
|
+
```console
|
|
232
|
+
pip install fastapi-gen
|
|
233
|
+
fastapi-gen my_app --template Langchain
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Llama template
|
|
237
|
+
|
|
238
|
+
```console
|
|
239
|
+
pip install fastapi-gen
|
|
240
|
+
fastapi-gen my_app --template llama
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Inside the newly created project, you can run some built-in commands:
|
|
244
|
+
|
|
245
|
+
### `make start`
|
|
246
|
+
|
|
247
|
+
Runs the app in development mode.<br>
|
|
248
|
+
Open [http://localhost:8000/docs](http://localhost:8000/docs) to view OpenAPI documentation in the browser.
|
|
249
|
+
|
|
250
|
+
The page will automatically reload if you make changes to the code.
|
|
251
|
+
|
|
252
|
+
### `make test`
|
|
253
|
+
|
|
254
|
+
Runs tests.<br>
|
|
255
|
+
By default, runs tests related to files changed since the last commit.
|
|
256
|
+
|
|
257
|
+
## License
|
|
258
|
+
|
|
259
|
+
`fastapi-gen` is distributed under the terms of the [MIT](https://github.com/mirpo/fastapi-gen/blob/main/LICENSE) license.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["hatchling"]
|
|
2
|
+
requires = ["hatchling", "hatch-vcs"]
|
|
3
3
|
build-backend = "hatchling.build"
|
|
4
4
|
|
|
5
5
|
[tool.hatch.build]
|
|
@@ -7,13 +7,43 @@ include = ["src"]
|
|
|
7
7
|
|
|
8
8
|
[tool.hatch.build.targets.wheel]
|
|
9
9
|
sources = ["src"]
|
|
10
|
+
exclude = [
|
|
11
|
+
"**/__pycache__",
|
|
12
|
+
"**/*.pyc",
|
|
13
|
+
"**/.venv",
|
|
14
|
+
"**/venv",
|
|
15
|
+
"**/.pytest_cache",
|
|
16
|
+
"**/.ruff_cache",
|
|
17
|
+
"**/*.egg-info",
|
|
18
|
+
"**/*.log",
|
|
19
|
+
"**/*.db",
|
|
20
|
+
"**/models/*.gguf",
|
|
21
|
+
"**/models/*.bin",
|
|
22
|
+
"**/.env_dev",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[tool.hatch.build.targets.sdist]
|
|
26
|
+
exclude = [
|
|
27
|
+
"**/__pycache__",
|
|
28
|
+
"**/*.pyc",
|
|
29
|
+
"**/.venv",
|
|
30
|
+
"**/venv",
|
|
31
|
+
"**/.pytest_cache",
|
|
32
|
+
"**/.ruff_cache",
|
|
33
|
+
"**/*.egg-info",
|
|
34
|
+
"**/*.log",
|
|
35
|
+
"**/*.db",
|
|
36
|
+
"**/models/*.gguf",
|
|
37
|
+
"**/models/*.bin",
|
|
38
|
+
"**/.env_dev",
|
|
39
|
+
]
|
|
10
40
|
|
|
11
41
|
[project]
|
|
12
42
|
name = "fastapi-gen"
|
|
13
43
|
dynamic = ["version"]
|
|
14
44
|
description = "Set up a modern REST API by running one command."
|
|
15
45
|
readme = "README.md"
|
|
16
|
-
requires-python = ">=3.
|
|
46
|
+
requires-python = ">=3.11"
|
|
17
47
|
license = "MIT"
|
|
18
48
|
keywords = [
|
|
19
49
|
"fastapi",
|
|
@@ -59,10 +89,10 @@ classifiers = [
|
|
|
59
89
|
"Topic :: Internet :: WWW/HTTP",
|
|
60
90
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
61
91
|
]
|
|
62
|
-
dependencies = ["click==8.
|
|
92
|
+
dependencies = ["click==8.3.0", "colorama==0.4.6", "importlib_resources==6.5.2"]
|
|
63
93
|
|
|
64
94
|
[project.optional-dependencies]
|
|
65
|
-
dev = ["ruff==0.
|
|
95
|
+
dev = ["ruff==0.14.1", "pytest==8.4.2", "coverage[toml]==7.11.0"]
|
|
66
96
|
|
|
67
97
|
[project.urls]
|
|
68
98
|
Documentation = "https://github.com/mirpo/fastapi-gen#readme"
|
|
@@ -73,14 +103,14 @@ Source = "https://github.com/mirpo/fastapi-gen"
|
|
|
73
103
|
fastapi-gen = "cli.__main__:main"
|
|
74
104
|
|
|
75
105
|
[tool.hatch.version]
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
[tool.hatch.envs.default]
|
|
79
|
-
dependencies = ["coverage[toml]==7.9.1", "pytest"]
|
|
106
|
+
source = "vcs"
|
|
80
107
|
|
|
81
108
|
[[tool.hatch.envs.all.matrix]]
|
|
82
109
|
python = ["3.12", "3.13"]
|
|
83
110
|
|
|
111
|
+
[tool.uv.workspace]
|
|
112
|
+
members = []
|
|
113
|
+
|
|
84
114
|
[tool.black]
|
|
85
115
|
target-version = ["py312"]
|
|
86
116
|
line-length = 120
|
|
@@ -110,6 +140,7 @@ ignore = [
|
|
|
110
140
|
"S607",
|
|
111
141
|
"S101",
|
|
112
142
|
"PLR2004",
|
|
143
|
+
"COM812", # Conflicts with ruff formatter
|
|
113
144
|
]
|
|
114
145
|
unfixable = [
|
|
115
146
|
# Don't touch unused imports
|