supervisely 6.73.412__py3-none-any.whl → 6.73.413__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.
@@ -703,6 +703,8 @@ class ApiField:
703
703
  """"""
704
704
  ERROR_MESSAGE = "errorMessage"
705
705
  """"""
706
+ UNIQUE_ITEMS = "uniqueItems"
707
+ """"""
706
708
 
707
709
 
708
710
  def _get_single_item(items):
@@ -2455,6 +2455,7 @@ class ProjectApi(CloneableModuleApi, UpdateableModule, RemoveableModuleApi):
2455
2455
  request_body = {
2456
2456
  ApiField.PROJECT_ID: project_id,
2457
2457
  ApiField.LIMIT: limit,
2458
+ ApiField.UNIQUE_ITEMS: limit, # the same as limit, but for diverse search
2458
2459
  }
2459
2460
 
2460
2461
  if dataset_id is not None:
@@ -61,6 +61,7 @@ SUPERVISELY_SERVER_PATH_PREFIX = sly_env.supervisely_server_path_prefix()
61
61
  if SUPERVISELY_SERVER_PATH_PREFIX and not SUPERVISELY_SERVER_PATH_PREFIX.startswith("/"):
62
62
  SUPERVISELY_SERVER_PATH_PREFIX = f"/{SUPERVISELY_SERVER_PATH_PREFIX}"
63
63
 
64
+ HEALTH_ENDPOINTS = ["/health", "/is_ready"]
64
65
 
65
66
  class ReadyzFilter(logging.Filter):
66
67
  def filter(self, record):
@@ -905,7 +906,33 @@ class Application(metaclass=Singleton):
905
906
  Callable
906
907
  ] = None, # function to check if the app is ready for requests (e.g serving app: model is served and ready)
907
908
  show_header: bool = True,
909
+ hide_health_check_logs: bool = True, # whether to hide health check logs in info level
910
+ health_check_endpoints: Optional[List[str]] = None, # endpoints to check health of the app
908
911
  ):
912
+ """Initialize the Supervisely Application.
913
+
914
+ :param layout: Main layout of the application.
915
+ :type layout: Widget
916
+ :param templates_dir: Directory with Jinja2 templates. It is preferred to use `layout` instead of `templates_dir`.
917
+ :type templates_dir: str, optional
918
+ :param static_dir: Directory with static files (e.g. CSS, JS), used for serving static content.
919
+ :type static_dir: str, optional
920
+ :param hot_reload: Whether to enable hot reload during development (default is False).
921
+ :type hot_reload: bool, optional
922
+ :param session_info_extra_content: Additional content to be displayed in the session info area.
923
+ :type session_info_extra_content: Widget, optional
924
+ :param session_info_solid: Whether to use solid background for the session info area.
925
+ :type session_info_solid: bool, optional
926
+ :param ready_check_function: Function to check if the app is ready for requests.
927
+ :type ready_check_function: Callable, optional
928
+ :param show_header: Whether to show the header in the application.
929
+ :type show_header: bool, optional
930
+ :param hide_health_check_logs: Whether to hide health check logs in info level.
931
+ :type hide_health_check_logs: bool, optional
932
+ :param health_check_endpoints: List of additional endpoints to check health of the app.
933
+ Add your custom endpoints here to be able to manage logging of health check requests on info level with `hide_health_check_logs`.
934
+ :type health_check_endpoints: List[str], optional
935
+ """
909
936
  self._favicon = os.environ.get("icon", "https://cdn.supervisely.com/favicon.ico")
910
937
  JinjaWidgets().context["__favicon__"] = self._favicon
911
938
  JinjaWidgets().context["__no_html_mode__"] = True
@@ -980,6 +1007,17 @@ class Application(metaclass=Singleton):
980
1007
  hot_reload=hot_reload,
981
1008
  before_shutdown_callbacks=self._before_shutdown_callbacks,
982
1009
  )
1010
+
1011
+ # add filter to hide health check logs for info level
1012
+ if health_check_endpoints is None or len(health_check_endpoints) == 0:
1013
+ self._health_check_endpoints = HEALTH_ENDPOINTS
1014
+ else:
1015
+ health_check_endpoints = [endpoint.strip() for endpoint in health_check_endpoints]
1016
+ self._health_check_endpoints = HEALTH_ENDPOINTS + health_check_endpoints
1017
+
1018
+ if hide_health_check_logs:
1019
+ self._setup_health_check_filter()
1020
+
983
1021
  self.test_client = TestClient(self._fastapi)
984
1022
 
985
1023
  if not headless:
@@ -1126,6 +1164,34 @@ class Application(metaclass=Singleton):
1126
1164
  def set_ready_check_function(self, func: Callable):
1127
1165
  self._ready_check_function = func
1128
1166
 
1167
+ def _setup_health_check_filter(self):
1168
+ """Setup filter to hide health check logs for info level."""
1169
+
1170
+ class HealthCheckFilter(logging.Filter):
1171
+ def __init__(self, app_instance):
1172
+ super().__init__()
1173
+ self.app: Application = app_instance
1174
+
1175
+ def filter(self, record):
1176
+ # Hide health check requests if NOT in debug mode
1177
+ if not self.app._fastapi.debug and hasattr(record, "getMessage"):
1178
+ message = record.getMessage()
1179
+ # Check if the message contains health check paths
1180
+ if any(path in message for path in self.app._health_check_endpoints):
1181
+ return False
1182
+ return True
1183
+
1184
+ # Apply filter to uvicorn access logger
1185
+ health_filter = HealthCheckFilter(self)
1186
+ uvicorn_logger = logging.getLogger("uvicorn.access")
1187
+
1188
+ # Remove old filters of this type, if any (for safety)
1189
+ uvicorn_logger.filters = [
1190
+ f for f in uvicorn_logger.filters if not isinstance(f, HealthCheckFilter)
1191
+ ]
1192
+
1193
+ uvicorn_logger.addFilter(health_filter)
1194
+
1129
1195
 
