Skip to content

Commit eaf88cb

Browse files
committed
[TEMPLATE] add fastapi-default template
1 parent 1dc7f0e commit eaf88cb

24 files changed

+423
-1
lines changed

src/fastapi_fastkit/backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def inject_project_metadata(
8989
author_email: str,
9090
description: str,
9191
) -> None:
92-
# TODO : add main.py location at parameter
92+
# TODO : add main.py location at parameter & find settings.py, config.py, etc and inject project name init
9393
"""Inject project metadata."""
9494
try:
9595
main_py_path = os.path.join(target_dir, "main.py")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SECRET_KEY=changethis
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.idea
2+
.ipynb_checkpoints
3+
.mypy_cache
4+
.vscode
5+
__pycache__
6+
.pytest_cache
7+
htmlcov
8+
dist
9+
site
10+
.coverage*
11+
coverage.xml
12+
.netlify
13+
test.db
14+
log.txt
15+
Pipfile.lock
16+
env3.*
17+
env
18+
docs_build
19+
site_build
20+
venv
21+
docs.zip
22+
archive.zip
23+
24+
# vim temporary files
25+
*~
26+
.*.sw?
27+
.cache
28+
29+
# macOS
30+
.DS_Store
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Simple FastAPI Project
2+
3+
Simple CRUD API application using FastAPI
4+
5+
## Features
6+
7+
- Item Creation, Read, Update, Delete (CRUD) functionality
8+
- Automatic OpenAPI documentation generation (Swagger UI, ReDoc)
9+
- Test environment with mock data
10+
11+
## Stack
12+
13+
- Python 3.12+
14+
- FastAPI + uvicorn
15+
- pydantic & pydantic-settings
16+
- pytest
17+
- mypy + black + isort
18+
19+
## How to run
20+
21+
at venv, run command below:
22+
23+
```bash
24+
$ uvicorn src.main:app --reload
25+
```
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
python-dotenv==1.0.1
25+
PyYAML==6.0.2
26+
setuptools==75.8.0
27+
sniffio==1.3.1
28+
SQLAlchemy==2.0.38
29+
starlette==0.45.3
30+
typing_extensions==4.12.2
31+
uvicorn==0.34.0
32+
uvloop==0.21.0
33+
watchfiles==1.0.4
34+
websockets==15.0
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
set -x
3+
4+
black .
5+
isort .
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
set -x
3+
4+
black . --check
5+
mypy src
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -x
5+
6+
pytest
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
pythonpath = src
12+
testpaths = tests
13+
python_files = test_*.py
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# --------------------------------------------------------------------------
2+
# package setup module
3+
# --------------------------------------------------------------------------
4+
from setuptools import find_packages, setup
5+
6+
install_requires: list[str] = [
7+
"fastapi",
8+
"pydantic",
9+
"pydantic-settings",
10+
"python-dotenv",
11+
]
12+
13+
setup(
14+
name="<project_name>",
15+
description="<description>",
16+
author="<author>",
17+
author_email=f"<author_email>",
18+
packages=find_packages(where="src"),
19+
use_scm_version=True,
20+
requires=["python (>=3.12)"],
21+
install_requires=install_requires,
22+
)

0 commit comments

Comments
 (0)