ohmyapi 0.2.7__tar.gz → 0.2.8__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.
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/PKG-INFO +1 -1
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/pyproject.toml +1 -1
- ohmyapi-0.2.8/src/ohmyapi/__init__.py +1 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/cli.py +7 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/core/scaffolding.py +22 -0
- ohmyapi-0.2.8/src/ohmyapi/core/templates/docker/Dockerfile +30 -0
- ohmyapi-0.2.8/src/ohmyapi/core/templates/docker/docker-compose.yml +7 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/core/templates/project/pyproject.toml.j2 +1 -1
- ohmyapi-0.2.7/src/ohmyapi/__init__.py +0 -1
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/README.md +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/__main__.py +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/builtin/auth/__init__.py +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/builtin/auth/models.py +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/builtin/auth/permissions.py +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/builtin/auth/routes.py +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/builtin/demo/__init__.py +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/builtin/demo/models.py +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/builtin/demo/routes.py +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/core/__init__.py +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/core/runtime.py +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/core/templates/app/__init__.py.j2 +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/core/templates/app/models.py.j2 +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/core/templates/app/routes.py.j2 +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/core/templates/project/README.md.j2 +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/core/templates/project/settings.py.j2 +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/db/__init__.py +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/db/exceptions.py +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/db/model/__init__.py +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/db/model/model.py +0 -0
- {ohmyapi-0.2.7 → ohmyapi-0.2.8}/src/ohmyapi/router.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ohmyapi
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.8
|
4
4
|
Summary: Django-flavored scaffolding and management layer around FastAPI, Pydantic, TortoiseORM and Aerich migrations
|
5
5
|
License-Expression: MIT
|
6
6
|
Keywords: fastapi,tortoise,orm,pydantic,async,web-framework
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "ohmyapi"
|
3
|
-
version = "0.2.
|
3
|
+
version = "0.2.8"
|
4
4
|
description = "Django-flavored scaffolding and management layer around FastAPI, Pydantic, TortoiseORM and Aerich migrations"
|
5
5
|
license = "MIT"
|
6
6
|
keywords = ["fastapi", "tortoise", "orm", "pydantic", "async", "web-framework"]
|
@@ -0,0 +1 @@
|
|
1
|
+
__VERSION__ = "0.2.8"
|
@@ -27,6 +27,12 @@ def startapp(app_name: str, root: str = "."):
|
|
27
27
|
scaffolding.startapp(app_name, root)
|
28
28
|
|
29
29
|
|
30
|
+
@app.command()
|
31
|
+
def dockerize(root: str = "."):
|
32
|
+
"""Create template Dockerfile and docker-compose.yml."""
|
33
|
+
scaffolding.copy_static("docker", root)
|
34
|
+
|
35
|
+
|
30
36
|
@app.command()
|
31
37
|
def serve(root: str = ".", host="127.0.0.1", port=8000):
|
32
38
|
"""
|
@@ -41,6 +47,7 @@ def serve(root: str = ".", host="127.0.0.1", port=8000):
|
|
41
47
|
|
42
48
|
@app.command()
|
43
49
|
def shell(root: str = "."):
|
50
|
+
"""An interactive shell with your loaded project runtime."""
|
44
51
|
project_path = Path(root).resolve()
|
45
52
|
project = runtime.Project(project_path)
|
46
53
|
|
@@ -2,6 +2,8 @@ from pathlib import Path
|
|
2
2
|
|
3
3
|
from jinja2 import Environment, FileSystemLoader
|
4
4
|
|
5
|
+
import shutil
|
6
|
+
|
5
7
|
# Base templates directory
|
6
8
|
TEMPLATE_DIR = Path(__file__).parent / "templates"
|
7
9
|
env = Environment(loader=FileSystemLoader(str(TEMPLATE_DIR)))
|
@@ -53,6 +55,26 @@ def render_template_dir(
|
|
53
55
|
render_template_file(template_dir / template_rel_path, context, output_path)
|
54
56
|
|
55
57
|
|
58
|
+
def copy_static(dir_name: str, target_dir: Path):
|
59
|
+
"""Statically copy all files from {TEMPLATE_DIR}/{dir_name} to target_dir."""
|
60
|
+
template_dir = TEMPLATE_DIR / dir_name
|
61
|
+
target_dir = Path(target_dir)
|
62
|
+
if not template_dir.exists():
|
63
|
+
print(f"no templates found under: {dir_name}")
|
64
|
+
return
|
65
|
+
|
66
|
+
for root, _, files in template_dir.walk():
|
67
|
+
root_path = Path(root)
|
68
|
+
for file in files:
|
69
|
+
src = root_path / file
|
70
|
+
dst = target_dir / file
|
71
|
+
if dst.exists():
|
72
|
+
print(f"⛔ File exists, skipping: {dst}")
|
73
|
+
continue
|
74
|
+
shutil.copy(src, ".")
|
75
|
+
print(f"✅ Templates created successfully.")
|
76
|
+
print(f"🔧 Next, run `docker compose up -d --build`")
|
77
|
+
|
56
78
|
def startproject(name: str):
|
57
79
|
"""Create a new project: flat structure, all project templates go into <name>/"""
|
58
80
|
target_dir = Path(name).resolve()
|
@@ -0,0 +1,30 @@
|
|
1
|
+
FROM python:3.13-alpine
|
2
|
+
|
3
|
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
4
|
+
PYTHONUNBUFFERED=1 \
|
5
|
+
POETRY_HOME="/opt/poetry" \
|
6
|
+
POETRY_VIRTUALENVS_IN_PROJECT=true \
|
7
|
+
POETRY_NO_INTERACTION=1
|
8
|
+
|
9
|
+
RUN apk add --no-cache \
|
10
|
+
build-base \
|
11
|
+
curl \
|
12
|
+
git \
|
13
|
+
bash \
|
14
|
+
libffi-dev \
|
15
|
+
openssl-dev \
|
16
|
+
python3-dev \
|
17
|
+
musl-dev
|
18
|
+
|
19
|
+
RUN curl -sSL https://install.python-poetry.org | python3 -
|
20
|
+
ENV PATH="$POETRY_HOME/bin:$PATH"
|
21
|
+
|
22
|
+
WORKDIR /app
|
23
|
+
COPY pyproject.toml poetry.lock* /app/
|
24
|
+
RUN poetry lock
|
25
|
+
RUN poetry install
|
26
|
+
COPY . /app
|
27
|
+
|
28
|
+
EXPOSE 8000
|
29
|
+
|
30
|
+
CMD ["poetry", "run", "ohmyapi", "serve", "--host", "0.0.0.0"]
|
@@ -1 +0,0 @@
|
|
1
|
-
__VERSION__ = "0.2.7"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|