supervisely 6.73.362__py3-none-any.whl → 6.73.363__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.
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  import asyncio
6
6
  import io
7
+ import json
7
8
  import os
8
9
  import pickle
9
10
  import random
@@ -4465,7 +4466,7 @@ def _download_project(
4465
4466
  try:
4466
4467
  if download_blob_files:
4467
4468
  project_info = api.project.get_info_by_id(project_id)
4468
- create_blob_readme(project_fs=project_fs, project_info=project_info)
4469
+ create_blob_readme(project_fs=project_fs, project_info=project_info, api=api)
4469
4470
  else:
4470
4471
  create_readme(dest_dir, project_id, api)
4471
4472
  except Exception as e:
@@ -5092,6 +5093,10 @@ def create_readme(
5092
5093
  "{{dataset_structure_info}}", _dataset_structure_md(project_info, api)
5093
5094
  )
5094
5095
 
5096
+ template = template.replace(
5097
+ "{{dataset_description_info}}", _dataset_descriptions_md(project_info, api)
5098
+ )
5099
+
5095
5100
  with open(readme_path, "w") as f:
5096
5101
  f.write(template)
5097
5102
  return readme_path
@@ -5256,6 +5261,7 @@ def _dataset_blob_structure_md(
5256
5261
  def create_blob_readme(
5257
5262
  project_fs: Project,
5258
5263
  project_info: ProjectInfo,
5264
+ api: Api,
5259
5265
  ) -> str:
5260
5266
  """Creates a README.md file using the template, adds general information
5261
5267
  about the project and creates a dataset structure section.
@@ -5294,7 +5300,9 @@ def create_blob_readme(
5294
5300
  template = template.replace(
5295
5301
  "{{dataset_structure_info}}", _dataset_blob_structure_md(project_fs, project_info)
5296
5302
  )
5297
-
5303
+ template = template.replace(
5304
+ "{{dataset_description_info}}", _dataset_descriptions_md(project_info, api)
5305
+ )
5298
5306
  with open(readme_path, "w") as f:
5299
5307
  f.write(template)
5300
5308
  return readme_path
@@ -5430,6 +5438,37 @@ def _dataset_structure_md(
5430
5438
 
5431
5439
  return "".join(result_md)
5432
5440
 
5441
+ def _dataset_descriptions_md(project_info: sly.ProjectInfo, api: sly.Api) -> str:
5442
+ """Creates a markdown string with dictionary of descriptions and custom data of datasets.
5443
+ :param project_info: Project information.
5444
+ :type project_info: :class:`ProjectInfo<supervisely.project.project_info.ProjectInfo>`
5445
+ :param api: Supervisely API address and token.
5446
+ :type api: :class:`Api<supervisely.api.api.Api>`
5447
+ :return: Markdown string with dictionary of descriptions and custom data of datasets.
5448
+ :rtype: str
5449
+ """
5450
+
5451
+ data_found = False
5452
+ result_md = "All datasets in the project can have their own descriptions and custom data. You can add or edit the description and custom data of a dataset in the datasets list page. In this section, you can find this information for each dataset by dataset name (e.g. `ds1/ds2/ds3`, where `ds1` and `ds2` are parent datasets for `ds3` dataset).<br>"
5453
+ result_md += "\n\n```json\n{\n"
5454
+ for parents, dataset_info in api.dataset.tree(project_info.id):
5455
+ dataset_info = api.dataset.get_info_by_id(dataset_info.id)
5456
+ full_ds_name = "/".join(parents + [dataset_info.name])
5457
+ if dataset_info.description or dataset_info.custom_data:
5458
+ data_found = True
5459
+ result_md += f" \"{full_ds_name}\": {{\n"
5460
+ if dataset_info.description:
5461
+ result_md += f" \"description\": \"{dataset_info.description}\",\n"
5462
+ if dataset_info.custom_data:
5463
+ formated_custom_data = json.dumps(dataset_info.custom_data, indent=4)
5464
+ formated_custom_data = formated_custom_data.replace("\n", "\n ")
5465
+ result_md += f" \"custom_data\": {formated_custom_data}\n"
5466
+ result_md += " },\n"
5467
+ result_md += "}\n```"
5468
+ if not data_found:
5469
+ result_md = "_No dataset descriptions or custom data found in the project._"
5470
+ return result_md
5471
+
5433
5472
 
5434
5473
  async def _download_project_async(
5435
5474
  api: sly.Api,
@@ -5697,7 +5736,7 @@ async def _download_project_async(
5697
5736
  try:
5698
5737
  if download_blob_files:
5699
5738
  project_info = api.project.get_info_by_id(project_id)
5700
- create_blob_readme(project_fs=project_fs, project_info=project_info)
5739
+ create_blob_readme(project_fs=project_fs, project_info=project_info, api=api)
5701
5740
  else:
5702
5741
  create_readme(dest_dir, project_id, api)
5703
5742
  except Exception as e:
@@ -10,6 +10,10 @@ This is a general information about the project.<br>
10
10
  In this section, you can find information about the dataset structure. Dataset names are clickable and will redirect you to the corresponding folder.<br><br>
11
11
  {{dataset_structure_info}}<br>
12
12
 
13
+ ## Additional information (descriptions and custom data for datasets)
14
+
15
+ {{dataset_description_info}}
16
+
13
17
  ## Useful links
14
18
 
15
19
  Please, visit the [Supervisely blog](https://supervisely.com/blog) to keep up with the latest news, updates, and tutorials and subscribe to [our YouTube channel](https://www.youtube.com/c/Supervisely) to watch video tutorials.<br>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.362
3
+ Version: 6.73.363
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -1035,11 +1035,11 @@ supervisely/project/data_version.py,sha256=P5Lui6i64pYeJWmAdGJDv8GRXxjfpSSZ8zT_M
1035
1035
  supervisely/project/download.py,sha256=nhxID-kbsNTgIY9l1lnRuUlzKrsJw80X07jEElyl3sE,28466
1036
1036
  supervisely/project/pointcloud_episode_project.py,sha256=yiWdNBQiI6f1O9sr1pg8JHW6O-w3XUB1rikJNn3Oung,41866
1037
1037
  supervisely/project/pointcloud_project.py,sha256=Kx1Vaes-krwG3BiRRtHRLQxb9G5m5bTHPN9IzRqmNWo,49399
1038
- supervisely/project/project.py,sha256=k0eE6Jy9eDYO-WUbDK0a-IVA34VVWYRzMBVkPY9XdGw,235812
1038
+ supervisely/project/project.py,sha256=RokArUC17P7HXssoYXSKVCBo6DJvclwD-ozW7ysMWww,238002
1039
1039
  supervisely/project/project_meta.py,sha256=26s8IiHC5Pg8B1AQi6_CrsWteioJP2in00cRNe8QlW0,51423
1040
1040
  supervisely/project/project_settings.py,sha256=NLThzU_DCynOK6hkHhVdFyezwprn9UqlnrLDe_3qhkY,9347
1041
1041
  supervisely/project/project_type.py,sha256=7mQ7zg6r7Bm2oFn5aR8n_PeLqMmOaPZd6ph7Z8ZISTw,608
1042
- supervisely/project/readme_template.md,sha256=NKYEoJubNWLV_HmhVmdB6L4dneLqDkvl2b71xy5fc54,9150
1042
+ supervisely/project/readme_template.md,sha256=VovSn591tcpz2xiwGgErm34iGHVxuGxXGPX6-iDiS88,9251
1043
1043
  supervisely/project/upload.py,sha256=AjgHYgVZwUE25ygC5pqvFjdAladbyB8T78mlet5Qpho,3750
1044
1044
  supervisely/project/video_project.py,sha256=zAtB3YpW9tC9Tc3qfapbQ9O2nhAWU2wDjMuS5sepXqc,65297
1045
1045
  supervisely/project/volume_project.py,sha256=Kn9VEvWuKKZvL2nx6B6bjSvHuoZhAOxEc6DvPRexUco,22666
@@ -1097,9 +1097,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1097
1097
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1098
1098
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1099
1099
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1100
- supervisely-6.73.362.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1101
- supervisely-6.73.362.dist-info/METADATA,sha256=pEJ1fz_ct_nNeRITHBz-wp16AYlUFbNvG9zwIKwbWTI,35151
1102
- supervisely-6.73.362.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1103
- supervisely-6.73.362.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1104
- supervisely-6.73.362.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1105
- supervisely-6.73.362.dist-info/RECORD,,
1100
+ supervisely-6.73.363.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1101
+ supervisely-6.73.363.dist-info/METADATA,sha256=6PAf_uEkpJWOi9CeWKDgUCmCGH7wEJeK7Gu41pIYqu8,35151
1102
+ supervisely-6.73.363.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1103
+ supervisely-6.73.363.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1104
+ supervisely-6.73.363.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1105
+ supervisely-6.73.363.dist-info/RECORD,,