singlestoredb 1.7.0__tar.gz → 1.7.1__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.

Potentially problematic release.


This version of singlestoredb might be problematic. Click here for more details.

Files changed (139) hide show
  1. {singlestoredb-1.7.0/singlestoredb.egg-info → singlestoredb-1.7.1}/PKG-INFO +1 -1
  2. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/setup.cfg +1 -1
  3. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/__init__.py +1 -1
  4. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/apps/_cloud_functions.py +26 -4
  5. singlestoredb-1.7.1/singlestoredb/apps/_config.py +63 -0
  6. singlestoredb-1.7.1/singlestoredb/apps/_connection_info.py +10 -0
  7. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/apps/_dashboards.py +14 -10
  8. singlestoredb-1.7.1/singlestoredb/apps/_stdout_supress.py +30 -0
  9. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test_connection.py +4 -0
  10. {singlestoredb-1.7.0 → singlestoredb-1.7.1/singlestoredb.egg-info}/PKG-INFO +1 -1
  11. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb.egg-info/SOURCES.txt +2 -0
  12. singlestoredb-1.7.0/singlestoredb/apps/_config.py +0 -33
  13. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/LICENSE +0 -0
  14. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/README.md +0 -0
  15. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/accel.c +0 -0
  16. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/setup.py +0 -0
  17. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/ai/__init__.py +0 -0
  18. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/ai/embeddings.py +0 -0
  19. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/alchemy/__init__.py +0 -0
  20. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/apps/__init__.py +0 -0
  21. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/apps/_process.py +0 -0
  22. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/apps/_uvicorn_util.py +0 -0
  23. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/auth.py +0 -0
  24. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/config.py +0 -0
  25. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/connection.py +0 -0
  26. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/converters.py +0 -0
  27. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/exceptions.py +0 -0
  28. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/functions/__init__.py +0 -0
  29. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/functions/decorator.py +0 -0
  30. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/functions/dtypes.py +0 -0
  31. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/functions/ext/__init__.py +0 -0
  32. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/functions/ext/arrow.py +0 -0
  33. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/functions/ext/asgi.py +0 -0
  34. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/functions/ext/json.py +0 -0
  35. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/functions/ext/mmap.py +0 -0
  36. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/functions/ext/rowdat_1.py +0 -0
  37. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/functions/ext/utils.py +0 -0
  38. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/functions/signature.py +0 -0
  39. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/fusion/__init__.py +0 -0
  40. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/fusion/graphql.py +0 -0
  41. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/fusion/handler.py +0 -0
  42. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/fusion/handlers/__init__.py +0 -0
  43. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/fusion/handlers/job.py +0 -0
  44. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/fusion/handlers/stage.py +0 -0
  45. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/fusion/handlers/utils.py +0 -0
  46. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/fusion/handlers/workspace.py +0 -0
  47. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/fusion/registry.py +0 -0
  48. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/fusion/result.py +0 -0
  49. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/http/__init__.py +0 -0
  50. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/http/connection.py +0 -0
  51. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/management/__init__.py +0 -0
  52. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/management/billing_usage.py +0 -0
  53. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/management/cluster.py +0 -0
  54. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/management/job.py +0 -0
  55. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/management/manager.py +0 -0
  56. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/management/organization.py +0 -0
  57. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/management/region.py +0 -0
  58. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/management/utils.py +0 -0
  59. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/management/workspace.py +0 -0
  60. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/__init__.py +0 -0
  61. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/_auth.py +0 -0
  62. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/charset.py +0 -0
  63. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/connection.py +0 -0
  64. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/constants/CLIENT.py +0 -0
  65. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/constants/COMMAND.py +0 -0
  66. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/constants/CR.py +0 -0
  67. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/constants/ER.py +0 -0
  68. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/constants/EXTENDED_TYPE.py +0 -0
  69. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/constants/FIELD_TYPE.py +0 -0
  70. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/constants/FLAG.py +0 -0
  71. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/constants/SERVER_STATUS.py +0 -0
  72. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/constants/VECTOR_TYPE.py +0 -0
  73. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/constants/__init__.py +0 -0
  74. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/converters.py +0 -0
  75. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/cursors.py +0 -0
  76. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/err.py +0 -0
  77. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/optionfile.py +0 -0
  78. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/protocol.py +0 -0
  79. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/__init__.py +0 -0
  80. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/base.py +0 -0
  81. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/conftest.py +0 -0
  82. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/test_DictCursor.py +0 -0
  83. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/test_SSCursor.py +0 -0
  84. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/test_basic.py +0 -0
  85. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/test_connection.py +0 -0
  86. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/test_converters.py +0 -0
  87. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/test_cursor.py +0 -0
  88. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/test_err.py +0 -0
  89. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/test_issues.py +0 -0
  90. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/test_load_local.py +0 -0
  91. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/test_nextset.py +0 -0
  92. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/test_optionfile.py +0 -0
  93. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/thirdparty/__init__.py +0 -0
  94. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/__init__.py +0 -0
  95. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/capabilities.py +0 -0
  96. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/dbapi20.py +0 -0
  97. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_capabilities.py +0 -0
  98. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_dbapi20.py +0 -0
  99. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/tests/thirdparty/test_MySQLdb/test_MySQLdb_nonstandard.py +0 -0
  100. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/mysql/times.py +0 -0
  101. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/notebook/__init__.py +0 -0
  102. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/notebook/_objects.py +0 -0
  103. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/notebook/_portal.py +0 -0
  104. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/pytest.py +0 -0
  105. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/__init__.py +0 -0
  106. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/empty.sql +0 -0
  107. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/ext_funcs/__init__.py +0 -0
  108. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/local_infile.csv +0 -0
  109. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test.sql +0 -0
  110. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test2.sql +0 -0
  111. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test_basics.py +0 -0
  112. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test_config.py +0 -0
  113. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test_dbapi.py +0 -0
  114. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test_exceptions.py +0 -0
  115. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test_ext_func.py +0 -0
  116. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test_ext_func_data.py +0 -0
  117. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test_fusion.py +0 -0
  118. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test_http.py +0 -0
  119. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test_management.py +0 -0
  120. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test_plugin.py +0 -0
  121. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test_results.py +0 -0
  122. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test_types.py +0 -0
  123. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test_udf.py +0 -0
  124. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/test_xdict.py +0 -0
  125. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/tests/utils.py +0 -0
  126. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/types.py +0 -0
  127. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/utils/__init__.py +0 -0
  128. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/utils/config.py +0 -0
  129. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/utils/convert_rows.py +0 -0
  130. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/utils/debug.py +0 -0
  131. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/utils/dtypes.py +0 -0
  132. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/utils/events.py +0 -0
  133. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/utils/mogrify.py +0 -0
  134. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/utils/results.py +0 -0
  135. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb/utils/xdict.py +0 -0
  136. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb.egg-info/dependency_links.txt +0 -0
  137. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb.egg-info/entry_points.txt +0 -0
  138. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb.egg-info/requires.txt +0 -0
  139. {singlestoredb-1.7.0 → singlestoredb-1.7.1}/singlestoredb.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: singlestoredb
