ohmyapi 0.1.14__py3-none-any.whl → 0.1.16__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.
@@ -1,4 +1,3 @@
1
- import os
2
1
  from pathlib import Path
3
2
  from jinja2 import Environment, FileSystemLoader
4
3
 
@@ -11,7 +10,7 @@ def render_template_file(template_path: Path, context: dict, output_path: Path):
11
10
  """Render a single Jinja2 template file to disk."""
12
11
  template = env.get_template(str(template_path.relative_to(TEMPLATE_DIR)).replace("\\", "/"))
13
12
  content = template.render(**context)
14
- os.makedirs(output_path.parent, exist_ok=True)
13
+ output_path.parent.mkdir(exist_ok=True)
15
14
  with open(output_path, "w", encoding="utf-8") as f:
16
15
  f.write(content)
17
16
 
@@ -22,7 +21,7 @@ def render_template_dir(template_subdir: str, target_dir: Path, context: dict, s
22
21
  If subdir_name is given, files are placed inside target_dir/subdir_name.
23
22
  """
24
23
  template_dir = TEMPLATE_DIR / template_subdir
25
- for root, _, files in os.walk(template_dir):
24
+ for root, _, files in template_dir.walk():
26
25
  root_path = Path(root)
27
26
  rel_root = root_path.relative_to(template_dir) # path relative to template_subdir
28
27
 
@@ -45,7 +44,7 @@ def render_template_dir(template_subdir: str, target_dir: Path, context: dict, s
45
44
  def startproject(name: str):
46
45
  """Create a new project: flat structure, all project templates go into <name>/"""
47
46
  target_dir = Path(name).resolve()
48
- os.makedirs(target_dir, exist_ok=True)
47
+ target_dir.mkdir(exist_ok=True)
49
48
  render_template_dir("project", target_dir, {"project_name": name})
50
49
  print(f"✅ Project '{name}' created successfully.")
51
50
  print(f"🔧 Next, configure your project in {target_dir / 'settings.py'}")
@@ -54,7 +53,7 @@ def startproject(name: str):
54
53
  def startapp(name: str, project: str):
55
54
  """Create a new app inside a project: templates go into <project_dir>/<name>/"""
56
55
  target_dir = Path(project)
57
- os.makedirs(target_dir, exist_ok=True)
56
+ target_dir.makedirs(exist_ok=True)
58
57
  render_template_dir("app", target_dir, {"project_name": target_dir.resolve().name, "app_name": name}, subdir_name=name)
59
58
  print(f"✅ App '{name}' created in project '{target_dir}' successfully.")
60
59
  print(f"🔧 Remember to add '{name}' to your INSTALLED_APPS!")
@@ -5,7 +5,7 @@ from . import models
5
5
  # Expose your app's routes via `router = fastapi.APIRouter`.
6
6
  # Use prefixes wisely to avoid cross-app namespace-collisions.
7
7
  # Tags improve the UX of the OpenAPI docs at /docs.
8
- router = APIRouter(prefix="/{{ app_name }}", tags=[{{ app_name }}])
8
+ router = APIRouter(prefix="/{{ app_name }}", tags=['{{ app_name }}'])
9
9
 
10
10
 
11
11
  @router.get("/")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ohmyapi
3
- Version: 0.1.14
3
+ Version: 0.1.16
4
4
  Summary: A Django-like but async web-framework based on FastAPI and TortoiseORM.
5
5
  License-Expression: MIT
6
6
  Keywords: fastapi,tortoise,orm,async,web-framework
@@ -7,10 +7,10 @@ ohmyapi/builtin/auth/routes.py,sha256=re3w7fZ9q9tUXDsQtkFcKizuEmtjxnebVA2lIO7afk
7
7
  ohmyapi/cli.py,sha256=Mip1eBKYyu1hmUHbNW-1kSMc05EJOTVXqdI0c0r_B4g,4440
8
8
  ohmyapi/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  ohmyapi/core/runtime.py,sha256=l5zffc4VTwQOo7G9mfiYHsPGapMONRX_jtO_z9QaKHU,8577
10
- ohmyapi/core/scaffolding.py,sha256=iMymscokJ-YqzB0ZTC-gcc2T71o73577j9tnb2x8lH8,2572
10
+ ohmyapi/core/scaffolding.py,sha256=G9XKm-6vYs7yIGBRO7-3EGSTr2xVCeqeQLV1bmPhvnk,2542
11
11
  ohmyapi/core/templates/app/__init__.py.j2,sha256=QwVIQVUGZVhdH1d4NrvL7NTsK4-T4cihzYs8UVX2dt4,43
12
12
  ohmyapi/core/templates/app/models.py.j2,sha256=_3w-vFJ5fgsmncsCv34k_wyCMF78jufbSSglns4gbb0,119
13
- ohmyapi/core/templates/app/routes.py.j2,sha256=o3XEBZDfHRhodx-6rX1ebnKpqqd-QApfw9ggruWl6y8,436
13
+ ohmyapi/core/templates/app/routes.py.j2,sha256=MoaAgzTkbr0GbuEic_fKn0PkCLERK8bB-mDlssOxYzE,438
14
14
  ohmyapi/core/templates/project/README.md.j2,sha256=SjR4JIrg-8XRE-UntUDwiw8jDpYitD_UjwoKkYJ7GLw,22
15
15
  ohmyapi/core/templates/project/pyproject.toml.j2,sha256=X0VS6YT9aL3vpHFKPTfLFsdpD8423nY57ySQpSTMxmQ,895
16
16
  ohmyapi/core/templates/project/settings.py.j2,sha256=RBKGB8MZWPM3Bp0a57Y1YrSvSXxh502TUnJqbbu48Ig,138
@@ -19,7 +19,7 @@ ohmyapi/db/exceptions.py,sha256=I7AubrdqQF_UvAvzKqz2ve08-BkXHzEWXnwG300StHE,35
19
19
  ohmyapi/db/model/__init__.py,sha256=k3StTNuKatpwZo_Z5JBFa-927eJrzibFE8U4SA82asc,32
20
20
  ohmyapi/db/model/model.py,sha256=BajFtLlQ1s0mZ2hj-_JNQhLQmxuVe-Lw2LuW5t2C7Rw,1579
21
21
  ohmyapi/router.py,sha256=hutccsrP9RT8W5O6uBDhOJehwqrkRoPzaUI5zoHPh9A,55
22
- ohmyapi-0.1.14.dist-info/METADATA,sha256=phAamjzQNPXdbFSrrGk_qH4CxECl5UmwTp0KiTpatWE,8766
23
- ohmyapi-0.1.14.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88
24
- ohmyapi-0.1.14.dist-info/entry_points.txt,sha256=wb3lw8-meAlpiv1mqcQ3m25ukL7djagU_w89GkrC37k,43
25
- ohmyapi-0.1.14.dist-info/RECORD,,
22
+ ohmyapi-0.1.16.dist-info/METADATA,sha256=DkBnka_fGGbY_RDY9QupwYBy_HoVZpG1yX9mB29u2Vc,8766
23
+ ohmyapi-0.1.16.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88
24
+ ohmyapi-0.1.16.dist-info/entry_points.txt,sha256=wb3lw8-meAlpiv1mqcQ3m25ukL7djagU_w89GkrC37k,43
25
+ ohmyapi-0.1.16.dist-info/RECORD,,