piccolo 1.5.0__py3-none-any.whl → 1.5.1__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.
piccolo/__init__.py CHANGED
@@ -1 +1 @@
1
- __VERSION__ = "1.5.0"
1
+ __VERSION__ = "1.5.1"
@@ -16,6 +16,7 @@ ROUTER_DEPENDENCIES = {
16
16
  "blacksheep": ["blacksheep"],
17
17
  "litestar": ["litestar"],
18
18
  "esmerald": ["esmerald"],
19
+ "lilya": ["lilya"],
19
20
  }
20
21
  ROUTERS = list(ROUTER_DEPENDENCIES.keys())
21
22
 
@@ -0,0 +1,45 @@
1
+ from piccolo_admin.endpoints import create_admin
2
+ from piccolo_api.crud.endpoints import PiccoloCRUD
3
+ from piccolo.engine import engine_finder
4
+ from lilya.routing import Path, Include
5
+ from lilya.apps import Lilya
6
+ from lilya.staticfiles import StaticFiles
7
+
8
+ from home.endpoints import HomeController
9
+ from home.piccolo_app import APP_CONFIG
10
+ from home.tables import Task
11
+
12
+
13
+ app = Lilya(
14
+ routes=[
15
+ Path("/", HomeController),
16
+ Include(
17
+ "/admin/",
18
+ create_admin(
19
+ tables=APP_CONFIG.table_classes,
20
+ # Required when running under HTTPS:
21
+ # allowed_hosts=['my_site.com']
22
+ )
23
+ ),
24
+ Include("/static/", StaticFiles(directory="static")),
25
+ Include("/tasks/", PiccoloCRUD(table=Task))
26
+ ],
27
+ )
28
+
29
+
30
+ @app.on_event("on_startup")
31
+ async def open_database_connection_pool():
32
+ try:
33
+ engine = engine_finder()
34
+ await engine.start_connection_pool()
35
+ except Exception:
36
+ print("Unable to connect to the database")
37
+
38
+
39
+ @app.on_event("on_shutdown")
40
+ async def close_database_connection_pool():
41
+ try:
42
+ engine = engine_finder()
43
+ await engine.close_connection_pool()
44
+ except Exception:
45
+ print("Unable to connect to the database")
@@ -8,4 +8,6 @@
8
8
  {% include '_litestar_app.py.jinja' %}
9
9
  {% elif router == 'esmerald' %}
10
10
  {% include '_esmerald_app.py.jinja' %}
11
+ {% elif router == 'lilya' %}
12
+ {% include '_lilya_app.py.jinja' %}
11
13
  {% endif %}
@@ -0,0 +1,21 @@
1
+ import os
2
+
3
+ import jinja2
4
+ from lilya.controllers import Controller
5
+ from lilya.responses import HTMLResponse
6
+
7
+
8
+ ENVIRONMENT = jinja2.Environment(
9
+ loader=jinja2.FileSystemLoader(
10
+ searchpath=os.path.join(os.path.dirname(__file__), "templates")
11
+ )
12
+ )
13
+
14
+
15
+ class HomeController(Controller):
16
+ async def get(self, request):
17
+ template = ENVIRONMENT.get_template("home.html.jinja")
18
+
19
+ content = template.render(title="Piccolo + ASGI",)
20
+
21
+ return HTMLResponse(content)
@@ -6,4 +6,6 @@
6
6
  {% include '_litestar_endpoints.py.jinja' %}
7
7
  {% elif router == 'esmerald' %}
8
8
  {% include '_esmerald_endpoints.py.jinja' %}
9
+ {% elif router == 'lilya' %}
10
+ {% include '_lilya_endpoints.py.jinja' %}
9
11
  {% endif %}
@@ -61,6 +61,11 @@
61
61
  <li><a href="/admin/">Admin</a></li>
62
62
  <li><a href="/docs/swagger">Swagger API</a></li>
63
63
  </ul>