3
- Version: 1.7.0
3
+ Version: 1.7.1
4
4
  Summary: Interface to the SingleStoreDB database and workspace management APIs
5
5
  Home-page: https://github.com/singlestore-labs/singlestoredb-python
6
6
  Author: SingleStore
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = singlestoredb
3
- version = 1.7.0
3
+ version = 1.7.1
4
4
  description = Interface to the SingleStoreDB database and workspace management APIs
5
5
  long_description = file: README.md
6
6
  long_description_content_type = text/markdown
@@ -13,7 +13,7 @@ Examples
13
13
 
14
14
  """
15
15
 
16
- __version__ = '1.7.0'
16
+ __version__ = '1.7.1'
17
17
 
18
18
  from typing import Any
19
19
 
@@ -1,8 +1,10 @@
1
1
  import asyncio
2
+ import textwrap
2
3
  import typing
3
4
  import urllib.parse
4
5
 
5
6
  from ._config import AppConfig
7
+ from ._connection_info import ConnectionInfo
6
8
  from ._process import kill_process_by_port
7
9
 
8
10
  if typing.TYPE_CHECKING:
@@ -17,8 +19,7 @@ async def run_function_app(
17
19
  app: 'FastAPI',
18
20
  log_level: str = 'error',
19
21
  kill_existing_app_server: bool = True,
20
- ) -> None:
21
-
22
+ ) -> ConnectionInfo:
22
23
  global _running_server
23
24
  from ._uvicorn_util import AwaitableUvicornServer
24
25
 
@@ -52,7 +53,7 @@ async def run_function_app(
52
53
  def ping() -> str:
53
54
  return 'Success!'
54
55
 
55
- base_path = urllib.parse.urlparse(app_config.url).path
56
+ base_path = urllib.parse.urlparse(app_config.base_url).path
56
57
  app.root_path = base_path
57
58
 
58
59
  config = uvicorn.Config(
@@ -66,5 +67,26 @@ async def run_function_app(
66
67
  asyncio.create_task(_running_server.serve())
67
68
  await _running_server.wait_for_startup()
68
69
 
70
+ connection_info = ConnectionInfo(app_config.base_url, app_config.token)
71
+
69
72
  if app_config.running_interactively:
70
- print(f'Cloud function available at {app_config.url}')
73
+ if app_config.is_gateway_enabled:
74
+ print(
75
+ 'Cloud function available at '
76
+ f'{app_config.base_url}docs?authToken={app_config.token}',
77
+ )
78
+ else:
79
+ curl_header = f'-H "Authorization: Bearer {app_config.token}"'
80
+ curl_example = f'curl "{app_config.base_url}" {curl_header}'
81
+ print(
82
+ textwrap.dedent(f"""
83
+ Cloud function available at {app_config.base_url}
84
+
85
+ Auth Token: {app_config.token}
86
+
87
+ Curl example: {curl_example}
88
+
89
+ """).strip(),
90
+ )
91
+
92
+ return connection_info
@@ -0,0 +1,63 @@
1
+ import os
2
+ from dataclasses import dataclass
3
+ from typing import Optional
4
+
5
+
6
+ @dataclass
7
+ class AppConfig:
8
+ listen_port: int
9
+ base_url: str
10
+ app_token: Optional[str]
11
+ user_token: Optional[str]
12
+ running_interactively: bool
13
+ is_gateway_enabled: bool
14
+
15
+ @staticmethod
16
+ def _read_variable(name: str) -> str:
17
+ value = os.environ.get(name)
18
+ if value is None:
19
+ raise RuntimeError(
20
+ f'Missing {name} environment variable. '
21
+ 'Is the code running outside SingleStoreDB notebook environment?',
22
+ )
23
+ return value
24
+
25
+ @classmethod
26
+ def from_env(cls) -> 'AppConfig':
27
+ port = cls._read_variable('SINGLESTOREDB_APP_LISTEN_PORT')
28
+ base_url = cls._read_variable('SINGLESTOREDB_APP_BASE_URL')
29
+
30
+ workload_type = os.environ.get('SINGLESTOREDB_WORKLOAD_TYPE')
31
+ running_interactively = workload_type == 'InteractiveNotebook'
32
+
33
+ is_gateway_enabled = 'SINGLESTOREDB_NOVA_GATEWAY_ENDPOINT' in os.environ
34
+
35
+ app_token = os.environ.get('SINGLESTOREDB_APP_TOKEN')
36
+ user_token = os.environ.get('SINGLESTOREDB_USER_TOKEN')
37
+
38
+ # Make sure the required variables are present
39
+ # and present useful error message if not
40
+ if running_interactively:
41
+ if is_gateway_enabled:
42
+ app_token = cls._read_variable('SINGLESTOREDB_APP_TOKEN')
43
+ else:
44
+ user_token = cls._read_variable('SINGLESTOREDB_USER_TOKEN')
45
+
46
+ return cls(
47
+ listen_port=int(port),
48
+ base_url=base_url,
49
+ app_token=app_token,
50
+ user_token=user_token,
51
+ running_interactively=running_interactively,
52
+ is_gateway_enabled=is_gateway_enabled,
53
+ )
54
+
55
+ @property
56
+ def token(self) -> Optional[str]:
57
+ """
58
+ Returns None if running non-interactively
59
+ """
60
+ if self.is_gateway_enabled:
61
+ return self.app_token
62
+ else:
63
+ return self.user_token
@@ -0,0 +1,10 @@
1
+ from dataclasses import dataclass
2
+ from typing import Optional
3
+
4
+
5
+ @dataclass
6
+ class ConnectionInfo:
7
+ url: str
8
+
9
+ # Only present in interactive mode
10
+ token: Optional[str]
@@ -3,16 +3,18 @@ import urllib.parse
3
3
 
4
4
  from ._config import AppConfig
5
5
  from ._process import kill_process_by_port
6
+ from ._stdout_supress import StdoutSuppressor
7
+ from singlestoredb.apps._connection_info import ConnectionInfo
6
8
 
7
9
  if typing.TYPE_CHECKING:
8
10
  from plotly.graph_objs import Figure
9
11
 
10
12
 
11
- def run_dashboard_app(
13
+ async def run_dashboard_app(
12
14
  figure: 'Figure',
13
15
  debug: bool = False,
14
16
  kill_existing_app_server: bool = True,
15
- ) -> None:
17
+ ) -> ConnectionInfo:
16
18
  try:
17
19
  import dash
18
20
  except ImportError:
@@ -31,7 +33,7 @@ def run_dashboard_app(
31
33
  if kill_existing_app_server:
32
34
  kill_process_by_port(app_config.listen_port)
33
35
 
34
- base_path = urllib.parse.urlparse(app_config.url).path
36
+ base_path = urllib.parse.urlparse(app_config.base_url).path
35
37
 
36
38
  app = dash.Dash(requests_pathname_prefix=base_path)
37
39
  app.layout = dash.html.Div(
@@ -40,12 +42,14 @@ def run_dashboard_app(
40
42
  ],
41
43
  )
42
44
 
43
- app.run(
44
- host='0.0.0.0',
45
- debug=debug,
46
- port=str(app_config.listen_port),
47
- jupyter_mode='external',
48
- )
45
+ with StdoutSuppressor():
46
+ app.run(
47
+ host='0.0.0.0',
48
+ debug=debug,
49
+ port=str(app_config.listen_port),
50
+ jupyter_mode='external',
51
+ )
49
52
 
50
53
  if app_config.running_interactively:
51
- print(f'Dash app available at {app_config.url}')
54
+ print(f'Dash app available at {app_config.base_url}?authToken={app_config.token}')
55
+ return ConnectionInfo(app_config.base_url, app_config.token)
@@ -0,0 +1,30 @@
1
+ import io
2
+ import sys
3
+ from typing import Optional
4
+
5
+
6
+ class StdoutSuppressor:
7
+ """
8
+ Supresses the stdout for code executed within the context.
9
+ This should not be used for asynchronous or threaded executions.
10
+
11
+ ```py
12
+ with Supressor():
13
+ print("This won't be printed")
14
+ ```
15
+
16
+ """
17
+
18
+ def __enter__(self) -> None:
19
+ self.stdout = sys.stdout
20
+ self.buffer = io.StringIO()
21
+ sys.stdout = self.buffer
22
+
23
+ def __exit__(
24
+ self,
25
+ exc_type: Optional[object],
26
+ exc_value: Optional[Exception],
27
+ exc_traceback: Optional[str],
28
+ ) -> None:
29
+ del self.buffer
30
+ sys.stdout = self.stdout
@@ -1432,6 +1432,8 @@ class TestConnection(unittest.TestCase):
1432
1432
  conn.close()
1433
1433
 
1434
1434
  def test_alltypes_polars(self):
1435
+ self.skipTest('Polars API needs to be fixed')
1436
+
1435
1437
  if self.conn.driver in ['http', 'https']:
1436
1438
  self.skipTest('Data API does not surface unsigned int information')
1437
1439
 
@@ -1574,6 +1576,8 @@ class TestConnection(unittest.TestCase):
1574
1576
  conn.close()
1575
1577
 
1576
1578
  def test_alltypes_no_nulls_polars(self):
1579
+ self.skipTest('Polars API needs to be fixed')
1580
+
1577
1581
  if self.conn.driver in ['http', 'https']:
1578
1582
  self.skipTest('Data API does not surface unsigned int information')
1579
1583
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: singlestoredb
3
- Version: 1.7.0
3
+ Version: 1.7.1
4
4
  Summary: Interface to the SingleStoreDB database and workspace management APIs
5
5
  Home-page: https://github.com/singlestore-labs/singlestoredb-python
6
6
  Author: SingleStore
@@ -23,8 +23,10 @@ singlestoredb/alchemy/__init__.py
23
23
  singlestoredb/apps/__init__.py
24
24
  singlestoredb/apps/_cloud_functions.py
25
25
  singlestoredb/apps/_config.py
26
+ singlestoredb/apps/_connection_info.py
26
27
  singlestoredb/apps/_dashboards.py
27
28
  singlestoredb/apps/_process.py
29
+ singlestoredb/apps/_stdout_supress.py
28
30
  singlestoredb/apps/_uvicorn_util.py
29
31
  singlestoredb/functions/__init__.py
30
32
  singlestoredb/functions/decorator.py
@@ -1,33 +0,0 @@
1
- import os
2
- from dataclasses import dataclass
3
-
4
-
5
- @dataclass
6
- class AppConfig:
7
- listen_port: int
8
- url: str
9
- running_interactively: bool
10
-
11
- @classmethod
12
- def from_env(cls) -> 'AppConfig':
13
- port = os.environ.get('SINGLESTOREDB_APP_LISTEN_PORT')
14
- if port is None:
15
- raise RuntimeError(
16
- 'Missing SINGLESTOREDB_APP_LISTEN_PORT environment variable. '
17
- 'Is the code running outside SingleStoreDB notebook environment?',
18
- )
19
- url = os.environ.get('SINGLESTOREDB_APP_URL')
20
- if url is None:
21
- raise RuntimeError(
22
- 'Missing SINGLESTOREDB_APP_URL environment variable. '
23
- 'Is the code running outside SingleStoreDB notebook environment?',
24
- )
25
-
26
- workload_type = os.environ.get('SINGLESTOREDB_WORKLOAD_TYPE')
27
- running_interactively = workload_type == 'InteractiveNotebook'
28
-
29
- return cls(
30
- listen_port=int(port),
31
- url=url,
32
- running_interactively=running_interactively,
33
- )
File without changes
File without changes
File without changes
File without changes