ohmyapi 0.1.8__tar.gz → 0.1.9__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.1.8 → ohmyapi-0.1.9}/PKG-INFO +39 -10
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/README.md +38 -9
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/pyproject.toml +1 -1
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/cli.py +5 -5
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/__init__.py +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/__main__.py +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/builtin/auth/__init__.py +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/builtin/auth/models.py +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/builtin/auth/permissions.py +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/builtin/auth/routes.py +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/core/__init__.py +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/core/runtime.py +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/core/scaffolding.py +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/core/templates/app/__init__.py.j2 +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/core/templates/app/models.py.j2 +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/core/templates/app/routes.py.j2 +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/core/templates/project/README.md.j2 +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/core/templates/project/pyproject.toml.j2 +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/core/templates/project/settings.py.j2 +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/db/__init__.py +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/db/exceptions.py +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/db/model/__init__.py +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/db/model/model.py +0 -0
- {ohmyapi-0.1.8 → ohmyapi-0.1.9}/src/ohmyapi/router.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ohmyapi
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.9
|
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.
|
@@ -314,3 +306,40 @@ class Team(Model):
|
|
314
306
|
manager = TeamManager()
|
315
307
|
```
|
316
308
|
|
309
|
+
## Shell
|
310
|
+
|
311
|
+
Similar to Django, you can attach to an interactive shell with your project already loaded inside.
|
312
|
+
|
313
|
+
```
|
314
|
+
ohmyapi shell
|
315
|
+
|
316
|
+
Python 3.13.7 (main, Aug 15 2025, 12:34:02) [GCC 15.2.1 20250813]
|
317
|
+
Type 'copyright', 'credits' or 'license' for more information
|
318
|
+
IPython 9.5.0 -- An enhanced Interactive Python. Type '?' for help.
|
319
|
+
|
320
|
+
OhMyAPI Shell | Project: {{ project_name }} [{{ project_path }}]
|
321
|
+
Find your loaded project singleton via identifier: `p`
|
322
|
+
```
|
323
|
+
|
324
|
+
```python
|
325
|
+
In [1]: p
|
326
|
+
Out[1]: <ohmyapi.core.runtime.Project at 0xdeadbeefc0febabe>
|
327
|
+
|
328
|
+
In [2]: p.apps
|
329
|
+
Out[2]:
|
330
|
+
{'ohmyapi_auth': App: ohmyapi_auth
|
331
|
+
Models:
|
332
|
+
- Group
|
333
|
+
- User
|
334
|
+
Routes:
|
335
|
+
- APIRoute(path='/auth/login', name='login', methods=['POST'])
|
336
|
+
- APIRoute(path='/auth/refresh', name='refresh_token', methods=['POST'])
|
337
|
+
- APIRoute(path='/auth/me', name='me', methods=['GET'])
|
338
|
+
- APIRoute(path='/auth/introspect', name='introspect', methods=['GET'])}
|
339
|
+
|
340
|
+
In [3]: from tournament.models import Tournament
|
341
|
+
Out[3]:
|
342
|
+
|
343
|
+
```
|
344
|
+
|
345
|
+
|
@@ -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('
|
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.
|
@@ -281,3 +273,40 @@ class Team(Model):
|
|
281
273
|
class Meta:
|
282
274
|
manager = TeamManager()
|
283
275
|
```
|
276
|
+
|
277
|
+
## Shell
|
278
|
+
|
279
|
+
Similar to Django, you can attach to an interactive shell with your project already loaded inside.
|
280
|
+
|
281
|
+
```
|
282
|
+
ohmyapi shell
|
283
|
+
|
284
|
+
Python 3.13.7 (main, Aug 15 2025, 12:34:02) [GCC 15.2.1 20250813]
|
285
|
+
Type 'copyright', 'credits' or 'license' for more information
|
286
|
+
IPython 9.5.0 -- An enhanced Interactive Python. Type '?' for help.
|
287
|
+
|
288
|
+
OhMyAPI Shell | Project: {{ project_name }} [{{ project_path }}]
|
289
|
+
Find your loaded project singleton via identifier: `p`
|
290
|
+
```
|
291
|
+
|
292
|
+
```python
|
293
|
+
In [1]: p
|
294
|
+
Out[1]: <ohmyapi.core.runtime.Project at 0xdeadbeefc0febabe>
|
295
|
+
|
296
|
+
In [2]: p.apps
|
297
|
+
Out[2]:
|
298
|
+
{'ohmyapi_auth': App: ohmyapi_auth
|
299
|
+
Models:
|
300
|
+
- Group
|
301
|
+
- User
|
302
|
+
Routes:
|
303
|
+
- APIRoute(path='/auth/login', name='login', methods=['POST'])
|
304
|
+
- APIRoute(path='/auth/refresh', name='refresh_token', methods=['POST'])
|
305
|
+
- APIRoute(path='/auth/me', name='me', methods=['GET'])
|
306
|
+
- APIRoute(path='/auth/introspect', name='introspect', methods=['GET'])}
|
307
|
+
|
308
|
+
In [3]: from tournament.models import Tournament
|
309
|
+
Out[3]:
|
310
|
+
|
311
|
+
```
|
312
|
+
|
@@ -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.")
|
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
|