FastAPI-fastkit 1.0.0__py3-none-any.whl → 1.0.2__py3-none-any.whl
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_fastkit/__init__.py +10 -1
- fastapi_fastkit/backend/main.py +482 -482
- fastapi_fastkit/backend/transducer.py +106 -106
- fastapi_fastkit/cli.py +664 -631
- fastapi_fastkit/core/settings.py +155 -155
- fastapi_fastkit/fastapi_project_template/README.md +90 -90
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/.env-tpl +1 -1
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/.gitignore-tpl +30 -30
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/README.md-tpl +107 -107
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/requirements.txt-tpl +36 -36
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/scripts/format.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/scripts/lint.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/scripts/run-server.sh-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/scripts/test.sh-tpl +6 -6
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/setup.cfg-tpl +14 -14
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/setup.py-tpl +25 -25
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/api/api.py-tpl +9 -9
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/api/routes/items.py-tpl +57 -57
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/core/config.py-tpl +64 -64
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/crud/items.py-tpl +21 -21
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/main.py-tpl +26 -26
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/mocks/mock_items.json-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/src/schemas/items.py-tpl +22 -22
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/tests/conftest.py-tpl +42 -42
- fastapi_fastkit/fastapi_project_template/fastapi-async-crud/tests/test_items.py-tpl +48 -48
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/.env-tpl +1 -1
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/.gitignore-tpl +191 -191
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/README.md-tpl +156 -156
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/requirements.txt-tpl +36 -36
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/scripts/format.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/scripts/lint.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/scripts/run-server.sh-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/scripts/test.sh-tpl +6 -6
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/setup.cfg-tpl +12 -12
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/setup.py-tpl +27 -27
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/.DS_Store +0 -0
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/api/api.py-tpl +9 -9
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/api/routes/items.py-tpl +172 -172
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/core/config.py-tpl +64 -64
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/crud/items.py-tpl +21 -21
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/helper/exceptions.py-tpl +103 -103
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/helper/pagination.py-tpl +72 -72
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/main.py-tpl +39 -39
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/mocks/mock_items.json-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/schemas/base.py-tpl +49 -49
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/schemas/items.py-tpl +22 -22
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/src/utils/documents.py-tpl +20 -20
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/tests/conftest.py-tpl +42 -42
- fastapi_fastkit/fastapi_project_template/fastapi-custom-response/tests/test_items.py-tpl +61 -61
- fastapi_fastkit/fastapi_project_template/fastapi-default/README.md-tpl +101 -101
- fastapi_fastkit/fastapi_project_template/fastapi-default/scripts/run-server.sh-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-default/setup.py-tpl +22 -22
- fastapi_fastkit/fastapi_project_template/fastapi-default/src/mocks/mock_items.json-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-default/tests/conftest.py-tpl +30 -30
- fastapi_fastkit/fastapi_project_template/fastapi-default/tests/test_items.py-tpl +44 -44
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/.env-tpl +1 -1
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/.gitignore-tpl +30 -30
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/Dockerfile-tpl +23 -23
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/README.md-tpl +119 -119
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/requirements.txt-tpl +36 -36
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/scripts/format.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/scripts/lint.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/scripts/run-server.sh-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/scripts/test.sh-tpl +6 -6
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/setup.cfg-tpl +13 -13
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/setup.py-tpl +22 -22
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/api/api.py-tpl +6 -6
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/api/routes/items.py-tpl +54 -54
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/core/config.py-tpl +64 -64
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/crud/items.py-tpl +15 -15
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/main.py-tpl +26 -26
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/mocks/mock_items.json-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/src/schemas/items.py-tpl +19 -19
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/tests/conftest.py-tpl +30 -30
- fastapi_fastkit/fastapi_project_template/fastapi-dockerized/tests/test_items.py-tpl +44 -44
- fastapi_fastkit/fastapi_project_template/fastapi-empty/.env-tpl +1 -1
- fastapi_fastkit/fastapi_project_template/fastapi-empty/setup.py-tpl +22 -22
- fastapi_fastkit/fastapi_project_template/fastapi-empty/src/core/config.py-tpl +75 -75
- fastapi_fastkit/fastapi_project_template/fastapi-empty/src/main.py-tpl +36 -36
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/.env-tpl +9 -9
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/.gitignore-tpl +30 -30
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/Dockerfile-tpl +23 -23
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/README.md-tpl +144 -144
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/alembic.ini-tpl +119 -119
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/docker-compose.yml-tpl +44 -44
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/requirements.txt-tpl +41 -41
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/scripts/format.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/scripts/lint.sh-tpl +5 -5
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/scripts/pre-start.sh-tpl +16 -16
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/scripts/run-server.sh-tpl +8 -8
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/scripts/test.sh-tpl +10 -10
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/setup.cfg-tpl +13 -13
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/setup.py-tpl +25 -25
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/alembic/README-tpl +1 -1
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/alembic/env.py-tpl +85 -85
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/alembic/script.py.mako-tpl +26 -26
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/alembic/versions/bedcdc35b64a_first_alembic.py-tpl +37 -37
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/api/api.py-tpl +11 -11
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/api/deps.py-tpl +19 -19
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/api/routes/items.py-tpl +109 -109
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/core/config.py-tpl +88 -88
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/core/db.py-tpl +53 -53
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/crud/items.py-tpl +102 -102
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/main.py-tpl +45 -45
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/schemas/items.py-tpl +54 -54
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/utils/backend_pre_start.py-tpl +39 -39
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/utils/init_data.py-tpl +23 -23
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/src/utils/tests_pre_start.py-tpl +39 -39
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/tests/conftest.py-tpl +63 -63
- fastapi_fastkit/fastapi_project_template/fastapi-psql-orm/tests/test_items.py-tpl +44 -44
- fastapi_fastkit/fastapi_project_template/modules/api/routes/new_route.py-tpl +64 -64
- fastapi_fastkit/fastapi_project_template/modules/crud/new_route.py-tpl +29 -29
- fastapi_fastkit/fastapi_project_template/modules/schemas/new_route.py-tpl +23 -23
- fastapi_fastkit/logs/fastkit_debug_20250702_161423.log +21 -0
- fastapi_fastkit/logs/fastkit_debug_20250702_162706.log +20 -0
- fastapi_fastkit/logs/fastkit_debug_20250702_163010.log +21 -0
- fastapi_fastkit/logs/fastkit_debug_20250702_163526.log +21 -0
- fastapi_fastkit/logs/fastkit_debug_20250702_164053.log +21 -0
- fastapi_fastkit/logs/fastkit_debug_20250702_165220.log +21 -0
- fastapi_fastkit/logs/fastkit_debug_20250702_165647.log +21 -0
- fastapi_fastkit/utils/logging.py +112 -1
- fastapi_fastkit/utils/main.py +140 -129
- fastapi_fastkit-1.0.2.dist-info/METADATA +320 -0
- {fastapi_fastkit-1.0.0.dist-info → fastapi_fastkit-1.0.2.dist-info}/RECORD +127 -119
- {fastapi_fastkit-1.0.0.dist-info → fastapi_fastkit-1.0.2.dist-info}/WHEEL +1 -1
- {fastapi_fastkit-1.0.0.dist-info → fastapi_fastkit-1.0.2.dist-info}/licenses/LICENSE +21 -21
- fastapi_fastkit-1.0.0.dist-info/METADATA +0 -208
- {fastapi_fastkit-1.0.0.dist-info → fastapi_fastkit-1.0.2.dist-info}/entry_points.txt +0 -0
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
# Async Item Management API Server
|
|
2
|
-
|
|
3
|
-
A FastAPI-based item management API implemented with asynchronous processing.
|
|
4
|
-
|
|
5
|
-
## Tech Stack
|
|
6
|
-
|
|
7
|
-
- Python 3.12+
|
|
8
|
-
- FastAPI + uvicorn
|
|
9
|
-
- Pydantic 2 & pydantic-settings
|
|
10
|
-
- pytest, pytest-asyncio
|
|
11
|
-
- mypy + black + isort
|
|
12
|
-
- aiofiles (async file handling)
|
|
13
|
-
|
|
14
|
-
## Project Structure
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
.
|
|
18
|
-
├── README.md
|
|
19
|
-
├── requirements.txt
|
|
20
|
-
├── setup.py
|
|
21
|
-
├── scripts
|
|
22
|
-
│ └── run-server.sh
|
|
23
|
-
├── src
|
|
24
|
-
│ ├── main.py
|
|
25
|
-
│ ├── schemas
|
|
26
|
-
│ │ └── items.py
|
|
27
|
-
│ ├── mocks
|
|
28
|
-
│ │ └── mock_items.json
|
|
29
|
-
│ ├── crud
|
|
30
|
-
│ │ └── items.py
|
|
31
|
-
│ ├── core
|
|
32
|
-
│ │ └── config.py
|
|
33
|
-
│ └── api
|
|
34
|
-
│ ├── api.py
|
|
35
|
-
│ └── routes
|
|
36
|
-
│ └── items.py
|
|
37
|
-
└── tests
|
|
38
|
-
├── __init__.py
|
|
39
|
-
├── test_items.py
|
|
40
|
-
└── conftest.py
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## How to Run
|
|
44
|
-
|
|
45
|
-
Run in virtual environment:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
# Install dependencies
|
|
49
|
-
$ pip install -r requirements.txt
|
|
50
|
-
|
|
51
|
-
# Start development server (using script)
|
|
52
|
-
$ bash scripts/run-server.sh
|
|
53
|
-
|
|
54
|
-
# Manual run
|
|
55
|
-
$ uvicorn src.main:app --reload
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Access API documentation after server starts:
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
<domain:port>/docs # Swagger format
|
|
62
|
-
<domain:port>/redoc # ReDoc format
|
|
63
|
-
|
|
64
|
-
# example
|
|
65
|
-
http://127.0.0.1:8000/docs
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## API Endpoints
|
|
69
|
-
|
|
70
|
-
| Method | Endpoint | Description |
|
|
71
|
-
|--------|------------------|----------------------------|
|
|
72
|
-
| GET | `/items/` | List all items |
|
|
73
|
-
| GET | `/items/{id}` | Get single item |
|
|
74
|
-
| POST | `/items/` | Create new item |
|
|
75
|
-
| PUT | `/items/{id}` | Update existing item |
|
|
76
|
-
| DELETE | `/items/{id}` | Delete item |
|
|
77
|
-
|
|
78
|
-
## Key Features
|
|
79
|
-
|
|
80
|
-
- Async file I/O operations using aiofiles
|
|
81
|
-
- Mock data initialization
|
|
82
|
-
- Pydantic model validation
|
|
83
|
-
- CRUD operations implementation
|
|
84
|
-
- Integrated test cases
|
|
85
|
-
- In-memory JSON database for development
|
|
86
|
-
|
|
87
|
-
## Running Tests
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
# Run all tests
|
|
91
|
-
$ pytest tests/
|
|
92
|
-
|
|
93
|
-
# Run specific test file
|
|
94
|
-
$ pytest tests/test_items.py -v
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
For FastAPI documentation: <https://fastapi.tiangolo.com/>
|
|
98
|
-
|
|
99
|
-
## Project Origin
|
|
100
|
-
|
|
101
|
-
This project was created using the [FastAPI-fastkit](https://github.com/bnbong/FastAPI-fastkit) template.
|
|
102
|
-
|
|
103
|
-
FastAPI-fastkit is an open-source project that helps developers quickly set up FastAPI-based applications with proper structure and tooling.
|
|
104
|
-
|
|
105
|
-
### Template Information
|
|
106
|
-
- Template author: [bnbong](mailto:bbbong9@gmail.com)
|
|
107
|
-
- Project maintainer: [bnbong](mailto:bbbong9@gmail.com)
|
|
1
|
+
# Async Item Management API Server
|
|
2
|
+
|
|
3
|
+
A FastAPI-based item management API implemented with asynchronous processing.
|
|
4
|
+
|
|
5
|
+
## Tech Stack
|
|
6
|
+
|
|
7
|
+
- Python 3.12+
|
|
8
|
+
- FastAPI + uvicorn
|
|
9
|
+
- Pydantic 2 & pydantic-settings
|
|
10
|
+
- pytest, pytest-asyncio
|
|
11
|
+
- mypy + black + isort
|
|
12
|
+
- aiofiles (async file handling)
|
|
13
|
+
|
|
14
|
+
## Project Structure
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
.
|
|
18
|
+
├── README.md
|
|
19
|
+
├── requirements.txt
|
|
20
|
+
├── setup.py
|
|
21
|
+
├── scripts
|
|
22
|
+
│ └── run-server.sh
|
|
23
|
+
├── src
|
|
24
|
+
│ ├── main.py
|
|
25
|
+
│ ├── schemas
|
|
26
|
+
│ │ └── items.py
|
|
27
|
+
│ ├── mocks
|
|
28
|
+
│ │ └── mock_items.json
|
|
29
|
+
│ ├── crud
|
|
30
|
+
│ │ └── items.py
|
|
31
|
+
│ ├── core
|
|
32
|
+
│ │ └── config.py
|
|
33
|
+
│ └── api
|
|
34
|
+
│ ├── api.py
|
|
35
|
+
│ └── routes
|
|
36
|
+
│ └── items.py
|
|
37
|
+
└── tests
|
|
38
|
+
├── __init__.py
|
|
39
|
+
├── test_items.py
|
|
40
|
+
└── conftest.py
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## How to Run
|
|
44
|
+
|
|
45
|
+
Run in virtual environment:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Install dependencies
|
|
49
|
+
$ pip install -r requirements.txt
|
|
50
|
+
|
|
51
|
+
# Start development server (using script)
|
|
52
|
+
$ bash scripts/run-server.sh
|
|
53
|
+
|
|
54
|
+
# Manual run
|
|
55
|
+
$ uvicorn src.main:app --reload
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Access API documentation after server starts:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
<domain:port>/docs # Swagger format
|
|
62
|
+
<domain:port>/redoc # ReDoc format
|
|
63
|
+
|
|
64
|
+
# example
|
|
65
|
+
http://127.0.0.1:8000/docs
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## API Endpoints
|
|
69
|
+
|
|
70
|
+
| Method | Endpoint | Description |
|
|
71
|
+
|--------|------------------|----------------------------|
|
|
72
|
+
| GET | `/items/` | List all items |
|
|
73
|
+
| GET | `/items/{id}` | Get single item |
|
|
74
|
+
| POST | `/items/` | Create new item |
|
|
75
|
+
| PUT | `/items/{id}` | Update existing item |
|
|
76
|
+
| DELETE | `/items/{id}` | Delete item |
|
|
77
|
+
|
|
78
|
+
## Key Features
|
|
79
|
+
|
|
80
|
+
- Async file I/O operations using aiofiles
|
|
81
|
+
- Mock data initialization
|
|
82
|
+
- Pydantic model validation
|
|
83
|
+
- CRUD operations implementation
|
|
84
|
+
- Integrated test cases
|
|
85
|
+
- In-memory JSON database for development
|
|
86
|
+
|
|
87
|
+
## Running Tests
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Run all tests
|
|
91
|
+
$ pytest tests/
|
|
92
|
+
|
|
93
|
+
# Run specific test file
|
|
94
|
+
$ pytest tests/test_items.py -v
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
For FastAPI documentation: <https://fastapi.tiangolo.com/>
|
|
98
|
+
|
|
99
|
+
## Project Origin
|
|
100
|
+
|
|
101
|
+
This project was created using the [FastAPI-fastkit](https://github.com/bnbong/FastAPI-fastkit) template.
|
|
102
|
+
|
|
103
|
+
FastAPI-fastkit is an open-source project that helps developers quickly set up FastAPI-based applications with proper structure and tooling.
|
|
104
|
+
|
|
105
|
+
### Template Information
|
|
106
|
+
- Template author: [bnbong](mailto:bbbong9@gmail.com)
|
|
107
|
+
- Project maintainer: [bnbong](mailto:bbbong9@gmail.com)
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
annotated-types==0.7.0
|
|
2
|
-
anyio==4.8.0
|
|
3
|
-
black==25.1.0
|
|
4
|
-
certifi==2025.1.31
|
|
5
|
-
click==8.1.8
|
|
6
|
-
fastapi==0.115.8
|
|
7
|
-
h11==0.14.0
|
|
8
|
-
httpcore==1.0.7
|
|
9
|
-
httptools==0.6.4
|
|
10
|
-
httpx==0.28.1
|
|
11
|
-
idna==3.10
|
|
12
|
-
iniconfig==2.0.0
|
|
13
|
-
isort==6.0.0
|
|
14
|
-
mypy==1.15.0
|
|
15
|
-
mypy-extensions==1.0.0
|
|
16
|
-
packaging==24.2
|
|
17
|
-
pathspec==0.12.1
|
|
18
|
-
platformdirs==4.3.6
|
|
19
|
-
pluggy==1.5.0
|
|
20
|
-
pydantic==2.10.6
|
|
21
|
-
pydantic-settings==2.7.1
|
|
22
|
-
pydantic_core==2.27.2
|
|
23
|
-
pytest==8.3.4
|
|
24
|
-
pytest-asyncio==0.25.3
|
|
25
|
-
python-dotenv==1.0.1
|
|
26
|
-
PyYAML==6.0.2
|
|
27
|
-
setuptools==75.8.0
|
|
28
|
-
sniffio==1.3.1
|
|
29
|
-
SQLAlchemy==2.0.38
|
|
30
|
-
starlette==0.45.3
|
|
31
|
-
typing_extensions==4.12.2
|
|
32
|
-
uvicorn==0.34.0
|
|
33
|
-
uvloop==0.21.0
|
|
34
|
-
watchfiles==1.0.4
|
|
35
|
-
websockets==15.0
|
|
36
|
-
aiofiles>=23.2.1
|
|
1
|
+
annotated-types==0.7.0
|
|
2
|
+
anyio==4.8.0
|
|
3
|
+
black==25.1.0
|
|
4
|
+
certifi==2025.1.31
|
|
5
|
+
click==8.1.8
|
|
6
|
+
fastapi==0.115.8
|
|
7
|
+
h11==0.14.0
|
|
8
|
+
httpcore==1.0.7
|
|
9
|
+
httptools==0.6.4
|
|
10
|
+
httpx==0.28.1
|
|
11
|
+
idna==3.10
|
|
12
|
+
iniconfig==2.0.0
|
|
13
|
+
isort==6.0.0
|
|
14
|
+
mypy==1.15.0
|
|
15
|
+
mypy-extensions==1.0.0
|
|
16
|
+
packaging==24.2
|
|
17
|
+
pathspec==0.12.1
|
|
18
|
+
platformdirs==4.3.6
|
|
19
|
+
pluggy==1.5.0
|
|
20
|
+
pydantic==2.10.6
|
|
21
|
+
pydantic-settings==2.7.1
|
|
22
|
+
pydantic_core==2.27.2
|
|
23
|
+
pytest==8.3.4
|
|
24
|
+
pytest-asyncio==0.25.3
|
|
25
|
+
python-dotenv==1.0.1
|
|
26
|
+
PyYAML==6.0.2
|
|
27
|
+
setuptools==75.8.0
|
|
28
|
+
sniffio==1.3.1
|
|
29
|
+
SQLAlchemy==2.0.38
|
|
30
|
+
starlette==0.45.3
|
|
31
|
+
typing_extensions==4.12.2
|
|
32
|
+
uvicorn==0.34.0
|
|
33
|
+
uvloop==0.21.0
|
|
34
|
+
watchfiles==1.0.4
|
|
35
|
+
websockets==15.0
|
|
36
|
+
aiofiles>=23.2.1
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -x
|
|
3
|
-
|
|
4
|
-
black .
|
|
5
|
-
isort .
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -x
|
|
3
|
+
|
|
4
|
+
black .
|
|
5
|
+
isort .
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -x
|
|
3
|
-
|
|
4
|
-
black . --check
|
|
5
|
-
mypy src
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -x
|
|
3
|
+
|
|
4
|
+
black . --check
|
|
5
|
+
mypy src
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
set -e
|
|
4
|
-
set -x
|
|
5
|
-
|
|
6
|
-
source .venv/bin/activate
|
|
7
|
-
|
|
8
|
-
uvicorn src.main:app --reload
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
set -x
|
|
5
|
+
|
|
6
|
+
source .venv/bin/activate
|
|
7
|
+
|
|
8
|
+
uvicorn src.main:app --reload
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
set -e
|
|
4
|
-
set -x
|
|
5
|
-
|
|
6
|
-
pytest
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
set -x
|
|
5
|
+
|
|
6
|
+
pytest
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
[mypy]
|
|
2
|
-
warn_unused_configs = true
|
|
3
|
-
ignore_missing_imports = true
|
|
4
|
-
|
|
5
|
-
[isort]
|
|
6
|
-
profile = black
|
|
7
|
-
line_length=100
|
|
8
|
-
virtual_env=venv
|
|
9
|
-
|
|
10
|
-
[tool:pytest]
|
|
11
|
-
testpaths = tests
|
|
12
|
-
addopts = -ra -q
|
|
13
|
-
asyncio_mode = auto
|
|
14
|
-
asyncio_default_fixture_loop_scope=session
|
|
1
|
+
[mypy]
|
|
2
|
+
warn_unused_configs = true
|
|
3
|
+
ignore_missing_imports = true
|
|
4
|
+
|
|
5
|
+
[isort]
|
|
6
|
+
profile = black
|
|
7
|
+
line_length=100
|
|
8
|
+
virtual_env=venv
|
|
9
|
+
|
|
10
|
+
[tool:pytest]
|
|
11
|
+
testpaths = tests
|
|
12
|
+
addopts = -ra -q
|
|
13
|
+
asyncio_mode = auto
|
|
14
|
+
asyncio_default_fixture_loop_scope=session
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
# --------------------------------------------------------------------------
|
|
2
|
-
# package setup module
|
|
3
|
-
# --------------------------------------------------------------------------
|
|
4
|
-
from setuptools import find_packages, setup
|
|
5
|
-
|
|
6
|
-
install_requires: list[str] = [
|
|
7
|
-
"fastapi",
|
|
8
|
-
"uvicorn",
|
|
9
|
-
"pydantic",
|
|
10
|
-
"pydantic-settings",
|
|
11
|
-
"python-dotenv",
|
|
12
|
-
"aiofiles",
|
|
13
|
-
"pytest",
|
|
14
|
-
"pytest-asyncio",
|
|
15
|
-
]
|
|
16
|
-
|
|
17
|
-
setup(
|
|
18
|
-
name="<project_name>",
|
|
19
|
-
description="[FastAPI-fastkit templated] <description>",
|
|
20
|
-
author="<author>",
|
|
21
|
-
author_email=f"<author_email>",
|
|
22
|
-
packages=find_packages(where="src"),
|
|
23
|
-
requires=["python (>=3.12)"],
|
|
24
|
-
install_requires=install_requires,
|
|
25
|
-
)
|
|
1
|
+
# --------------------------------------------------------------------------
|
|
2
|
+
# package setup module
|
|
3
|
+
# --------------------------------------------------------------------------
|
|
4
|
+
from setuptools import find_packages, setup
|
|
5
|
+
|
|
6
|
+
install_requires: list[str] = [
|
|
7
|
+
"fastapi",
|
|
8
|
+
"uvicorn",
|
|
9
|
+
"pydantic",
|
|
10
|
+
"pydantic-settings",
|
|
11
|
+
"python-dotenv",
|
|
12
|
+
"aiofiles",
|
|
13
|
+
"pytest",
|
|
14
|
+
"pytest-asyncio",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
setup(
|
|
18
|
+
name="<project_name>",
|
|
19
|
+
description="[FastAPI-fastkit templated] <description>",
|
|
20
|
+
author="<author>",
|
|
21
|
+
author_email=f"<author_email>",
|
|
22
|
+
packages=find_packages(where="src"),
|
|
23
|
+
requires=["python (>=3.12)"],
|
|
24
|
+
install_requires=install_requires,
|
|
25
|
+
)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# --------------------------------------------------------------------------
|
|
2
|
-
# API router connector module
|
|
3
|
-
# --------------------------------------------------------------------------
|
|
4
|
-
from fastapi import APIRouter
|
|
5
|
-
|
|
6
|
-
from src.api.routes import items
|
|
7
|
-
|
|
8
|
-
api_router = APIRouter()
|
|
9
|
-
api_router.include_router(items.router)
|
|
1
|
+
# --------------------------------------------------------------------------
|
|
2
|
+
# API router connector module
|
|
3
|
+
# --------------------------------------------------------------------------
|
|
4
|
+
from fastapi import APIRouter
|
|
5
|
+
|
|
6
|
+
from src.api.routes import items
|
|
7
|
+
|
|
8
|
+
api_router = APIRouter()
|
|
9
|
+
api_router.include_router(items.router)
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
# --------------------------------------------------------------------------
|
|
2
|
-
# Item CRUD Endpoint
|
|
3
|
-
# --------------------------------------------------------------------------
|
|
4
|
-
from typing import List
|
|
5
|
-
|
|
6
|
-
from fastapi import APIRouter, HTTPException
|
|
7
|
-
|
|
8
|
-
from src.crud.items import read_items, write_items
|
|
9
|
-
from src.schemas.items import ItemCreate, ItemResponse
|
|
10
|
-
|
|
11
|
-
router = APIRouter()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@router.get("/items", response_model=List[ItemResponse])
|
|
15
|
-
async def read_all_items():
|
|
16
|
-
return await read_items()
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@router.get("/items/{item_id}", response_model=ItemResponse)
|
|
20
|
-
async def read_item(item_id: int):
|
|
21
|
-
items = await read_items()
|
|
22
|
-
item = next((i for i in items if i["id"] == item_id), None)
|
|
23
|
-
if not item:
|
|
24
|
-
raise HTTPException(status_code=404, detail="Item not found")
|
|
25
|
-
return item
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
@router.post("/items", response_model=ItemResponse, status_code=201)
|
|
29
|
-
async def create_item(item: ItemCreate):
|
|
30
|
-
items = await read_items()
|
|
31
|
-
new_id = max(i["id"] for i in items) + 1 if items else 1
|
|
32
|
-
new_item = {**item.model_dump(), "id": new_id}
|
|
33
|
-
items.append(new_item)
|
|
34
|
-
await write_items(items)
|
|
35
|
-
return new_item
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
@router.put("/items/{item_id}", response_model=ItemResponse)
|
|
39
|
-
async def update_item(item_id: int, item: ItemCreate):
|
|
40
|
-
items = await read_items()
|
|
41
|
-
index = next((i for i, v in enumerate(items) if v["id"] == item_id), None)
|
|
42
|
-
if index is None:
|
|
43
|
-
raise HTTPException(status_code=404, detail="Item not found")
|
|
44
|
-
updated_item = {**item.model_dump(), "id": item_id}
|
|
45
|
-
items[index] = updated_item
|
|
46
|
-
await write_items(items)
|
|
47
|
-
return updated_item
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
@router.delete("/items/{item_id}")
|
|
51
|
-
async def delete_item(item_id: int):
|
|
52
|
-
items = await read_items()
|
|
53
|
-
new_items = [i for i in items if i["id"] != item_id]
|
|
54
|
-
if len(new_items) == len(items):
|
|
55
|
-
raise HTTPException(status_code=404, detail="Item not found")
|
|
56
|
-
await write_items(new_items)
|
|
57
|
-
return {"message": "Item deleted successfully"}
|
|
1
|
+
# --------------------------------------------------------------------------
|
|
2
|
+
# Item CRUD Endpoint
|
|
3
|
+
# --------------------------------------------------------------------------
|
|
4
|
+
from typing import List
|
|
5
|
+
|
|
6
|
+
from fastapi import APIRouter, HTTPException
|
|
7
|
+
|
|
8
|
+
from src.crud.items import read_items, write_items
|
|
9
|
+
from src.schemas.items import ItemCreate, ItemResponse
|
|
10
|
+
|
|
11
|
+
router = APIRouter()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@router.get("/items", response_model=List[ItemResponse])
|
|
15
|
+
async def read_all_items():
|
|
16
|
+
return await read_items()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@router.get("/items/{item_id}", response_model=ItemResponse)
|
|
20
|
+
async def read_item(item_id: int):
|
|
21
|
+
items = await read_items()
|
|
22
|
+
item = next((i for i in items if i["id"] == item_id), None)
|
|
23
|
+
if not item:
|
|
24
|
+
raise HTTPException(status_code=404, detail="Item not found")
|
|
25
|
+
return item
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@router.post("/items", response_model=ItemResponse, status_code=201)
|
|
29
|
+
async def create_item(item: ItemCreate):
|
|
30
|
+
items = await read_items()
|
|
31
|
+
new_id = max(i["id"] for i in items) + 1 if items else 1
|
|
32
|
+
new_item = {**item.model_dump(), "id": new_id}
|
|
33
|
+
items.append(new_item)
|
|
34
|
+
await write_items(items)
|
|
35
|
+
return new_item
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@router.put("/items/{item_id}", response_model=ItemResponse)
|
|
39
|
+
async def update_item(item_id: int, item: ItemCreate):
|
|
40
|
+
items = await read_items()
|
|
41
|
+
index = next((i for i, v in enumerate(items) if v["id"] == item_id), None)
|
|
42
|
+
if index is None:
|
|
43
|
+
raise HTTPException(status_code=404, detail="Item not found")
|
|
44
|
+
updated_item = {**item.model_dump(), "id": item_id}
|
|
45
|
+
items[index] = updated_item
|
|
46
|
+
await write_items(items)
|
|
47
|
+
return updated_item
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@router.delete("/items/{item_id}")
|
|
51
|
+
async def delete_item(item_id: int):
|
|
52
|
+
items = await read_items()
|
|
53
|
+
new_items = [i for i in items if i["id"] != item_id]
|
|
54
|
+
if len(new_items) == len(items):
|
|
55
|
+
raise HTTPException(status_code=404, detail="Item not found")
|
|
56
|
+
await write_items(new_items)
|
|
57
|
+
return {"message": "Item deleted successfully"}
|