ohmyapi 0.1.8__py3-none-any.whl → 0.1.10__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.
ohmyapi/cli.py
CHANGED
@@ -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
|
-
"
|
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.
|
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.")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ohmyapi
|
3
|
-
Version: 0.1.
|
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('
|
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
|
+
|
@@ -4,7 +4,7 @@ ohmyapi/builtin/auth/__init__.py,sha256=TY1RKgwWmJ6FKz_v4J3m0Ang69qSmtVDLe4rqjLk
|
|
4
4
|
ohmyapi/builtin/auth/models.py,sha256=Xsxn9m5RTgY2a0PPfW3wTj77ocuuISytdl4ec_TR_kw,1524
|
5
5
|
ohmyapi/builtin/auth/permissions.py,sha256=NKljLhgEHcEIlzpWgqFyz-1PeCT2u0Vqkja4xy-Zj68,126
|
6
6
|
ohmyapi/builtin/auth/routes.py,sha256=DxlVzHSdMIbKMnWXMMGj_M-jUMFLHTt8avzBviM7Ia0,5625
|
7
|
-
ohmyapi/cli.py,sha256=
|
7
|
+
ohmyapi/cli.py,sha256=ZJVBRpSS297y00H4zffYQzkeIIVmVpGS4BYGpxT1FPo,3430
|
8
8
|
ohmyapi/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
ohmyapi/core/runtime.py,sha256=l5zffc4VTwQOo7G9mfiYHsPGapMONRX_jtO_z9QaKHU,8577
|
10
10
|
ohmyapi/core/scaffolding.py,sha256=iMymscokJ-YqzB0ZTC-gcc2T71o73577j9tnb2x8lH8,2572
|
@@ -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.
|
23
|
-
ohmyapi-0.1.
|
24
|
-
ohmyapi-0.1.
|
25
|
-
ohmyapi-0.1.
|
22
|
+
ohmyapi-0.1.10.dist-info/METADATA,sha256=xffjsR7JBYq5U17kPIbznhmp0cuwDPIJRtDKhLmSEtM,8038
|
23
|
+
ohmyapi-0.1.10.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88
|
24
|
+
ohmyapi-0.1.10.dist-info/entry_points.txt,sha256=wb3lw8-meAlpiv1mqcQ3m25ukL7djagU_w89GkrC37k,43
|
25
|
+
ohmyapi-0.1.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|