acUIty-core 0.2.0__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.
@@ -0,0 +1,54 @@
1
+ from __future__ import annotations
2
+
3
+ import re
4
+ import uuid
5
+ from datetime import datetime
6
+
7
+ from sqlalchemy import DateTime, func
8
+ from sqlalchemy.orm import DeclarativeBase, Mapped, declared_attr, mapped_column
9
+
10
+
11
+ def _to_snake_case(name: str) -> str:
12
+ s = re.sub(r"([A-Z]+)([A-Z][a-z])", r"\1_\2", name)
13
+ s = re.sub(r"([a-z\d])([A-Z])", r"\1_\2", s)
14
+ return s.lower()
15
+
16
+
17
+ class LakebaseModel(DeclarativeBase):
18
+ """Base class for Lakebase ORM models.
19
+
20
+ Subclasses automatically get:
21
+ - A ``__tablename__`` derived from the class name (snake_case).
22
+ - An ``id`` UUID primary key.
23
+ - ``created_at`` / ``updated_at`` timestamp columns.
24
+
25
+ Example::
26
+
27
+ class User(LakebaseModel):
28
+ name: Mapped[str] = mapped_column(String(100))
29
+ email: Mapped[str] = mapped_column(String(255), unique=True)
30
+ """
31
+
32
+ __abstract__ = True
33
+
34
+ @declared_attr.directive
35
+ def __tablename__(cls) -> str:
36
+ return _to_snake_case(cls.__name__)
37
+
38
+ id: Mapped[uuid.UUID] = mapped_column(
39
+ primary_key=True,
40
+ default=uuid.uuid4,
41
+ )
42
+ created_at: Mapped[datetime] = mapped_column(
43
+ DateTime(timezone=True),
44
+ server_default=func.now(),
45
+ )
46
+ updated_at: Mapped[datetime] = mapped_column(
47
+ DateTime(timezone=True),
48
+ server_default=func.now(),
49
+ onupdate=func.now(),
50
+ )
51
+
52
+ def to_dict(self) -> dict:
53
+ """Return column values as a dictionary."""
54
+ return {c.key: getattr(self, c.key) for c in self.__table__.columns}
@@ -0,0 +1 @@
1
+ from acuity.runtime.stream._stream_handler import channel, registry, Channel
@@ -0,0 +1,40 @@
1
+ import asyncio
2
+ from typing import Dict, Set
3
+
4
+
5
+ class Channel:
6
+ def __init__(self, name: str):
7
+ self.name = name
8
+ self._queues: Set[asyncio.Queue] = set()
9
+
10
+ def _subscribe(self) -> asyncio.Queue:
11
+ q: asyncio.Queue = asyncio.Queue()
12
+ self._queues.add(q)
13
+ return q
14
+
15
+ def _unsubscribe(self, q: asyncio.Queue):
16
+ self._queues.discard(q)
17
+
18
+ async def push(self, data: dict):
19
+ for q in list(self._queues):
20
+ await q.put(data)
21
+
22
+
23
+ class ChannelRegistry:
24
+ def __init__(self):
25
+ self._channels: Dict[str, Channel] = {}
26
+
27
+ def get_or_create(self, name: str) -> Channel:
28
+ if name not in self._channels:
29
+ self._channels[name] = Channel(name)
30
+ return self._channels[name]
31
+
32
+ def get(self, name: str) -> Channel | None:
33
+ return self._channels.get(name)
34
+
35
+
36
+ registry = ChannelRegistry()
37
+
38
+
39
+ def channel(name: str) -> Channel:
40
+ return registry.get_or_create(name)
@@ -0,0 +1,10 @@
1
+ <html>
2
+ <head>
3
+ <title>{{ title }}</title>
4
+ <link href="{{ url_for('static', path='/app.css') }}" rel="stylesheet">
5
+ </head>
6
+ <body>
7
+ <div id="app"></div>
8
+ <script src="{{ url_for('static', path='/app.iife.js') }}"></script>
9
+ </body>
10
+ </html>
@@ -0,0 +1,15 @@
1
+ import logging
2
+ import os
3
+ import subprocess
4
+
5
+ logger = logging.getLogger(__name__)
6
+
7
+ def pre_install():
8
+ web_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'web')
9
+ subprocess.run(['npm', 'install'], cwd=web_dir, check=True)
10
+ subprocess.run(['npm', 'run', 'build'], cwd=web_dir, check=True)
11
+
12
+
13
+ if __name__ == "__main__":
14
+ logger.info("Building web static files...")
15
+ pre_install()
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.4
2
+ Name: acUIty-core
3
+ Version: 0.2.0
4
+ Summary: an opionated framework running data driven web apps
5
+ Author: Gaetano Ruggiero
6
+ Author-email: gaetano.ruggiero1@gmail.com
7
+ Requires-Python: >=3.9
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Programming Language :: Python :: 3.15
16
+ Requires-Dist: Jinja2 (==3.1.6)
17
+ Requires-Dist: click (>=8.1.3)
18
+ Requires-Dist: databricks-ai-bridge (==0.21.0)
19
+ Requires-Dist: databricks-ai-search (==0.76)
20
+ Requires-Dist: databricks-connect (==16.1.7)
21
+ Requires-Dist: databricks-mcp (==0.9.0)
22
+ Requires-Dist: databricks-openai (==0.17.0)
23
+ Requires-Dist: databricks-sdk (==0.94.0)
24
+ Requires-Dist: fastapi (==0.124.4)
25
+ Requires-Dist: numpy (==1.26.4)
26
+ Requires-Dist: openai (==2.38.0)
27
+ Requires-Dist: openai-agents (==0.18.1)
28
+ Requires-Dist: opentelemetry-api (==1.43.0)
29
+ Requires-Dist: opentelemetry-proto (==1.43.0)
30
+ Requires-Dist: opentelemetry-sdk (==1.43.0)
31
+ Requires-Dist: opentelemetry-semantic-conventions (==0.64b0)
32
+ Requires-Dist: pendulum (>=3.1.0,<4.0.0)
33
+ Requires-Dist: pydantic (==2.12.3)
34
+ Requires-Dist: pydantic_core (==2.41.4)
35
+ Requires-Dist: unitycatalog-openai (==0.2.0)
36
+ Requires-Dist: uvicorn (==0.38.0)
37
+ Description-Content-Type: text/markdown
38
+
39
+ # acuity
40
+
41
+ UI generator framework
@@ -0,0 +1,39 @@
1
+ acuity/__init__.py,sha256=-qgoaH-fL8Kmp0FXMLbchvVsyFi4ckrv1idNHG7IAS8,2129
2
+ acuity/__main__.py,sha256=0eA6wHq74544KjNaovJiJR16cdC8pW2hMx9QGlfokII,346
3
+ acuity/app/__init__.py,sha256=mLaQ-1y64ZU5uagcZohawZbmmanN4DXO_6Q_fFMTo54,73
4
+ acuity/app/datalets/__init__.py,sha256=LHCN96GFDeeoNKNMn_6ZUkcIljVQ8V3T5DAINj7LLes,162
5
+ acuity/app/datalets/_chat_container.py,sha256=psNENRAmF2fKqsl_e4Y2ZRcpWyKbK-pdftcINAg8MFY,37
6
+ acuity/app/datalets/_empty.py,sha256=GACHvLI5c31f-123yhyXLaqScDckegEtfl-IwxTzjiQ,72
7
+ acuity/commands.py,sha256=X5NpfbmJbb0AG4ee99dH3vHuwEjk1UmmjaLwlB8tW1Y,1182
8
+ acuity/datalets/_Mock.py,sha256=0BYFdSZ0tniSKpiivkk0BO3Tj-wyCMGEpbprMPin9_Y,345
9
+ acuity/datalets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ acuity/datalets/cards/_CardGrid.py,sha256=0_PqWq5z3OiFrhlH9HXg8y6ipxV5HpUmy5U0gz_dMtM,602
11
+ acuity/datalets/cards/__init__.py,sha256=lWPs2PuhPm986tJ6irbSQdp2eg6gFFn7NrOy5oi8wFU,132
12
+ acuity/datalets/cards/_model.py,sha256=QFL1B0ucR0UbBuFBwr7hZGIuHet4IFXCVQQ-6DCdovk,535
13
+ acuity/datalets/form/_Form.py,sha256=WM4HzFfDHhKt_gsRy-0KjN_TD-dYJ96o2m7QRJPMVFg,5994
14
+ acuity/datalets/form/__init__.py,sha256=cAMDE01Vmc01mwaLfS6lGDzcRm5RjmbZgd2SBpNWPU0,399
15
+ acuity/datalets/form/_markers.py,sha256=ipYpDOQFaKLJ1UQfbY4HQ02fBBB_hxIaJwWXtkeTKrA,1966
16
+ acuity/datalets/form/_model.py,sha256=2-xnnu730YBq6mHOJww511mHk0lmnDSHUoX-UFWkLq0,120
17
+ acuity/model/__init__.py,sha256=7CMuZzLr5MV3Zgy9NZkvRijZ5toevo9xN00TjPIe0iU,189
18
+ acuity/model/_agen_resp_chunk.py,sha256=hYWZX4P9DFgv9eNaC5a5Rjwx74ReunBjN398ScMUKQ8,108
19
+ acuity/model/_app.py,sha256=einSYyawNJ92kFOdcWrjXOR9LvxRNtND595ZD-hRQdg,3634
20
+ acuity/model/_datalet.py,sha256=e9Jp0qpjW94jxosIM3xBKbQqBVHh3wOwWgDTM4apve0,2636
21
+ acuity/model/_lucide.py,sha256=wvlrC6aiXUxker7l5XYu2g7H8FHfz7YJOlOfrswhEAY,30212
22
+ acuity/model/_page.py,sha256=JMPLBtCdA3ZkNSCFSaBYOmQPo-1RLybjjJi2iF0bcaE,2273
23
+ acuity/model/_panel.py,sha256=wK_FXpnmNr5HU3uhaa1zP6COwXXMfR1ftMxGGpiE7xM,843
24
+ acuity/runtime/__init__.py,sha256=_Bn6PY7AKD3BrQXmk9IgO65TZoh7gZ1ZBQJP402swD4,411
25
+ acuity/runtime/_ai_router.py,sha256=i-sCJOV5lNVVg7XtFG4GYZ3SCyRd0M2-1wzIX-bIFTY,3088
26
+ acuity/runtime/_datalet_router.py,sha256=MyJSdMbjAvrYwv7LlN7xiUtS-FMiXaBiLDyseZGpXD4,4054
27
+ acuity/runtime/_engine.py,sha256=TRb6zDMQE4O9dCYBhFsLmxWkPSGuLGqM9sxuomqTA_0,5425
28
+ acuity/runtime/_stream_router.py,sha256=jvq1nHswLRFiFYOO0L6KLrGtpLKUYRhHvL3IsCGCBIk,2126
29
+ acuity/runtime/storage/__init__.py,sha256=oeoERQxWz7meGelVGMg-LYFhjcxuDTFnSMZliNGn_3I,161
30
+ acuity/runtime/storage/_client.py,sha256=j-nmemWUwL6tSSkQQCWKyLAyL01H6SW9YSqrUGJxl84,4768
31
+ acuity/runtime/storage/_model.py,sha256=-PMCXfYk5AWdP5MS5EGLCK0PlYKjlKV3IXpVbKzAI5c,1518
32
+ acuity/runtime/stream/__init__.py,sha256=UAWr0VLwxLNrWPniAbNpHnV8Ux5HPy43-rW3nFbNo3M,77
33
+ acuity/runtime/stream/_stream_handler.py,sha256=buui3dhC_QsQm3XbXBbsEip_glhHIZ06B1yD1XRfTTs,957
34
+ acuity/runtime/templates/index.html,sha256=vBDwwiAS_OYtdQVX5zAKR5J6T_I1j8p6fPXo2wBIEvQ,249
35
+ acuity/scripts/build_web_static.py,sha256=UE9dy-Z3vdPpC90pAwSdThRoBLKUizZrDunjlAOVUA4,407
36
+ acuity_core-0.2.0.dist-info/METADATA,sha256=uMA0HM75BGKJFqgSqzEfrDnOW7SKrq0qYCkRxd5nhgI,1539
37
+ acuity_core-0.2.0.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
38
+ acuity_core-0.2.0.dist-info/entry_points.txt,sha256=KBgGsjo7kp89V1-vRbXQATH917Dvjy7XNoVlLKfcfig,46
39
+ acuity_core-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.5.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ acUIty=acuity.__main__:cli
3
+