narada 0.1.25__py3-none-any.whl → 0.1.27__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.
narada/__init__.py CHANGED
@@ -12,7 +12,7 @@ from narada_core.models import Agent, File, Response, ResponseContent
12
12
 
13
13
  from narada.client import Narada
14
14
  from narada.config import BrowserConfig
15
- from narada.render_html import render_html
15
+ from narada.utils import download_file, render_html
16
16
  from narada.window import LocalBrowserWindow, RemoteBrowserWindow
17
17
 
18
18
  # Get version from package metadata
@@ -26,6 +26,7 @@ __all__ = [
26
26
  "__version__",
27
27
  "Agent",
28
28
  "BrowserConfig",
29
+ "download_file",
29
30
  "File",
30
31
  "LocalBrowserWindow",
31
32
  "Narada",
narada/utils.py CHANGED
@@ -1,5 +1,46 @@
1
+ import webbrowser
2
+ from pathlib import Path
3
+ from tempfile import NamedTemporaryFile
1
4
  from typing import Never
2
5
 
3
6
 
4
7
  def assert_never() -> Never:
5
8
  raise AssertionError("Expected code to be unreachable")
9
+
10
+
11
+ def download_file(filename: str, content: str | bytes) -> None:
12
+ """
13
+ Downloads a file to the user's Downloads directory.
14
+
15
+ Args:
16
+ filename: The name of the file to save. Can include subdirectories
17
+ (e.g., "reports/2025/data.csv") relative to the Downloads
18
+ directory.
19
+ content: The content to write. If str, writes in text mode (UTF-8).
20
+ If bytes, writes in binary mode.
21
+ """
22
+ path = Path.home() / "Downloads" / filename
23
+ path.parent.mkdir(parents=True, exist_ok=True)
24
+ if isinstance(content, str):
25
+ path.write_text(content, encoding="utf-8")
26
+ else:
27
+ path.write_bytes(content)
28
+
29
+
30
+ def render_html(html: str) -> None:
31
+ """
32
+ Renders HTML content by opening it in the default browser.
33
+
34
+ Args:
35
+ html: The HTML content to render.
36
+ """
37
+ with NamedTemporaryFile(
38
+ mode="w+t",
39
+ encoding="utf-8",
40
+ suffix=".html",
41
+ delete=False,
42
+ ) as temp:
43
+ temp.write(html)
44
+ path = temp.name
45
+
46
+ webbrowser.open_new_tab(f"file://{path}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: narada
3
- Version: 0.1.25
3
+ Version: 0.1.27
4
4
  Summary: Python client SDK for Narada
5
5
  Project-URL: Homepage, https://github.com/NaradaAI/narada-python-sdk/narada
6
6
  Project-URL: Repository, https://github.com/NaradaAI/narada-python-sdk
@@ -0,0 +1,9 @@
1
+ narada/__init__.py,sha256=TFEfS_6cCaD2mLUDBTUOUar3wJqjz1wyyd7sx43MYUk,1127
2
+ narada/client.py,sha256=jksBBWdSJP88fP1DpLYoyJNNdgkUMrEKlcuYenARzaI,15265
3
+ narada/config.py,sha256=tvj16P_qAHOFB2O_VlrcizA8SrbmS_Nmkm2r7ltG-VM,1345
4
+ narada/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ narada/utils.py,sha256=gdLwNMXPpRohDcIIe0cB3KhvZ8X1QfAlKVh1sXWeJmk,1284
6
+ narada/window.py,sha256=OGuEs778xjxHivzWlJIIHKZPqGd4Sn9_YVArt_8TYoU,17762
7
+ narada-0.1.27.dist-info/METADATA,sha256=_qPEc-3NJIO04Jt9sGUSLeoFTG-ZeoQxJ-5iKhwaPP4,5117
8
+ narada-0.1.27.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ narada-0.1.27.dist-info/RECORD,,
narada/render_html.py DELETED
@@ -1,12 +0,0 @@
1
- import webbrowser
2
-
3
-
4
- def render_html(html: str) -> None:
5
- """
6
- Renders HTML content by opening it in the default browser.
7
-
8
- Args:
9
- html: The HTML content to render.
10
- """
11
- data_url = f"data:text/html;charset=utf-8,{html}"
12
- webbrowser.open_new_tab(data_url)
@@ -1,10 +0,0 @@
1
- narada/__init__.py,sha256=kGBirP2C3ENrBHpSQ2wEKZe0kTFCRBJSnImiSqVYeRk,1097
2
- narada/client.py,sha256=jksBBWdSJP88fP1DpLYoyJNNdgkUMrEKlcuYenARzaI,15265
3
- narada/config.py,sha256=tvj16P_qAHOFB2O_VlrcizA8SrbmS_Nmkm2r7ltG-VM,1345
4
- narada/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- narada/render_html.py,sha256=-r1ez6rMD6F9CVLk3JYafyL5YpBV-OkZ8wOvxufXd7I,280
6
- narada/utils.py,sha256=6NxADP1BxWLYLv40tAFlaGVxoyA_7k3dPUA-sFBQIZw,116
7
- narada/window.py,sha256=OGuEs778xjxHivzWlJIIHKZPqGd4Sn9_YVArt_8TYoU,17762
8
- narada-0.1.25.dist-info/METADATA,sha256=YBT-DoiRiPM3Wu6EcykJxXUMR-M8KKNeK1SaWJnqWd4,5117
9
- narada-0.1.25.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
- narada-0.1.25.dist-info/RECORD,,