fastkit-cli 0.1.0__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.
@@ -0,0 +1,457 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastkit-cli
3
+ Version: 0.1.0
4
+ Summary: FastKit CLI is a code generation tool for the fastkit core packge.
5
+ Project-URL: Homepage, https://github.com/codevelo-pub/fastkit-cli
6
+ Project-URL: Documentation, https://github.com/codevelo-pub/fastkit-cli#readme
7
+ Project-URL: Repository, https://github.com/codevelo-pub/fastkit-cli
8
+ Requires-Python: >=3.12
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: fastkit-core>=0.3.5
11
+ Requires-Dist: jinja2>=3.1.6
12
+ Requires-Dist: typer>=0.24.1
13
+
14
+ <div align="center">
15
+ <h1>FastKit CLI</h1>
16
+
17
+ [![PyPI version](https://badge.fury.io/py/fastkit-cli.svg)](https://pypi.org/project/fastkit-cli/)
18
+ [![Python 3.11+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
19
+ [![CI](https://github.com/codevelo-pub/fastkit-core/actions/workflows/tests.yml/badge.svg)](https://github.com/codevelo-pub/fastkit-cli/actions/workflows/tests.yml)
20
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
21
+ </div>
22
+
23
+
24
+ **FastAPI with structure and developer experience.**
25
+
26
+ FastKit CLI is a code generation tool for the [FastKit](https://github.com/codevelo-pub/fastkit-core) ecosystem. It generates complete, production-ready modules for FastAPI projects — models, schemas, repositories, services, and routers — in seconds.
27
+
28
+ > Inspired by Laravel's `php artisan`, built for FastAPI developers who want structure without the overhead.
29
+
30
+ ---
31
+
32
+ ## Requirements
33
+
34
+ - Python 3.12
35
+ - [fastkit-core](https://pypi.org/project/fastkit-core/)
36
+
37
+ ---
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ pip install fastkit-cli
43
+ ```
44
+
45
+ Or with [uv](https://github.com/astral-sh/uv) (recommended):
46
+
47
+ ```bash
48
+ uv add fastkit-cli
49
+ ```
50
+
51
+ Verify the installation:
52
+
53
+ ```bash
54
+ fastkit --help
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Quickstart
60
+
61
+ ### Generate a complete module
62
+
63
+ ```bash
64
+ fastkit make module Invoice
65
+ ```
66
+
67
+ This generates the following structure:
68
+
69
+ ```
70
+ modules/
71
+ └── invoices/
72
+ ├── __init__.py
73
+ ├── models.py
74
+ ├── schemas.py
75
+ ├── repository.py
76
+ ├── service.py
77
+ └── router.py
78
+ ```
79
+
80
+ With a confirmation and next steps:
81
+
82
+ ```
83
+ Generating module: Invoice
84
+ Location : modules/invoices/
85
+ Model : Invoice
86
+ Table : invoices
87
+ Mode : sync
88
+
89
+ ✓ __init__.py
90
+ ✓ models.py
91
+ ✓ schemas.py
92
+ ✓ repository.py
93
+ ✓ service.py
94
+ ✓ router.py
95
+
96
+ ✓ Registered model in alembic/env.py
97
+
98
+ Done! Next steps:
99
+ 1. Define your fields in modules/invoices/models.py
100
+ 2. Add schemas in modules/invoices/schemas.py
101
+ 3. Run: fastkit migrate make -m 'create_invoices'
102
+ ```
103
+
104
+ ### Generate an async module
105
+
106
+ ```bash
107
+ fastkit make module Invoice --async
108
+ ```
109
+
110
+ Generates the same structure but with async repository, service, and router using `AsyncSession` and `get_async_db`.
111
+
112
+ ---
113
+
114
+ ## make
115
+
116
+ ### `fastkit make module`
117
+
118
+ Generates a complete module with all layers.
119
+
120
+ ```bash
121
+ fastkit make module <Name> [OPTIONS]
122
+ ```
123
+
124
+ | Option | Short | Default | Description |
125
+ |--------|-------|---------|-------------|
126
+ | `--dir` | `-d` | `modules` | Root directory for modules |
127
+ | `--async` | `-a` | `False` | Use async repository, service, and router |
128
+ | `--force` | `-f` | `False` | Overwrite existing files |
129
+
130
+ **Examples:**
131
+
132
+ ```bash
133
+ # Basic usage
134
+ fastkit make module Invoice
135
+
136
+ # Async mode
137
+ fastkit make module Invoice --async
138
+
139
+ # Custom directory
140
+ fastkit make module Invoice --dir src/modules
141
+
142
+ # Compound name (automatically converted)
143
+ fastkit make module InvoiceItem
144
+
145
+ # Overwrite existing files
146
+ fastkit make module Invoice --force
147
+ ```
148
+
149
+ ---
150
+
151
+ ### `fastkit make model`
152
+
153
+ Generates only the SQLAlchemy model file.
154
+
155
+ ```bash
156
+ fastkit make model <Name> [OPTIONS]
157
+ ```
158
+
159
+ | Option | Short | Default | Description |
160
+ |--------|-------|---------|-------------|
161
+ | `--path` | `-p` | `.` | Target directory |
162
+ | `--force` | `-f` | `False` | Overwrite existing file |
163
+
164
+ **Examples:**
165
+
166
+ ```bash
167
+ fastkit make model Invoice
168
+ fastkit make model Invoice --path modules/invoices
169
+ ```
170
+
171
+ **Generated `models.py`:**
172
+
173
+ ```python
174
+ from fastkit_core.database import BaseWithTimestamps, IntIdMixin
175
+ # from fastkit_core.database import UUIDMixin, SoftDeleteMixin, SlugMixin
176
+
177
+ class Invoice(BaseWithTimestamps, IntIdMixin):
178
+ __tablename__ = "invoices"
179
+ # Define your fields here
180
+ ```
181
+
182
+ ---
183
+
184
+ ### `fastkit make schema`
185
+
186
+ Generates only the Pydantic schemas file.
187
+
188
+ ```bash
189
+ fastkit make schema <Name> [OPTIONS]
190
+ ```
191
+
192
+ | Option | Short | Default | Description |
193
+ |--------|-------|---------|-------------|
194
+ | `--path` | `-p` | `.` | Target directory |
195
+ | `--force` | `-f` | `False` | Overwrite existing file |
196
+
197
+ **Examples:**
198
+
199
+ ```bash
200
+ fastkit make schema Invoice
201
+ fastkit make schema Invoice --path modules/invoices
202
+ ```
203
+
204
+ **Generated `schemas.py`:**
205
+
206
+ ```python
207
+ from fastkit_core.validation import BaseSchema
208
+
209
+ class InvoiceCreate(BaseSchema):
210
+ pass # Define your fields here
211
+
212
+ class InvoiceUpdate(BaseSchema):
213
+ pass # All fields optional for partial updates
214
+
215
+ class InvoiceResponse(BaseSchema):
216
+ id: int
217
+ model_config = {"from_attributes": True}
218
+ ```
219
+
220
+ ---
221
+
222
+ ### `fastkit make repository`
223
+
224
+ Generates only the repository file.
225
+
226
+ ```bash
227
+ fastkit make repository <Name> [OPTIONS]
228
+ ```
229
+
230
+ | Option | Short | Default | Description |
231
+ |--------|-------|---------|-------------|
232
+ | `--path` | `-p` | `.` | Target directory |
233
+ | `--async` | `-a` | `False` | Use async repository |
234
+ | `--force` | `-f` | `False` | Overwrite existing file |
235
+
236
+ **Examples:**
237
+
238
+ ```bash
239
+ fastkit make repository Invoice
240
+ fastkit make repository Invoice --async
241
+ fastkit make repository Invoice --path modules/invoices
242
+ ```
243
+
244
+ ---
245
+
246
+ ### `fastkit make service`
247
+
248
+ Generates only the service file.
249
+
250
+ ```bash
251
+ fastkit make service <Name> [OPTIONS]
252
+ ```
253
+
254
+ | Option | Short | Default | Description |
255
+ |--------|-------|---------|-------------|
256
+ | `--path` | `-p` | `.` | Target directory |
257
+ | `--async` | `-a` | `False` | Use async service |
258
+ | `--force` | `-f` | `False` | Overwrite existing file |
259
+
260
+ **Examples:**
261
+
262
+ ```bash
263
+ fastkit make service Invoice
264
+ fastkit make service Invoice --async
265
+ ```
266
+
267
+ ---
268
+
269
+ ### `fastkit make router`
270
+
271
+ Generates only the router file with full CRUD endpoints.
272
+
273
+ ```bash
274
+ fastkit make router <Name> [OPTIONS]
275
+ ```
276
+
277
+ | Option | Short | Default | Description |
278
+ |--------|-------|---------|-------------|
279
+ | `--path` | `-p` | `.` | Target directory |
280
+ | `--async` | `-a` | `False` | Use async router |
281
+ | `--force` | `-f` | `False` | Overwrite existing file |
282
+
283
+ **Examples:**
284
+
285
+ ```bash
286
+ fastkit make router Invoice
287
+ fastkit make router Invoice --async
288
+ ```
289
+
290
+ **Generated endpoints:**
291
+
292
+ ```
293
+ GET /invoices → index (paginated list)
294
+ GET /invoices/{id} → show
295
+ POST /invoices → store
296
+ PUT /invoices/{id} → update
297
+ DELETE /invoices/{id} → destroy
298
+ ```
299
+
300
+ ---
301
+
302
+ ## migrate
303
+
304
+ Wrapper around [Alembic](https://alembic.sqlalchemy.org/) migrations.
305
+
306
+ ### `fastkit migrate run`
307
+
308
+ Run all pending migrations.
309
+
310
+ ```bash
311
+ fastkit migrate run
312
+ # Equivalent to: alembic upgrade head
313
+ ```
314
+
315
+ ### `fastkit migrate make`
316
+
317
+ Generate a new migration based on model changes.
318
+
319
+ ```bash
320
+ fastkit migrate make -m "create_invoices"
321
+ # Equivalent to: alembic revision --autogenerate -m "create_invoices"
322
+ ```
323
+
324
+ | Option | Short | Required | Description |
325
+ |--------|-------|----------|-------------|
326
+ | `--message` | `-m` | Yes | Migration description |
327
+
328
+ ### `fastkit migrate rollback`
329
+
330
+ Rollback the last migration.
331
+
332
+ ```bash
333
+ fastkit migrate rollback
334
+ # Equivalent to: alembic downgrade -1
335
+ ```
336
+
337
+ ### `fastkit migrate status`
338
+
339
+ Show the current migration status.
340
+
341
+ ```bash
342
+ fastkit migrate status
343
+ # Equivalent to: alembic current
344
+ ```
345
+
346
+ ---
347
+
348
+ ## db seed
349
+
350
+ Run database seeders.
351
+
352
+ ```bash
353
+ # Run all seeders
354
+ fastkit db seed
355
+
356
+ # Run a specific seeder
357
+ fastkit db seed UserSeeder
358
+ ```
359
+
360
+ ---
361
+
362
+ ## server
363
+
364
+ Start the FastAPI development server.
365
+
366
+ ```bash
367
+ fastkit server
368
+ ```
369
+
370
+ | Option | Short | Default | Description |
371
+ |--------|-------|---------|-------------|
372
+ | `--host` | `-h` | `0.0.0.0` | Host to bind |
373
+ | `--port` | `-p` | `8000` | Port to bind |
374
+ | `--reload / --no-reload` | | `True` | Enable auto-reload |
375
+
376
+ **Examples:**
377
+
378
+ ```bash
379
+ # Default
380
+ fastkit server
381
+
382
+ # Custom host and port
383
+ fastkit server --host 127.0.0.1 --port 9000
384
+
385
+ # Without auto-reload
386
+ fastkit server --no-reload
387
+ ```
388
+
389
+ ---
390
+
391
+ ## new
392
+
393
+ Create a new FastKit project from a template.
394
+
395
+ ```bash
396
+ fastkit new my-project
397
+ ```
398
+
399
+ ---
400
+
401
+ ## Naming Conventions
402
+
403
+ FastKit CLI automatically handles naming conversions regardless of how you pass the module name:
404
+
405
+ | Input | Model | Snake | Table | Folder |
406
+ |-------|-------|-------|-------|--------|
407
+ | `Invoice` | `Invoice` | `invoice` | `invoices` | `invoices` |
408
+ | `invoice` | `Invoice` | `invoice` | `invoices` | `invoices` |
409
+ | `InvoiceItem` | `InvoiceItem` | `invoice_item` | `invoice_items` | `invoice_items` |
410
+ | `invoice_item` | `InvoiceItem` | `invoice_item` | `invoice_items` | `invoice_items` |
411
+ | `Category` | `Category` | `category` | `categories` | `categories` |
412
+
413
+ ---
414
+
415
+ ## Typical Workflow
416
+
417
+ ```bash
418
+ # 1. Generate a new module
419
+ fastkit make module Invoice --async
420
+
421
+ # 2. Define your model fields
422
+ # Edit modules/invoices/models.py
423
+
424
+ # 3. Define your schemas
425
+ # Edit modules/invoices/schemas.py
426
+
427
+ # 4. Generate and run migration
428
+ fastkit migrate make -m "create_invoices"
429
+ fastkit migrate run
430
+
431
+ # 5. Register the router in your main app
432
+ # In app.py:
433
+ # from modules.invoices.router import router as invoices_router
434
+ # app.include_router(invoices_router, prefix="/api/v1")
435
+
436
+ # 6. Start the server
437
+ fastkit server
438
+ ```
439
+
440
+ ---
441
+
442
+ ## Related Packages
443
+
444
+ - [fastkit-core](https://pypi.org/project/fastkit-core/) — Base classes, repository pattern, validation, i18n
445
+ - [mailbridge](https://pypi.org/project/mailbridge/) — Email delivery abstraction
446
+
447
+ ---
448
+
449
+ ## License
450
+
451
+ FastKit Core is open-source software licensed under the [MIT License](https://opensource.org/license/MIT).
452
+
453
+ ---
454
+
455
+ ## Built by CodeVelo
456
+
457
+ FastKit is developed and maintained by [Codevelo](https://codevelo.io) for the FastAPI community.