pybiolib 1.2.814__py3-none-any.whl → 1.2.838__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.
@@ -5,7 +5,7 @@ import sys
5
5
  from biolib._internal import llm_instructions
6
6
 
7
7
 
8
- def add_copilot_prompts(force: bool, silent: bool = False) -> None:
8
+ def add_copilot_prompts(force: bool, style: bool = True, silent: bool = False) -> None:
9
9
  current_working_directory = os.getcwd()
10
10
  config_file_path = f'{current_working_directory}/.biolib/config.yml'
11
11
  if not os.path.exists(config_file_path):
@@ -19,12 +19,14 @@ Error: Current directory has not been initialized as a BioLib application.
19
19
 
20
20
  conflicting_files = []
21
21
 
22
- for root, _, files in os.walk(source_path):
22
+ for root, _, filenames in os.walk(source_path):
23
23
  relative_dir = os.path.relpath(root, source_path)
24
24
  destination_dir = os.path.join(destination_path, relative_dir)
25
- for file in files:
26
- source_file = os.path.join(root, file)
27
- destination_file = os.path.join(destination_dir, file)
25
+ for filename in filenames:
26
+ if 'style' in filename and not style:
27
+ continue
28
+ source_file = os.path.join(root, filename)
29
+ destination_file = os.path.join(destination_dir, filename)
28
30
  if os.path.exists(destination_file) and not force:
29
31
  with open(source_file, 'rb') as fsrc, open(destination_file, 'rb') as fdest:
30
32
  if fsrc.read() != fdest.read():
@@ -0,0 +1 @@
1
+ from . import templates
@@ -0,0 +1,18 @@
1
+ biolib_version: 2
2
+
3
+ modules:
4
+ main:
5
+ image: 'local-docker://BIOLIB_REPLACE_DOCKER_TAG:latest'
6
+ command: "bash run.sh"
7
+ working_directory: /home/biolib/
8
+ input_files:
9
+ - COPY / /home/biolib/
10
+ output_files:
11
+ - COPY /home/biolib/output/ /
12
+
13
+ arguments:
14
+ -
15
+ key: --input
16
+ description: 'Input protein sequences'
17
+ type: sequence
18
+ required: true
@@ -0,0 +1,13 @@
1
+ name: BioLib Build & Push
2
+ on: push
3
+ jobs:
4
+ build-and-push:
5
+ runs-on: biolib-github-runner
6
+ steps:
7
+ - uses: actions/checkout@v4
8
+ - name: Build
9
+ run: docker build -t BIOLIB_REPLACE_DOCKER_TAG:latest .
10
+ - name: Push
11
+ run: biolib push $([ "$GITHUB_REF_NAME" != "main" ] && echo -n "--dev") BIOLIB_REPLACE_APP_URI
12
+ env:
13
+ BIOLIB_TOKEN: ${{ secrets.BIOLIB_TOKEN }}
@@ -0,0 +1,11 @@
1
+ FROM python:3.13.3-slim
2
+ WORKDIR /home/biolib/
3
+
4
+ COPY run.sh .
5
+
6
+ COPY requirements.txt .
7
+ RUN pip install --no-cache-dir -r requirements.txt
8
+
9
+ COPY src .
10
+
11
+ RUN mkdir output
@@ -0,0 +1 @@
1
+ pybiolib==BIOLIB_REPLACE_PYBIOLIB_VERSION
@@ -0,0 +1,2 @@
1
+ #!/bin/bash
2
+ python3 src/run.py "$@"
@@ -0,0 +1,21 @@
1
+ import argparse
2
+
3
+ from biolib.sdk import Runtime
4
+
5
+
6
+ def parse_args():
7
+ parser = argparse.ArgumentParser(description='Process some biological sequences.')
8
+ parser.add_argument('--input', type=str, required=True, help='Input protein sequences')
9
+ return parser.parse_args()
10
+
11
+
12
+ def main(args):
13
+ sequence = args.input
14
+ # Add your processing logic here
15
+ print(f'Received sequence: {sequence}')
16
+
17
+
18
+ if __name__ == '__main__':
19
+ args = parse_args()
20
+ Runtime.set_result_name_prefix_from_fasta(args.input)
21
+ main(args)
@@ -0,0 +1,5 @@
1
+ import os
2
+
3
+
4
+ def init_template():
5
+ return os.path.join(os.path.dirname(__file__), 'init_template')
biolib/cli/init.py CHANGED
@@ -1,34 +1,88 @@
1
1
  import os
2
+ import shutil
2
3
  import sys
3
4
 
4
5
  import click
5
6
 
