Skip to content

Commit 9cab788

Browse files
committed
[ADD, TEMPLATE] fastapi-psql-orm template added, edit fastkit list-templates operation, added template's testcase
1 parent 575f555 commit 9cab788

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1591
-32
lines changed

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,6 @@ Installing dependencies...
9393

9494
---> 100%
9595

96-
╭─────────────────────────────────────────────────────────────────── Success ────────────────────────────────────────────────────────────────────╮
97-
│ ✨ Project '<your-project-name>' has been created successfully! │
98-
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
99-
╭───────────────────────────────────────────────────────────────────── Info ─────────────────────────────────────────────────────────────────────╮
100-
│ ℹ To activate the virtual environment, run: │
101-
│ │
102-
│ source /<new-venv-path>/venv/bin/activate │
103-
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
10496
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Success ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
10597
│ ✨ Dependencies installed successfully │
10698
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

src/fastapi_fastkit/cli.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,18 @@ def list_templates(ctx: Context) -> None:
109109
print_error("Template directory not found.")
110110
return
111111

112+
excluded_dirs = ["__pycache__", "modules"]
112113
templates = [
113114
d
114115
for d in os.listdir(template_dir)
115-
if os.path.isdir(os.path.join(template_dir, d)) and d != "__pycache__"
116+
if os.path.isdir(os.path.join(template_dir, d)) and d not in excluded_dirs
116117
]
117118

118119
if not templates:
119120
print_warning("No available templates.")
120121
return
121122

122-
table = create_info_table(
123-
"Available Templates", {template: "No description" for template in templates}
124-
)
123+
table = create_info_table("Available Templates")
125124

126125
for template in templates:
127126
template_path = os.path.join(template_dir, template)

src/fastapi_fastkit/fastapi_project_template/fastapi-async-crud/setup.py-tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ from setuptools import find_packages, setup
55

66
install_requires: list[str] = [
77
"fastapi",
8+
"uvicorn",
89
"pydantic",
910
"pydantic-settings",
1011
"python-dotenv",
1112
"aiofiles",
13+
"pytest",
14+
"pytest-asyncio",
1215
]
1316

1417
setup(

src/fastapi_fastkit/fastapi_project_template/fastapi-custom-response/setup.py-tpl

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,20 @@
44
from setuptools import find_packages, setup
55

66
install_requires = [
7-
# Main Application Dependencies
8-
"fastapi==0.111.1",
9-
"uvicorn==0.30.1",
10-
"httpx==0.27.0",
11-
"jinja2==3.1.2",
12-
# ORM Dependencies
13-
"pydantic==2.8.2",
14-
"pydantic_core==2.20.1",
15-
"pydantic-settings==2.3.4",
16-
# Utility Dependencies
17-
"starlette==0.37.2",
18-
"typing_extensions==4.12.2",
19-
"watchfiles==0.22.0",
20-
"pytest==8.2.2",
21-
"pytest-asyncio==0.23.8",
22-
"FastAPI-fastkit",
7+
"fastapi",
8+
"uvicorn",
9+
"httpx",
10+
"pydantic",
11+
"pydantic_core",
12+
"pydantic-settings",
13+
"pytest",
14+
"pytest-asyncio",
2315
]
2416

2517
# IDE will watch this setup config through your project src, and help you to set up your environment
2618
setup(
2719
name="<project_name>",
28-
description="<description>",
20+
description="[FastAPI-fastkit templated] <description>",
2921
author="<author>",
3022
author_email=f"<author_email>",
3123
packages=find_packages(where="src"),

src/fastapi_fastkit/fastapi_project_template/fastapi-default/setup.py-tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ from setuptools import find_packages, setup
55

66
install_requires: list[str] = [
77
"fastapi",
8+
"uvicorn",
89
"pydantic",
910
"pydantic-settings",
1011
"python-dotenv",

src/fastapi_fastkit/fastapi_project_template/fastapi-dockerized/setup.py-tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ from setuptools import find_packages, setup
55

66
install_requires: list[str] = [
77
"fastapi",
8+
"uvicorn",
89
"pydantic",
910
"pydantic-settings",
1011
"python-dotenv",

src/fastapi_fastkit/fastapi_project_template/fastapi-empty/setup.py-tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ from setuptools import find_packages, setup
55

66
install_requires: list[str] = [
77
"fastapi",
8+
"uvicorn",
89
"pydantic",
910
"pydantic-settings",
1011
"python-dotenv",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Backend
2+
SECRET_KEY=changethis
3+
4+
# Postgres
5+
POSTGRES_SERVER=db
6+
POSTGRES_PORT=5432
7+
POSTGRES_USER=postgres
8+
POSTGRES_PASSWORD=postgres
9+
POSTGRES_DB=item_db
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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM python:3.12-slim
2+
3+
WORKDIR /app
4+
5+
RUN apt-get update && \
6+
apt-get install -y --no-install-recommends \
7+
build-essential \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
COPY requirements.txt .
11+
COPY setup.py .
12+
COPY src/ src/
13+
COPY tests/ tests/
14+
COPY scripts/ scripts/
15+
16+
RUN pip install --no-cache-dir -r requirements.txt
17+
18+
ENV PYTHONPATH=/app
19+
ENV ENVIRONMENT=production
20+
21+
EXPOSE 8000
22+
23+
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]

0 commit comments

Comments
 (0)