pybiolib 1.1.2090__py3-none-any.whl → 1.1.2097__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.
biolib/cli/data_record.py CHANGED
@@ -1,11 +1,12 @@
1
+ import json
1
2
  import logging
2
3
  import os
4
+ from typing import Dict, List
3
5
 
4
6
  import click
5
7
 
6
8
  from biolib._data_record.data_record import DataRecord
7
9
  from biolib.biolib_logging import logger, logger_no_user_data
8
- from biolib.sdk import create_data_record
9
10
  from biolib.typing_utils import Optional
10
11
 
11
12
 
@@ -16,11 +17,18 @@ def data_record() -> None:
16
17
 
17
18
 
18
19
  @data_record.command(help='Create a Data Record')
19
- @click.option('--destination', type=str, required=True)
20
+ @click.argument('uri', required=True)
21
+ @click.option('--data-path', required=True, type=click.Path(exists=True))
22
+ def create(uri: str, data_path: str) -> None:
23
+ DataRecord.create(destination=uri, data_path=data_path)
24
+
25
+
26
+ @data_record.command(help='Update a Data Record')
27
+ @click.argument('uri', required=True)
20
28
  @click.option('--data-path', required=True, type=click.Path(exists=True))
21
- @click.option('--name', type=str, required=False)
22
- def create(destination: str, data_path: str, name: Optional[str] = None) -> None:
23
- create_data_record(destination=destination, data_path=data_path, name=name)
29
+ @click.option('--chunk-size', default=None, required=False, type=click.INT, help='The size of each chunk (In MB)')
30
+ def update(uri: str, data_path: str, chunk_size: Optional[int]) -> None:
31
+ DataRecord.get_by_uri(uri=uri).update(data_path=data_path, chunk_size_in_mb=chunk_size)
24
32
 
25
33
 
26
34
  @data_record.command(help='Download files from a Data Record')
@@ -42,3 +50,30 @@ def download(uri: str, file: Optional[str], path_filter: Optional[str]) -> None:
42
50
  else:
43
51
  assert not os.path.exists(record.name), f'Directory with name {record.name} already exists in current directory'
44
52
  record.save_files(output_dir=record.name, path_filter=path_filter)
53
+
54
+
55
+ @data_record.command(help='Describe a Data Record')
56
+ @click.argument('uri', required=True)
57
+ @click.option('--json', 'output_as_json', is_flag=True, default=False, required=False, help='Format output as JSON')
58
+ def describe(uri: str, output_as_json: bool) -> None:
59
+ record = DataRecord.get_by_uri(uri)
60
+ files_info: List[Dict] = []
61
+ total_size_in_bytes = 0
62
+ for file in record.list_files():
63
+ files_info.append({'path': file.path, 'size_bytes': file.length})
64
+ total_size_in_bytes += file.length
65
+
66
+ if output_as_json:
67
+ print(
68
+ json.dumps(
69
+ obj={'uri': record.uri, 'size_bytes': total_size_in_bytes, 'files': files_info},
70
+ indent=4,
71
+ )
72
+ )
73
+ else:
74
+ print(f'Data Record {record.uri}\ntotal {total_size_in_bytes} bytes\n')
75
+ print('size bytes path')
76
+ for file_info in files_info:
77
+ size_string = str(file_info['size_bytes'])
78
+ leading_space_string = ' ' * (10 - len(size_string))
79
+ print(f"{leading_space_string}{size_string} {file_info['path']}")
biolib/cli/lfs.py CHANGED
@@ -21,6 +21,7 @@ def lfs() -> None:
21
21
  @lfs.command(help='Create a Large File System')
22
22
  @click.argument('uri', required=True)
23
23
  def create(uri: str) -> None:
24
+ logger.warning('This is command deprecated, please use "biolib data-record create" instead.')
24
25
  logger.configure(default_log_level=logging.INFO)
25
26
  logger_no_user_data.configure(default_log_level=logging.INFO)
26
27
  DataRecord.create(destination=uri)
@@ -31,6 +32,7 @@ def create(uri: str) -> None:
31
32
  @click.option('--path', required=True, type=click.Path(exists=True))
32
33
  @click.option('--chunk-size', default=None, required=False, type=click.INT, help='The size of each chunk (In MB)')
33
34
  def push(uri: str, path: str, chunk_size: Optional[int]) -> None:
35
+ logger.warning('This is command deprecated, please use "biolib data-record update" instead.')
34
36
  logger.configure(default_log_level=logging.INFO)
35
37
  logger_no_user_data.configure(default_log_level=logging.INFO)