6
- from biolib import templates
7
+ from biolib import utils # Import like this to let BASE_URL_IS_PUBLIC_BIOLIB be set correctly
7
8
  from biolib._internal.add_copilot_prompts import add_copilot_prompts
9
+ from biolib._internal.templates import templates
10
+ from biolib.utils import BIOLIB_PACKAGE_VERSION
8
11
 
9
12
 
10
- @click.command(help='Initialize a project with a .biolib/config.yml file', hidden=True)
13
+ @click.command(help='Initialize a BioLib project', hidden=True)
11
14
  def init() -> None:
12
15
  cwd = os.getcwd()
13
- config_file_path = f'{cwd}/.biolib/config.yml'
14
- readme_path = f'{cwd}/README.md'
15
16
 
16
- if os.path.exists(config_file_path):
17
- print(f'The file "{config_file_path}" already exists', file=sys.stderr)
18
- exit(1)
17
+ app_uri = input('What URI do you want to create the application under? (leave blank to skip): ')
18
+ app_name = app_uri.split('/')[-1] if app_uri else None
19
+ if not app_uri:
20
+ print(
21
+ 'Remember to set the app URI in the .biolib/config.yml file later, '
22
+ 'and docker image name in the .biolib/config.yml and .github/workflows/biolib.yml files.'
23
+ )
24
+ copilot_input = input('Do you want to include Copilot style prompts? [y/N]: ')
25
+ include_copilot_style = copilot_input.lower() == 'y'
26
+
27
+ template_dir = templates.init_template()
28
+ conflicting_files = []
19
29
 
20
30
  try:
21
- project_name = input('Enter a name for your project: ')
31
+ # First pass: check for conflicts
32
+ for root, _, filenames in os.walk(template_dir):
33
+ relative_dir = os.path.relpath(root, template_dir)
34
+ destination_dir = cwd if relative_dir == '.' else os.path.join(cwd, relative_dir)
35
+ for filename in filenames:
36
+ source_file = os.path.join(root, filename)
37
+ destination_file = os.path.join(destination_dir, filename)
38
+ if os.path.exists(destination_file):
39
+ with open(source_file, 'rb') as fsrc, open(destination_file, 'rb') as fdest:
40
+ if fsrc.read() != fdest.read():
41
+ conflicting_files.append(os.path.relpath(destination_file, cwd))
42
+ if conflicting_files:
43
+ print('The following files were not overwritten. Use --force to override them:', file=sys.stderr)
44
+ for conflicting_file in conflicting_files:
45
+ print(f' {conflicting_file}', file=sys.stderr)
46
+ exit(1)
47
+
48
+ replace_app_uri = app_uri if app_uri else 'PUT_APP_URI_HERE'
49
+
50
+ # Second pass: copy files (only if no conflicts)
51
+ for root, _, filenames in os.walk(template_dir):
52
+ relative_dir = os.path.relpath(root, template_dir)
53
+ destination_dir = os.path.join(cwd, relative_dir)
54
+ os.makedirs(destination_dir, exist_ok=True)
55
+
56
+ for filename in filenames:
57
+ if utils.BASE_URL_IS_PUBLIC_BIOLIB and filename == 'biolib.yml':
58
+ continue
59
+
60
+ source_file = os.path.join(root, filename)
61
+ destination_file = os.path.join(destination_dir, filename)
62
+
63
+ if not os.path.exists(destination_file):
64
+ try:
65
+ with open(source_file) as f:
66
+ content = f.read()
67
+
68
+ new_content = content.replace('BIOLIB_REPLACE_PYBIOLIB_VERSION', BIOLIB_PACKAGE_VERSION)
69
+ new_content = new_content.replace('BIOLIB_REPLACE_APP_URI', replace_app_uri)
70
+ new_content = new_content.replace(
71
+ 'BIOLIB_REPLACE_DOCKER_TAG',
72
+ app_name if app_name else 'PUT_DOCKER_TAG_HERE',
73
+ )
22
74
 
23
- os.makedirs(f'{cwd}/.biolib', exist_ok=True)
24
- with open(config_file_path, 'w') as config_file:
25
- config_file.write(templates.example_app.CONFIG_YML)
75
+ with open(destination_file, 'w') as f:
76
+ f.write(new_content)
77
+ except UnicodeDecodeError:
78
+ shutil.copy2(source_file, destination_file)
26
79
 
27
- if not os.path.exists(readme_path):
80
+ readme_path = os.path.join(cwd, 'README.md')
81
+ if not os.path.exists(readme_path) and app_name:
28
82
  with open(readme_path, 'w') as readme_file:
29
- readme_file.write(f'# {project_name}\n')
83
+ readme_file.write(f'# {app_name}\n')
30
84
 
31
- add_copilot_prompts(force=False, silent=True)
85
+ add_copilot_prompts(force=False, style=include_copilot_style, silent=True)
32
86
 
33
87
  except KeyboardInterrupt:
34
88
  print('\nInit command cancelled.', file=sys.stderr)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pybiolib
3
- Version: 1.2.814
3
+ Version: 1.2.838
4
4
  Summary: BioLib Python Client
5
5
  License: MIT
6
6
  Keywords: biolib
@@ -1,7 +1,7 @@
1
1
  biolib/__init__.py,sha256=RL-YmqW1WUKk2FGuEt-8kzzlK1QZKcEtzBUsifWUNQM,10626
2
2
  biolib/_data_record/data_record.py,sha256=zKvnh5T-dIVY46-kgVzMBoZ666ZhcTCFQnWvZT0D6RM,12026
3
3
  biolib/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- biolib/_internal/add_copilot_prompts.py,sha256=jhyAMhQZZTvRFxARCdGxlZwtLDczRxjZEDl9-xzWZ34,1852
4
+ biolib/_internal/add_copilot_prompts.py,sha256=6gbqYsrTTUFTEEV62fp-UTDwZeJIjDfvywWgtW6AowQ,1967
5
5
  biolib/_internal/data_record/__init__.py,sha256=fGdME6JGRU_2VxpJbYpGXYndjN-feUkmKY4fuMyq3cg,76
6
6
  biolib/_internal/data_record/data_record.py,sha256=SD3-tKQY2RZv9ZSVNUhd2ISDYV64Fk1Sc642qyf_Vis,4618
7
7
  biolib/_internal/data_record/push_data.py,sha256=-L3a_7zZzDCXabBu3O4lWPMAMeBbeRPTrBlEM-_5SCI,2693
@@ -23,6 +23,14 @@ biolib/_internal/llm_instructions/.github/prompts/biolib_run_apps.prompt.md,sha2
23
23
  biolib/_internal/llm_instructions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  biolib/_internal/push_application.py,sha256=I7yHGcwK6udc2hVmOQIc1BcQBipAMibEjURMI6HgdXk,12502
25
25
  biolib/_internal/runtime.py,sha256=BiHl4klUHr36MCpqKaUso4idHeBZfPAahLYRQrabFqA,486
26
+ biolib/_internal/templates/__init__.py,sha256=NVbhLUMC8HITzkLvP88Qu7FHaL-SvQord-DX3gh1Ykk,24
27
+ biolib/_internal/templates/init_template/.biolib/config.yml,sha256=y4ndTgbFvUE1UiGcIOqogT2Wm8jahGffeyU5rlCEltQ,427
28
+ biolib/_internal/templates/init_template/.github/workflows/biolib.yml,sha256=uJ1y06yVkL7H5SpW9XAX0Py4jQef6fgImQ-sZpTGHkc,447
29
+ biolib/_internal/templates/init_template/Dockerfile,sha256=4X9Dpj72mfHcfbEXsr7KURKpHZ0z3vatIvvExOYR7SQ,167
30
+ biolib/_internal/templates/init_template/requirements.txt,sha256=2GnBHsKg4tX5F06Z4YeLuId6jQO3-HGTITsaVBTDG0Y,42
31
+ biolib/_internal/templates/init_template/run.sh,sha256=WvAn7Mr8EopkkBMngGbmqcoJmALSJkocoJ2SByvGBjk,36
32
+ biolib/_internal/templates/init_template/src/run.py,sha256=GS2qGGmFGIthdxdSxZbGktwZc8x3Q2IVLubpp7hEROw,529
33
+ biolib/_internal/templates/templates.py,sha256=-o0VdRMwPhnzL4VlCe3BZYl1aI9HLKtOmNjs6gu9fIQ,101
26
34
  biolib/_internal/tree_utils.py,sha256=_Q_6_NDtIiROcefymqxEVddjqti6Mt3OZ4U0GcDW61s,3904
27
35
  biolib/_internal/types/__init__.py,sha256=WvtlSHh77QhYVTLeRpoPAzqvByLzbEPf_ZqYGHFlQug,247
28
36
  biolib/_internal/types/app.py,sha256=Mz2QGD_jESX-K9JYnLWPo4YA__Q_1FQQTk9pvidCohU,118