64
+ <h3>Lilya</h3>
65
+ <ul>
66
+ <li><a href="/admin/">Admin</a></li>
67
+ <li><a href="/tasks/">JSON endpoint</a></li>
68
+ </ul>
64
69
  </section>
65
70
  </div>
66
71
  {% endblock content %}
@@ -78,9 +78,11 @@ class BackwardsMigrationManager(BaseMigrationManager):
78
78
  _continue = (
79
79
  "y"
80
80
  if self.auto_agree
81
- else input(f"Reverse {n} migration{'s' if n != 1 else ''}? [y/N] ")
81
+ else input(
82
+ f"Reverse {n} migration{'s' if n != 1 else ''}? [y/N] "
83
+ ).lower()
82
84
  )
83
- if _continue in "yY":
85
+ if _continue == "y":
84
86
  for migration_id in reversed_migration_ids:
85
87
  migration_module = migration_modules[migration_id]
86
88
  response = await migration_module.forwards()
@@ -131,10 +133,10 @@ async def run_backwards(
131
133
  "apps:\n"
132
134
  f"{', '.join(names)}\n"
133
135
  "Are you sure you want to continue? [y/N] "
134
- )
136
+ ).lower()
135
137
  )
136
138
 
137
- if _continue not in "yY":
139
+ if _continue != "y":
138
140
  return MigrationResult(success=False, message="user cancelled")
139
141
  for _app_name in sorted_app_names:
140
142
  print_heading(_app_name)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: piccolo
3
- Version: 1.5.0
3
+ Version: 1.5.1
4
4
  Summary: A fast, user friendly ORM and query builder which supports asyncio.
5
5
  Home-page: https://github.com/piccolo-orm/piccolo
6
6
  Author: Daniel Townsend
@@ -144,7 +144,7 @@ Let Piccolo scaffold you an ASGI web app, using Piccolo as the ORM:
144
144
  piccolo asgi new