1130
1196
  def set_autostart_flag_from_state(default: Optional[str] = None):
1131
1197
  """Set `autostart` flag recieved from task state. Env name: `modal.state.autostart`.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.412
3
+ Version: 6.73.413
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -36,10 +36,10 @@ supervisely/api/import_storage_api.py,sha256=BDCgmR0Hv6OoiRHLCVPKt3iDxSVlQp1WrnK
36
36
  supervisely/api/issues_api.py,sha256=BqDJXmNoTzwc3xe6_-mA7FDFC5QQ-ahGbXk_HmpkSeQ,17925
37
37
  supervisely/api/labeling_job_api.py,sha256=G2_BV_WtA2lAhfw_nAQmWmv1P-pwimD0ba9GVKoGjiA,55537
38
38
  supervisely/api/labeling_queue_api.py,sha256=ilNjAL1d9NSa9yabQn6E-W26YdtooT3ZGXIFZtGnAvY,30158
39
- supervisely/api/module_api.py,sha256=vqojLHCC-uCNVnqB2FUMCJdXAElg5FON3BZTr8AkiiE,46340
39
+ supervisely/api/module_api.py,sha256=-PVLcsicG47hVj_4vN8cuc0X-gqadsBJTj0ZxQOcO9g,46384
40
40
  supervisely/api/object_class_api.py,sha256=7-npNFMYjWNtSXYZg6syc6bX56_oCzDU2kFRPGQWCwA,10399
41
41
  supervisely/api/plugin_api.py,sha256=SFm0IlTTOjuHBLUMgG4d4k6U3cWJocE-SVb-f08fwMQ,5286
42
- supervisely/api/project_api.py,sha256=ZTmPEqWUQgYv5s5nEvnb2qobaiYxHFxibYZrtsJ-QAs,96362
42
+ supervisely/api/project_api.py,sha256=5WR4bNIq3eUlAkJga8DP_rYFIXKIU-myDlKNv911ssA,96449
43
43
  supervisely/api/project_class_api.py,sha256=5cyjdGPPb2tpttu5WmYoOxUNiDxqiojschkhZumF0KM,1426
44
44
  supervisely/api/remote_storage_api.py,sha256=1O4rTIwW8s9gxC00yvFuKbEMGNsa7YSRlZ8j494ARwY,17793
45
45
  supervisely/api/report_api.py,sha256=Om7CGulUbQ4BuJ16eDtz7luLe0JQNqab-LoLpUXu7YE,7123
@@ -99,7 +99,7 @@ supervisely/app/fastapi/index.html,sha256=dz_e-0RE5ZbOU0ToUaEHe1ROI6Tc3SPL-mHt1C
99
99
  supervisely/app/fastapi/no_html_main.html,sha256=NhQP7noyORBx72lFh1CQKgBRupkWjiq6Gaw-9Hkvg7c,37
100
100
  supervisely/app/fastapi/offline.py,sha256=CwMMkJ1frD6wiZS-SEoNDtQ1UJcJe1Ob6ohE3r4CQL8,7414
101
101
  supervisely/app/fastapi/request.py,sha256=NU7rKmxJ1pfkDZ7_yHckRcRAueJRQIqCor11UO2OHr8,766
102
- supervisely/app/fastapi/subapp.py,sha256=B4lU0B1nlhijiyMpwdsX_xrf7oITRL3_sv4XADo0kEc,45782
102
+ supervisely/app/fastapi/subapp.py,sha256=JHJOlh6JJ43xA0WEFiH-AQlNf-XLqZmQ0qh0t24Y07w,49260
103
103
  supervisely/app/fastapi/templating.py,sha256=pcghBW2OWVrNtplZuYa-mx04ektLiSvnBg-mhmyCoJc,2929
104
104
  supervisely/app/fastapi/utils.py,sha256=t_UquzlFrdkKtAJmH6eJ279pE8Aa3BaIu4XjX-SEaIE,946
105
105
  supervisely/app/fastapi/websocket.py,sha256=TlRSPOAhRItTv1HGvdukK1ZvhRjMUxRa-lJlsRR9rJw,1308
@@ -1115,9 +1115,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1115
1115
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1116
1116
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1117
1117
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1118
- supervisely-6.73.412.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1119
- supervisely-6.73.412.dist-info/METADATA,sha256=48ufWdiEor7nRHpV9wZcI8Rcn-RmPmGfMcHgv7aMciA,35254
1120
- supervisely-6.73.412.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1121
- supervisely-6.73.412.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1122
- supervisely-6.73.412.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1123
- supervisely-6.73.412.dist-info/RECORD,,
1118
+ supervisely-6.73.413.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1119
+ supervisely-6.73.413.dist-info/METADATA,sha256=9qduIf9cJam5Kfz-s5QNls-wk1xPPVs0N28TOrDRluc,35254
1120
+ supervisely-6.73.413.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1121
+ supervisely-6.73.413.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1122
+ supervisely-6.73.413.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1123
+ supervisely-6.73.413.dist-info/RECORD,,