ohmyapi 0.1.8__tar.gz → 0.1.10__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.
Files changed (24) hide show
  1. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/PKG-INFO +39 -11
  2. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/README.md +38 -10
  3. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/pyproject.toml +1 -1
  4. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/cli.py +5 -5
  5. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/__init__.py +0 -0
  6. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/__main__.py +0 -0
  7. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/builtin/auth/__init__.py +0 -0
  8. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/builtin/auth/models.py +0 -0
  9. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/builtin/auth/permissions.py +0 -0
  10. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/builtin/auth/routes.py +0 -0
  11. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/core/__init__.py +0 -0
  12. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/core/runtime.py +0 -0
  13. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/core/scaffolding.py +0 -0
  14. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/core/templates/app/__init__.py.j2 +0 -0
  15. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/core/templates/app/models.py.j2 +0 -0
  16. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/core/templates/app/routes.py.j2 +0 -0
  17. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/core/templates/project/README.md.j2 +0 -0
  18. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/core/templates/project/pyproject.toml.j2 +0 -0
  19. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/core/templates/project/settings.py.j2 +0 -0
  20. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/db/__init__.py +0 -0
  21. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/db/exceptions.py +0 -0
  22. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/db/model/__init__.py +0 -0
  23. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/db/model/model.py +0 -0
  24. {ohmyapi-0.1.8 → ohmyapi-0.1.10}/src/ohmyapi/router.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ohmyapi
3
- Version: 0.1.8
3
+ Version: 0.1.10
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
@@ -132,7 +132,7 @@ class Event(Model):
132
132
  id = field.data.UUIDField(primary_key=True)
133
133
  name = field.TextField()
134
134
  tournament = field.ForeignKeyField('tournament.Tournament', related_name='events')
135
- participants = field.ManyToManyField('torunament.Team', related_name='events', through='event_team')
135
+ participants = field.ManyToManyField('tournament.Team', related_name='events', through='event_team')
136
136
  modified = field.DatetimeField(auto_now=True)
137
137
  prize = field.DecimalField(max_digits=10, decimal_places=2, null=True)
138
138
 
@@ -215,14 +215,6 @@ Run your project:
215
215
  ohmyapi serve
216
216
  ```
217
217
 
218
- ## Shell
219
-
220
- Similar to Django, you can attach to an interactive shell with your project already loaded inside.
221
-
222
- ```
223
- ohmyapi shell
224
- ```
225
-
226
218
  ## Authentication
227
219
 
228
220
  A builtin auth app is available.
@@ -299,7 +291,6 @@ Use Tortoise's `Manager` to implement model-level permissions.
299
291
 
300
292
  ```python
301
293
  from ohmyapi.db import Manager
302
- from typing import Callable
303
294
 
304
295
 
305
296
  class TeamManager(Manager):
@@ -314,3 +305,40 @@ class Team(Model):
314
305
  manager = TeamManager()
315
306
  ```
316
307
 
308
+ ## Shell
309
+
310
+ Similar to Django, you can attach to an interactive shell with your project already loaded inside.
311
+
312
+ ```
313
+ ohmyapi shell
314
+
315
+ Python 3.13.7 (main, Aug 15 2025, 12:34:02) [GCC 15.2.1 20250813]
316
+ Type 'copyright', 'credits' or 'license' for more information
317
+ IPython 9.5.0 -- An enhanced Interactive Python. Type '?' for help.
318
+
319
+ OhMyAPI Shell | Project: {{ project_name }} [{{ project_path }}]
320
+ Find your loaded project singleton via identifier: `p`
321
+ ```
322
+
323
+ ```python
324
+ In [1]: p
325
+ Out[1]: <ohmyapi.core.runtime.Project at 0xdeadbeefc0febabe>
326
+
327
+ In [2]: p.apps
328
+ Out[2]:
329
+ {'ohmyapi_auth': App: ohmyapi_auth
330
+ Models:
331
+ - Group
332
+ - User
333
+ Routes:
334
+ - APIRoute(path='/auth/login', name='login', methods=['POST'])
335
+ - APIRoute(path='/auth/refresh', name='refresh_token', methods=['POST'])
336
+ - APIRoute(path='/auth/me', name='me', methods=['GET'])
337
+ - APIRoute(path='/auth/introspect', name='introspect', methods=['GET'])}
338
+
339
+ In [3]: from tournament.models import Tournament
340
+ Out[3]:
341
+
342
+ ```
343
+
344
+
@@ -100,7 +100,7 @@ class Event(Model):
100
100
  id = field.data.UUIDField(primary_key=True)
101
101
  name = field.TextField()
102
102
  tournament = field.ForeignKeyField('tournament.Tournament', related_name='events')
103
- participants = field.ManyToManyField('torunament.Team', related_name='events', through='event_team')
103
+ participants = field.ManyToManyField('tournament.Team', related_name='events', through='event_team')
104
104
  modified = field.DatetimeField(auto_now=True)
105
105
  prize = field.DecimalField(max_digits=10, decimal_places=2, null=True)
106
106
 
@@ -183,14 +183,6 @@ Run your project:
183
183
  ohmyapi serve
184
184
  ```