145
145
  ```
146
146
 
147
- [Starlette](https://www.starlette.io/), [FastAPI](https://fastapi.tiangolo.com/), [BlackSheep](https://www.neoteroi.dev/blacksheep/), [Litestar](https://litestar.dev/) and [Esmerald](https://esmerald.dev/) are currently supported.
147
+ [Starlette](https://www.starlette.io/), [FastAPI](https://fastapi.tiangolo.com/), [BlackSheep](https://www.neoteroi.dev/blacksheep/), [Litestar](https://litestar.dev/), [Esmerald](https://esmerald.dev/) and [Lilya](https://lilya.dev) are currently supported.
148
148
 
149
149
  ## Are you a Django user?
150
150
 
@@ -1,4 +1,4 @@
1
- piccolo/__init__.py,sha256=qES-IZ6zqJOP7rIsdL8ARFeVec9WeO-kd278gxhW7Ks,22
1
+ piccolo/__init__.py,sha256=fhNN-7ULy_9pNKoacDRvSuTI6i1H6WO1D2dUk7PEiqQ,22
2
2
  piccolo/custom_types.py,sha256=7HMQAze-5mieNLfbQ5QgbRQgR2abR7ol0qehv2SqROY,604
3
3
  piccolo/main.py,sha256=1VsFV67FWTUikPTysp64Fmgd9QBVa_9wcwKfwj2UCEA,5117
4
4
  piccolo/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -17,14 +17,15 @@ piccolo/apps/app/commands/templates/tables.py.jinja,sha256=revzdrvDDwe78VedBKz0z
17
17
  piccolo/apps/asgi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  piccolo/apps/asgi/piccolo_app.py,sha256=7VUvqQJbB-ScO0A62S6MiJmQL9F5DS-SdlqlDLbAblE,217
19
19
  piccolo/apps/asgi/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- piccolo/apps/asgi/commands/new.py,sha256=vZHSI2Pyh9cnVKbjPIiXEVFJ4JWfO-iBOCwvJSfPJyw,4206
20
+ piccolo/apps/asgi/commands/new.py,sha256=ZyYgwpBXb0t-0KQraeja6Y9ANjGEdZCXpu9bmm7_cPc,4230
21
21
  piccolo/apps/asgi/commands/templates/app/README.md.jinja,sha256=As3gNEZt9qcRmTVkjCzNtXJ8r4-3g0fCSe7Q-P39ezI,214
22
22
  piccolo/apps/asgi/commands/templates/app/_blacksheep_app.py.jinja,sha256=bgAGe0a9nWk0LAqK3VNDhPcKGqg0z8V-eIX2YmMoZLk,3117
23
23
  piccolo/apps/asgi/commands/templates/app/_esmerald_app.py.jinja,sha256=S-oYY6OFhwJA8PEYnrklQUkqtot3aXTmd7QGrW8Ufn4,2670
24
24
  piccolo/apps/asgi/commands/templates/app/_fastapi_app.py.jinja,sha256=cCmRVAN8gw6zfHBcLI_NxapwN7LGM5QSXM7K94imDh8,2436
25
+ piccolo/apps/asgi/commands/templates/app/_lilya_app.py.jinja,sha256=8rV1p-POGHkFIqvHvlE5wWwWPZweuSnMJhwreLMgLo8,1259
25
26
  piccolo/apps/asgi/commands/templates/app/_litestar_app.py.jinja,sha256=oMH5KXoEYhf9qgXNj2Kepc6prps1MQECufdUduaiwe4,2815
26
27
  piccolo/apps/asgi/commands/templates/app/_starlette_app.py.jinja,sha256=YvNUlJuTd4mj-pm3WQKbQq3w3x3VfDb_Wz6aQLUsORo,1271
27
- piccolo/apps/asgi/commands/templates/app/app.py.jinja,sha256=_ILj6Ap1AvAP55ZxrbNedTVsXr9klW3eh-GRf9WTQLs,389
28
+ piccolo/apps/asgi/commands/templates/app/app.py.jinja,sha256=gROY-LbHl8NtHDM_ntkI7Rjcbtg2ypDZ1FunBvpdjE4,458
28
29
  piccolo/apps/asgi/commands/templates/app/conftest.py.jinja,sha256=ZG1pRVMv3LhIfOsO3_08c_fF3EV4_EApuDHiIFFPJdk,497
29
30
  piccolo/apps/asgi/commands/templates/app/main.py.jinja,sha256=azwXyWZGkrIbZv5bZF_4Tvbly7AXkw5yFWGCHYImGeo,421
30
31
  piccolo/apps/asgi/commands/templates/app/piccolo_conf.py.jinja,sha256=f9Nb08_yipi0_mDUYrUvVoGCz7MRRS5QjCdUGBHN760,379
@@ -33,14 +34,15 @@ piccolo/apps/asgi/commands/templates/app/requirements.txt.jinja,sha256=w4FXnehMN
33
34
  piccolo/apps/asgi/commands/templates/app/home/__init__.py.jinja,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
35
  piccolo/apps/asgi/commands/templates/app/home/_blacksheep_endpoints.py.jinja,sha256=Rri_xzDkl87G5ME74qTxY25cwKIKufuzgkRsy__mNts,510
35
36
  piccolo/apps/asgi/commands/templates/app/home/_esmerald_endpoints.py.jinja,sha256=D_Slfc3IfTyBgq_VUIG5_AW5pVvvSqn-YGQspxMJNsE,499
37
+ piccolo/apps/asgi/commands/templates/app/home/_lilya_endpoints.py.jinja,sha256=nKSJ9VPTUTaLD9oDqAUseNuQkcPLBxShPAEfZK15rSE,490
36
38
  piccolo/apps/asgi/commands/templates/app/home/_litestar_endpoints.py.jinja,sha256=zXbYXDXFeeOCXmWBa_QK0kWGlBnv6T_A2jOHuvp9oCs,553
37
39
  piccolo/apps/asgi/commands/templates/app/home/_starlette_endpoints.py.jinja,sha256=KEjNEUKiZNBIWYAt9EgPHe4yCbkKLtlhaCBce9YI-RQ,498
38
- piccolo/apps/asgi/commands/templates/app/home/endpoints.py.jinja,sha256=G8Anx5v4Xszo0h0uCAduhWsXZDWluJvhMp0cr4kRezM,353
40
+ piccolo/apps/asgi/commands/templates/app/home/endpoints.py.jinja,sha256=Vc7pllhzKeNyj1XPzqdRH1AUpv7D4pooBIrUMt6gK7I,428
39
41
  piccolo/apps/asgi/commands/templates/app/home/piccolo_app.py.jinja,sha256=4gETiW9ukTNsomeJOvrRkqPbToZ_FU0b3LsNIaEYyP8,505
40
42
  piccolo/apps/asgi/commands/templates/app/home/tables.py.jinja,sha256=wk34RAsuoFn5iJ4OHlQzUqgatq6QB2G9tFE0BYkaers,197
41
43
  piccolo/apps/asgi/commands/templates/app/home/piccolo_migrations/README.md,sha256=ji6UOtHvzHX-eS_qhhKTN36ZXNZ7QwtjwjdE4Qgm35A,59
42
44
  piccolo/apps/asgi/commands/templates/app/home/templates/base.html.jinja_raw,sha256=3RqiNuyAap_P-xNK3uhNaQQ6rC365VzPmRqmmXSLO8o,451
43
- piccolo/apps/asgi/commands/templates/app/home/templates/home.html.jinja_raw,sha256=yfIE_m6qAEjY8v-W16p7gN1LPYrtyCVWictgyiuoqlM,2461
45
+ piccolo/apps/asgi/commands/templates/app/home/templates/home.html.jinja_raw,sha256=QJI0MY0hydMdqPg9YcW7XmmccJ1PyHvOSRIvMJX3ij0,2637
44
46
  piccolo/apps/asgi/commands/templates/app/static/favicon.ico,sha256=IvcgeJHObd9kj2mNIXkJdXYxMU8OaOymyYQWnWfbtHo,7406
45
47
  piccolo/apps/asgi/commands/templates/app/static/main.css,sha256=vudarPLglQ6NOgJiNeU2x0yQl0DiWScqb09QZv2wAzM,1056
46
48
  piccolo/apps/fixtures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -65,7 +67,7 @@ piccolo/apps/migrations/auto/schema_snapshot.py,sha256=ZqUg4NpChOeoACKF2gkhqsz1B
65
67
  piccolo/apps/migrations/auto/serialisation.py,sha256=nlomUL-TwD_7Gjb8ttRZfIwn9VbNoEmRmD3LElP5e0k,23927
66
68
  piccolo/apps/migrations/auto/serialisation_legacy.py,sha256=Edqx3YL0RGTsTHLNkHRNnXdfX6ut1h65U7UX2cI_BkE,1752
67
69
  piccolo/apps/migrations/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
68
- piccolo/apps/migrations/commands/backwards.py,sha256=DYynglPXtzK4zUxmSOfOhjJArq95mv0mf8WWwzrKQOM,6575
70
+ piccolo/apps/migrations/commands/backwards.py,sha256=i96eR6_P7IJQDtbaPmIleDg0nCoZubP2P2hNOLtbbT8,6615
69
71
  piccolo/apps/migrations/commands/base.py,sha256=v-uEfoSNpiHJivBO1YUc3yyDqwXyADIl53xNo_LnRZM,4475
70
72
  piccolo/apps/migrations/commands/check.py,sha256=VdaIjs3FFy_nwN6kjGKMoVQ4zp1Bdoej756UJBj79Pk,3982
71
73
  piccolo/apps/migrations/commands/clean.py,sha256=XD4xqtqkL5ZqnwIghzo5Yo2UnBAeznBVyrTiw6SnaCQ,2855
@@ -235,7 +237,7 @@ tests/apps/user/commands/test_change_permissions.py,sha256=uVKEiT1EKot3VA2TDETdQ
235
237
  tests/apps/user/commands/test_create.py,sha256=iJ3Tti62rHwvdcTwNXrc5JPam6vR1qxKRdMN456vm3o,2250
236
238
  tests/apps/user/commands/test_list.py,sha256=ipPfGdW6fH7q-Jc7JcYUvlioGmH9GQU0WImZGC2m-XQ,2840
237
239
  tests/columns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
238
- tests/columns/test_array.py,sha256=eBi3OndotufqW91v7YeqQE3rHEcq_QLaX0ogJaFKETc,6661
240
+ tests/columns/test_array.py,sha256=R6dnUBGcMHi5pVhczI4ydWpXsu2FqRASu6KtkhDWfZo,6660
239
241
  tests/columns/test_base.py,sha256=CTqCNcrqAJTjLXe3MCZgTczrmB3jcVRcOpU4FilpLoQ,3918
240
242
  tests/columns/test_bigint.py,sha256=a0B4y1H02ww5qaW574X2lyenbY6o29ztOhiaqybPC0c,1149
241
243
  tests/columns/test_boolean.py,sha256=kDESp6FnRtSZhuqIu0dBRwKMSpS5TFbbs3sz2MyZSs8,1720
@@ -348,9 +350,9 @@ tests/utils/test_sql_values.py,sha256=vzxRmy16FfLZPH-sAQexBvsF9MXB8n4smr14qoEOS5
348
350
  tests/utils/test_sync.py,sha256=9ytVo56y2vPQePvTeIi9lHIouEhWJbodl1TmzkGFrSo,799
349
351
  tests/utils/test_table_reflection.py,sha256=SIzuat-IpcVj1GCFyOWKShI8YkhdOPPFH7qVrvfyPNE,3794
350
352
  tests/utils/test_warnings.py,sha256=NvSC_cvJ6uZcwAGf1m-hLzETXCqprXELL8zg3TNLVMw,269
351
- piccolo-1.5.0.dist-info/LICENSE,sha256=zFIpi-16uIJ420UMIG75NU0JbDBykvrdnXcj5U_EYBI,1059
352
- piccolo-1.5.0.dist-info/METADATA,sha256=1gdEVjHiwVLu0D6JAY_7FMD8mHuSPyZMHxJVX0BmuqI,5149
353
- piccolo-1.5.0.dist-info/WHEEL,sha256=00yskusixUoUt5ob_CiUp6LsnN5lqzTJpoqOFg_FVIc,92
354
- piccolo-1.5.0.dist-info/entry_points.txt,sha256=SJPHET4Fi1bN5F3WqcKkv9SClK3_F1I7m4eQjk6AFh0,46
355
- piccolo-1.5.0.dist-info/top_level.txt,sha256=-SR74VGbk43VoPy1HH-mHm97yoGukLK87HE5kdBW6qM,24
356
- piccolo-1.5.0.dist-info/RECORD,,
353
+ piccolo-1.5.1.dist-info/LICENSE,sha256=zFIpi-16uIJ420UMIG75NU0JbDBykvrdnXcj5U_EYBI,1059
354
+ piccolo-1.5.1.dist-info/METADATA,sha256=yWYssQ8mhB4JiWPgB5P4td5YAvYoqZX2l11bfp97LLI,5177
355
+ piccolo-1.5.1.dist-info/WHEEL,sha256=00yskusixUoUt5ob_CiUp6LsnN5lqzTJpoqOFg_FVIc,92
356
+ piccolo-1.5.1.dist-info/entry_points.txt,sha256=SJPHET4Fi1bN5F3WqcKkv9SClK3_F1I7m4eQjk6AFh0,46
357
+ piccolo-1.5.1.dist-info/top_level.txt,sha256=-SR74VGbk43VoPy1HH-mHm97yoGukLK87HE5kdBW6qM,24
358
+ piccolo-1.5.1.dist-info/RECORD,,
@@ -213,7 +213,6 @@ class TestGetDimensions(TestCase):
213
213
 
214
214
 
215
215
  class TestGetInnerValueType(TestCase):
216
-
217
216
  def test_get_inner_value_type(self):
218
217
  """
219
218
  Make sure that `_get_inner_value_type` returns the correct base type.