36
38
  try:
@@ -44,6 +46,7 @@ def push(uri: str, path: str, chunk_size: Optional[int]) -> None:
44
46
  @click.argument('uri', required=True)
45
47
  @click.option('--file-path', required=True, type=str)
46
48
  def download_file(uri: str, file_path: str) -> None:
49
+ logger.warning('This is command deprecated, please use "biolib data-record download" instead.')
47
50
  logger.configure(default_log_level=logging.INFO)
48
51
  logger_no_user_data.configure(default_log_level=logging.INFO)
49
52
  try:
@@ -66,6 +69,7 @@ def download_file(uri: str, file_path: str) -> None:
66
69
  @click.argument('uri', required=True)
67
70
  @click.option('--json', 'output_as_json', is_flag=True, default=False, required=False, help='Format output as JSON')
68
71
  def describe(uri: str, output_as_json: bool) -> None:
72
+ logger.warning('This is command deprecated, please use "biolib data-record describe" instead.')
69
73
  data_record = DataRecord.get_by_uri(uri)
70
74
  files_info: List[Dict] = []
71
75
  total_size_in_bytes = 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybiolib
3
- Version: 1.1.2090
3
+ Version: 1.1.2097
4
4
  Summary: BioLib Python Client
5
5
  Home-page: https://github.com/biolib
6
6
  License: MIT
@@ -51,10 +51,10 @@ biolib/biolib_errors.py,sha256=5m4lK2l39DafpoXBImEBD4EPH3ayXBX0JgtPzmGClow,689
51
51
  biolib/biolib_logging.py,sha256=J3E5H_LL5k6ZUim2C8gqN7E6lCBZMTpO4tnMpOPwG9U,2854
52
52
  biolib/cli/__init__.py,sha256=0v3c_J-U0k46c5ZWeQjLG_kTaKDJm81LBxQpDO2B_aI,1286
53
53
  biolib/cli/auth.py,sha256=rpWGmXs6Fz6CGrO9K8ibPRszOdXG78Vig_boKaVCD9A,2082
54
- biolib/cli/data_record.py,sha256=ZlP1o7lKqL-ebmL2d-_L8Pmdd2DmS2Imk_a1C8AGLc4,1809
54
+ biolib/cli/data_record.py,sha256=oDy8U6mv-h-hbeMihXRzVEvM-WrGQq6oBiBl3xDRaXs,3220
55
55
  biolib/cli/download_container.py,sha256=HIZVHOPmslGE5M2Dsp9r2cCkAEJx__vcsDz5Wt5LRos,483
56
56
  biolib/cli/init.py,sha256=wQOfii_au-d30Hp7DdH-WVw-WVraKvA_zY4za1w7DE8,821
57
- biolib/cli/lfs.py,sha256=j9hERvjh1QLhn_KbomLkPWIOPa1MYOajUpoo9r6EmVc,3755
57
+ biolib/cli/lfs.py,sha256=z2qHUwink85mv9yDgifbVKkVwuyknGhMDTfly_gLKJM,4151
58
58
  biolib/cli/push.py,sha256=TFi7O9tJ3zFe0VmtVTV3Vh9_xIMHnrc41xxcaBKU46g,813
59
59
  biolib/cli/run.py,sha256=BbvXLQ-XibjQ71Y2d4URMH_8dflNVwM0i3TIWhw_u_c,1634
60
60
  biolib/cli/runtime.py,sha256=Xv-nrma5xX8NidWcvbUKcUvuN5TCarZa4A8mPVmF-z0,361
@@ -111,8 +111,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
111
111
  biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
112
112
  biolib/utils/seq_util.py,sha256=jC5WhH63FTD7SLFJbxQGA2hOt9NTwq9zHl_BEec1Z0c,4907
113
113
  biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
114
- pybiolib-1.1.2090.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
115
- pybiolib-1.1.2090.dist-info/METADATA,sha256=QIpIwVybuDIwjbpt5P49oDK52g9MBQJvKGlm5J0lVV8,1508
116
- pybiolib-1.1.2090.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
117
- pybiolib-1.1.2090.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
118
- pybiolib-1.1.2090.dist-info/RECORD,,
114
+ pybiolib-1.1.2097.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
115
+ pybiolib-1.1.2097.dist-info/METADATA,sha256=-4wEBR8SXfG_VDlLRZR7UgrlKee5VydzL-L6wMKP17Y,1508
116
+ pybiolib-1.1.2097.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
117
+ pybiolib-1.1.2097.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
118
+ pybiolib-1.1.2097.dist-info/RECORD,,