185
185
 
186
- ## Shell
187
-
188
- Similar to Django, you can attach to an interactive shell with your project already loaded inside.
189
-
190
- ```
191
- ohmyapi shell
192
- ```
193
-
194
186
  ## Authentication
195
187
 
196
188
  A builtin auth app is available.
@@ -267,7 +259,6 @@ Use Tortoise's `Manager` to implement model-level permissions.
267
259
 
268
260
  ```python
269
261
  from ohmyapi.db import Manager
270
- from typing import Callable
271
262
 
272
263
 
273
264
  class TeamManager(Manager):
@@ -281,3 +272,40 @@ class Team(Model):
281
272
  class Meta:
282
273
  manager = TeamManager()
283
274
  ```
275
+
276
+ ## Shell
277
+
278
+ Similar to Django, you can attach to an interactive shell with your project already loaded inside.
279
+
280
+ ```
281
+ ohmyapi shell
282
+
283
+ Python 3.13.7 (main, Aug 15 2025, 12:34:02) [GCC 15.2.1 20250813]
284
+ Type 'copyright', 'credits' or 'license' for more information
285
+ IPython 9.5.0 -- An enhanced Interactive Python. Type '?' for help.
286
+
287
+ OhMyAPI Shell | Project: {{ project_name }} [{{ project_path }}]
288
+ Find your loaded project singleton via identifier: `p`
289
+ ```
290
+
291
+ ```python
292
+ In [1]: p
293
+ Out[1]: <ohmyapi.core.runtime.Project at 0xdeadbeefc0febabe>
294
+
295
+ In [2]: p.apps
296
+ Out[2]:
297
+ {'ohmyapi_auth': App: ohmyapi_auth
298
+ Models:
299
+ - Group
300
+ - User
301
+ Routes:
302
+ - APIRoute(path='/auth/login', name='login', methods=['POST'])
303
+ - APIRoute(path='/auth/refresh', name='refresh_token', methods=['POST'])
304
+ - APIRoute(path='/auth/me', name='me', methods=['GET'])
305
+ - APIRoute(path='/auth/introspect', name='introspect', methods=['GET'])}
306
+
307
+ In [3]: from tournament.models import Tournament
308
+ Out[3]:
309
+
310
+ ```
311
+
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ohmyapi"
3
- version = "0.1.8"
3
+ version = "0.1.10"
4
4
  description = "A Django-like but async web-framework based on FastAPI and TortoiseORM."
5
5
  license = "MIT"
6
6
  keywords = ["fastapi", "tortoise", "orm", "async", "web-framework"]
@@ -9,7 +9,9 @@ from ohmyapi.core import scaffolding, runtime
9
9
  from pathlib import Path
10
10
 
11
11
  app = typer.Typer(help="OhMyAPI — Django-flavored FastAPI scaffolding with tightly integrated TortoiseORM.")
12
- banner = """OhMyAPI Shell | Project: {project_name}"""
12
+ banner = """OhMyAPI Shell | Project: {project_name}
13
+ Find your loaded project singleton via identifier: `p`
14
+ """
13
15
 
14
16
 
15
17
  @app.command()
@@ -46,16 +48,14 @@ def shell(root: str = "."):
46
48
  try:
47
49
  from IPython import start_ipython
48
50
  shell_vars = {
49
- "settings": project.settings,
50
- "project": Path(project_path).resolve(),
51
+ "p": project,
51
52
  }
52
53
  from traitlets.config.loader import Config
53
54
  c = Config()
54
55
  c.TerminalIPythonApp.display_banner = True
55
- c.TerminalInteractiveShell.banner1 = banner.format(**{
56
+ c.TerminalInteractiveShell.banner2 = banner.format(**{
56
57
  "project_name": f"{f'{project.settings.PROJECT_NAME} ' if getattr(project.settings, 'PROJECT_NAME', '') else ''}[{Path(project_path).resolve()}]",
57
58
  })
58
- c.TerminalInteractiveShell.banner2 = " "
59
59
  start_ipython(argv=[], user_ns=shell_vars, config=c)
60
60
  except ImportError:
61
61
  typer.echo("IPython is not installed. Falling back to built-in Python shell.")
File without changes