@@ -74,7 +82,7 @@ biolib/cli/__init__.py,sha256=IHC2bEyA27pvgp-18SGfFVJOP456elanz7suDP8D084,1316
74
82
  biolib/cli/auth.py,sha256=rpWGmXs6Fz6CGrO9K8ibPRszOdXG78Vig_boKaVCD9A,2082
75
83
  biolib/cli/data_record.py,sha256=t8DfJK2EZ_SNZ9drDA_N5Jqy8DNwf9f5SlFrIaOvtv0,3501
76
84
  biolib/cli/download_container.py,sha256=HIZVHOPmslGE5M2Dsp9r2cCkAEJx__vcsDz5Wt5LRos,483
77
- biolib/cli/init.py,sha256=PZLzQYbT7u78J1qSCcs-frVfWHohkrZHxLGRSmMdRg4,1061
85
+ biolib/cli/init.py,sha256=VDarbLkkfhyEjlNc8UbjaF3y6J59DOn6ZUjY2MVmNJk,3945
78
86
  biolib/cli/lfs.py,sha256=z2qHUwink85mv9yDgifbVKkVwuyknGhMDTfly_gLKJM,4151
79
87
  biolib/cli/push.py,sha256=pSFEUQkQ69M__eR1nIT9ejW4V4_MtX3lb8ydEc1uKiM,1484
80
88
  biolib/cli/run.py,sha256=MCo0ZqW2pHBxOoCI3i5gAx5D0auW9fmxHqkAF4TRhms,2134
@@ -122,8 +130,6 @@ biolib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
122
130
  biolib/runtime/__init__.py,sha256=MlRepA11n2H-3plB5rzWyyHK2JmP6PiaP3i6x3vt0mg,506
123
131
  biolib/sdk/__init__.py,sha256=Z1S5BgpvM87S2o1libtqkYN1CfYUhn_d4ChEJjwdFKM,2356
124
132
  biolib/tables.py,sha256=MmruV-nJLc3HbLVJBAiDuDCgS2-4oaUkpoCLLUNYbxQ,1173
125
- biolib/templates/__init__.py,sha256=Yx62sSyDCDesRQDQgmbDsLpfgEh93fWE8r9u4g2azXk,36
126
- biolib/templates/example_app.py,sha256=EB3E3RT4SeO_ii5nVQqJpi5KDGNE_huF1ub-e5ZFveE,715
127
133
  biolib/typing_utils.py,sha256=ntzrlyTkUaO2OtccLYzCAGztGdca0WT5fikJUmSkT-Y,148
128
134
  biolib/user/__init__.py,sha256=Db5wtxLfFz3ID9TULSSTo77csw9tO6RtxMRvV5cqKEE,39
129
135
  biolib/user/sign_in.py,sha256=e_JnykVxemq8eUBD5GmthjDV504CT1Dmn0EshrDCGB8,2085
@@ -133,8 +139,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
133
139
  biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
134
140
  biolib/utils/seq_util.py,sha256=Ozk0blGtPur_D9MwShD02r_mphyQmgZkx-lOHOwnlIM,6730
135
141
  biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
136
- pybiolib-1.2.814.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
137
- pybiolib-1.2.814.dist-info/METADATA,sha256=dkiANMd2NxMszfRSRvCAlAxPS-3Eas0SQAdzGs_8yOc,1570
138
- pybiolib-1.2.814.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
139
- pybiolib-1.2.814.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
140
- pybiolib-1.2.814.dist-info/RECORD,,
142
+ pybiolib-1.2.838.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
143
+ pybiolib-1.2.838.dist-info/METADATA,sha256=_KI6b_KNTAPIdypWZLFOcEeCvK5wk7BfF-SzMq79AZI,1570
144
+ pybiolib-1.2.838.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
145
+ pybiolib-1.2.838.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
146
+ pybiolib-1.2.838.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- import biolib.templates.example_app
@@ -1,30 +0,0 @@
1
- CONFIG_YML = '''\
2
- biolib_version: 2
3
-
4
- modules:
5
- main:
6
- image: 'dockerhub://python:3.9-slim'
7
- command: |
8
- python3 -c "
9
- import argparse
10
- parser = argparse.ArgumentParser()
11
- parser.add_argument('--name')
12
- args = parser.parse_args()
13
- print(f'Hello there, {args.name}!')
14
- "
15
- working_directory: /home/biolib/
16
- input_files:
17
- - COPY / /home/biolib/
18
- output_files:
19
- - COPY /home/biolib/ /
20
-
21
- arguments:
22
- -
23
- default_value: Charles Darwin
24
- description: What is your name?
25
- key: '--name'
26
- key_value_separator: ' '
27
- required: true
28
- type: text
29
-
30
- '''