pybiolib 1.2.1318__py3-none-any.whl → 1.2.1352__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.

Potentially problematic release.


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

@@ -1,16 +1,52 @@
1
+ import { useState, useEffect } from "react";
2
+ import biolib from "./biolib-sdk";
3
+
1
4
  export default function App() {
5
+ const [outputFileData, setOutputFileData] = useState<Uint8Array | null>(null);
6
+ const [loading, setLoading] = useState(true);
7
+
8
+ const loadOutputData = async () => {
9
+ setLoading(true);
10
+ try {
11
+ const data = await biolib.getOutputFileData("output.json");
12
+ setOutputFileData(data);
13
+ } catch (error) {
14
+ console.error("Error loading output data:", error);
15
+ setOutputFileData(null);
16
+ } finally {
17
+ setLoading(false);
18
+ }
19
+ };
20
+
21
+ useEffect(() => {
22
+ loadOutputData();
23
+ }, []);
24
+
2
25
  return (
3
26
  <div className="min-h-screen bg-gray-100 flex items-center justify-center">
4
- <div className="text-center">
27
+ <div className="text-center max-w-2xl mx-auto p-8">
5
28
  <h1 className="text-4xl font-bold mb-4">
6
29
  Hello, BioLib!
7
30
  </h1>
8
31
  <p className="text-lg mb-2">
9
32
  You have successfully set up your BioLib GUI application.
10
33
  </p>
11
- <p className="italic">
34
+ <p className="italic mb-6">
12
35
  This is a simple React template with Tailwind CSS styling.
13
36
  </p>
37
+
38
+ <div className="mt-8 p-4 bg-white rounded-lg shadow">
39
+ <h2 className="text-xl font-semibold mb-4">Example: Reading Output Files</h2>
40
+ {loading ? (
41
+ <p className="text-gray-500">Loading output.json...</p>
42
+ ) : outputFileData ? (
43
+ <div className="p-3 bg-gray-50 rounded text-left">
44
+ <pre className="text-sm">{new TextDecoder().decode(outputFileData)}</pre>
45
+ </div>
46
+ ) : (
47
+ <p className="text-red-500">Failed to load output.json</p>
48
+ )}
49
+ </div>
14
50
  </div>
15
51
  </div>
16
52
  );
@@ -0,0 +1,34 @@
1
+ interface IBioLibGlobals {
2
+ getOutputFileData: (path: string) => Promise<Uint8Array>;
3
+ }
4
+
5
+ declare global {
6
+ const biolib: IBioLibGlobals;
7
+ }
8
+
9
+ /* DEV_DATA_INJECTION */
10
+
11
+ const devSdkBioLib: IBioLibGlobals = {
12
+ getOutputFileData: async (path: string): Promise<Uint8Array> => {
13
+ console.log(`[SDK] getOutputFileData called with path: ${path}`);
14
+
15
+ if (typeof DEV_DATA_FILES !== 'undefined' && path in DEV_DATA_FILES) {
16
+ const base64Data = DEV_DATA_FILES[path];
17
+ const binaryString = atob(base64Data);
18
+ const bytes = new Uint8Array(binaryString.length);
19
+ for (let i = 0; i < binaryString.length; i++) {
20
+ bytes[i] = binaryString.charCodeAt(i);
21
+ }
22
+ return bytes;
23
+ }
24
+
25
+ throw new Error(`File not found: ${path}. Add this file to the dev-data/ folder for local development.`);
26
+ },
27
+ };
28
+
29
+ const biolib: IBioLibGlobals =
30
+ process.env.NODE_ENV === "development"
31
+ ? devSdkBioLib
32
+ : (window as any).biolib;
33
+
34
+ export default biolib;
@@ -0,0 +1,7 @@
1
+ {
2
+ "message": "Example JSON data for development",
3
+ "results": [
4
+ { "id": 1, "value": "Sample result 1" },
5
+ { "id": 2, "value": "Sample result 2" }
6
+ ]
7
+ }
@@ -0,0 +1,52 @@
1
+ import { Plugin } from 'vite';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+
5
+ export function devDataPlugin(): Plugin {
6
+ let isDev = false;
7
+
8
+ return {
9
+ name: 'dev-data-plugin',
10
+ configResolved(config) {
11
+ isDev = config.mode === 'development';
12
+ },
13
+ transform(code: string, id: string) {
14
+ if (id.endsWith('biolib-sdk.ts')) {
15
+ let injectedCode: string;
16
+
17
+ if (isDev) {
18
+ const devDataDir = path.join(__dirname, 'dev-data');
19
+ const devDataMap: Record<string, string> = {};
20
+
21
+ if (fs.existsSync(devDataDir)) {
22
+ const files = fs.readdirSync(devDataDir);
23
+ for (const file of files) {
24
+ const filePath = path.join(devDataDir, file);
25
+ if (fs.statSync(filePath).isFile()) {
26
+ const content = fs.readFileSync(filePath);
27
+ const base64Content = content.toString('base64');
28
+ devDataMap[file] = base64Content;
29
+ }
30
+ }
31
+ }
32
+
33
+ const devDataJson = JSON.stringify(devDataMap);
34
+ injectedCode = code.replace(
35
+ '/* DEV_DATA_INJECTION */',
36
+ `const DEV_DATA_FILES: Record<string, string> = ${devDataJson};`
37
+ );
38
+ } else {
39
+ injectedCode = code.replace(
40
+ '/* DEV_DATA_INJECTION */',
41
+ '// Dev data not included in production build'
42
+ );
43
+ }
44
+
45
+ return {
46
+ code: injectedCode,
47
+ map: null
48
+ };
49
+ }
50
+ }
51
+ };
52
+ }
@@ -2,7 +2,8 @@ import { defineConfig } from "vite";
2
2
  import react from "@vitejs/plugin-react";
3
3
  import tailwindcss from "@tailwindcss/vite";
4
4
  import { viteSingleFile } from "vite-plugin-singlefile";
5
+ import { devDataPlugin } from "./vite-plugin-dev-data";
5
6
 
6
7
  export default defineConfig({
7
- plugins: [react(), tailwindcss(), viteSingleFile()],
8
+ plugins: [react(), tailwindcss(), devDataPlugin(), viteSingleFile()],
8
9
  });
@@ -5,17 +5,19 @@ from biolib.app import BioLibApp
5
5
 
6
6
 
7
7
  class Session:
8
- def __init__(self, _init_dict: ApiClientInitDict) -> None:
8
+ def __init__(self, _init_dict: ApiClientInitDict, _experiment: Optional[str] = None) -> None:
9
9
  self._api = ApiClient(_init_dict=_init_dict)
10
+ self._experiment = _experiment
10
11
 
11
12
  @staticmethod
12
- def get_session(refresh_token: str, base_url: Optional[str] = None, client_type: Optional[str] = None) -> 'Session':
13
+ def get_session(refresh_token: str, base_url: Optional[str] = None, client_type: Optional[str] = None, experiment: Optional[str] = None) -> 'Session':
13
14
  return Session(
14
15
  _init_dict=ApiClientInitDict(
15
16
  refresh_token=refresh_token,
16
17
  base_url=base_url or utils.load_base_url_from_env(),
17
18
  client_type=client_type,
18
- )
19
+ ),
20
+ _experiment=experiment,
19
21
  )
20
22
 
21
23
  def load(self, uri: str, suppress_version_warning: bool = False) -> BioLibApp:
@@ -39,4 +41,4 @@ class Session:
39
41
  >>> app = biolib.load('https://biolib.com/biolib/myapp/')
40
42
  >>> result = app.cli('--help')
41
43
  """
42
- return BioLibApp(uri=uri, _api_client=self._api, suppress_version_warning=suppress_version_warning)
44
+ return BioLibApp(uri=uri, _api_client=self._api, suppress_version_warning=suppress_version_warning, _experiment=self._experiment)
biolib/app/app.py CHANGED
@@ -25,8 +25,15 @@ from biolib._internal.file_utils import path_to_renamed_path
25
25
 
26
26
 
27
27
  class BioLibApp:
28
- def __init__(self, uri: str, _api_client: Optional[ApiClient] = None, suppress_version_warning: bool = False):
28
+ def __init__(
29
+ self,
30
+ uri: str,
31
+ _api_client: Optional[ApiClient] = None,
32
+ suppress_version_warning: bool = False,
33
+ _experiment: Optional[str] = None,
34
+ ):
29
35
  self._api_client: Optional[ApiClient] = _api_client
36
+ self._experiment = _experiment
30
37
 
31
38
  app_response = BiolibAppApi.get_by_uri(uri=uri, api_client=self._api_client)
32
39
  self._app: App = app_response['app']
@@ -85,7 +92,12 @@ class BioLibApp:
85
92
  raise ValueError('The argument "check" cannot be True when blocking is False')
86
93
 
87
94
  if not experiment_id:
88
- experiment_instance = Experiment(experiment) if experiment else Experiment.get_experiment_in_context()
95
+ experiment_to_use = experiment if experiment is not None else self._experiment
96
+ experiment_instance: Optional[Experiment]
97
+ if experiment_to_use:
98
+ experiment_instance = Experiment(experiment_to_use)
99
+ else:
100
+ experiment_instance = Experiment.get_experiment_in_context()
89
101
  experiment_id = experiment_instance.uuid if experiment_instance else None
90
102
 
91
103
  module_input_serialized = self._get_serialized_module_input(args, stdin, files)
biolib/sdk/__init__.py CHANGED
@@ -12,8 +12,18 @@ from biolib.app import BioLibApp as _BioLibApp
12
12
  Runtime = _Runtime
13
13
 
14
14
 
15
- def get_session(refresh_token: str, base_url: Optional[str] = None, client_type: Optional[str] = None) -> _Session:
16
- return _Session.get_session(refresh_token=refresh_token, base_url=base_url, client_type=client_type)
15
+ def get_session(
16
+ refresh_token: str,
17
+ base_url: Optional[str] = None,
18
+ client_type: Optional[str] = None,
19
+ experiment: Optional[str] = None,
20
+ ) -> _Session:
21
+ return _Session.get_session(
22
+ refresh_token=refresh_token,
23
+ base_url=base_url,
24
+ client_type=client_type,
25
+ experiment=experiment,
26
+ )
17
27
 
18
28
 
19
29
  def push_app_version(uri: str, path: str) -> _BioLibApp:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pybiolib
3
- Version: 1.2.1318
3
+ Version: 1.2.1352
4
4
  Summary: BioLib Python Client
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -28,14 +28,17 @@ biolib/_internal/templates/copilot_template/.github/prompts/biolib_app_inputs.pr
28
28
  biolib/_internal/templates/copilot_template/.github/prompts/biolib_onboard_repo.prompt.md,sha256=BfCkVyafDHFBMu6qcvKlxpnXKJRHNDp5qR_fN4XB9pI,1515
29
29
  biolib/_internal/templates/copilot_template/.github/prompts/biolib_run_apps.prompt.md,sha256=-t1bmGr3zEFa6lKHaLcI98yq4Sg1TCMW8xbelNSHaOA,696
30
30
  biolib/_internal/templates/gui_template/.yarnrc.yml,sha256=Rz5t74b8A2OBIODAHQyLurCVZ3JWRg-k6nY-XUaX8nA,25
31
- biolib/_internal/templates/gui_template/App.tsx,sha256=hh_r7P4Pn4HLaE8C1PoECawd81yoC4MfWPu7Op02kWg,509
31
+ biolib/_internal/templates/gui_template/App.tsx,sha256=VfaJO_mxbheRrfO1dU28G9Q4pGsGzeJpPREqtAT4fGE,1692
32
32
  biolib/_internal/templates/gui_template/Dockerfile,sha256=nGZQiL7coQBUnH1E2abK2PJ4XRjVS1QXn6HDX9UGpcE,479
33
+ biolib/_internal/templates/gui_template/biolib-sdk.ts,sha256=cplISOz2eUTHXoiF9kftYVMb4qVnEHLkt_wWqdb0HkY,978
34
+ biolib/_internal/templates/gui_template/dev-data/output.json,sha256=wKcJQtN7NGaCJkmEWyRjEbBtTLMHB6pOkqTgWsKmOh8,162
33
35
  biolib/_internal/templates/gui_template/index.css,sha256=WYds1xQY2of84ebHhRW9ummbw0Bg9N-EyfmBzJKigck,70
34
36
  biolib/_internal/templates/gui_template/index.html,sha256=EM5xzJ9CsJalgzL-jLNkAoP4tgosw0WYExcH5W6DOs8,403
35
37
  biolib/_internal/templates/gui_template/index.tsx,sha256=YrdrpcckwLo0kYIA-2egtzlo0OMWigGxnt7mNN4qmlU,234
36
38
  biolib/_internal/templates/gui_template/package.json,sha256=iyYYUC0zKGWvZcH8YxN-3w-0N68W5vx-0WPlluMn6Y4,621
37
39
  biolib/_internal/templates/gui_template/tsconfig.json,sha256=T3DJIzeLQ2BL8HLfPHI-IvHtJhnMXdHOoRjkmQlJQAw,541
38
- biolib/_internal/templates/gui_template/vite.config.mts,sha256=Bf1bgRReU3XFsR6rX9yylW2IAxy2cDQI1FHBMjRnyQ4,271
40
+ biolib/_internal/templates/gui_template/vite-plugin-dev-data.ts,sha256=9Fg7kS1xMB5bgUGRExJX8y_AyE2AcVba3k-EfRj352I,1534
41
+ biolib/_internal/templates/gui_template/vite.config.mts,sha256=Pk9T9wkpHowE0WMqOJ_tuLZYhXsslLzLNNkFHYYjHQ4,344
39
42
  biolib/_internal/templates/init_template/.biolib/config.yml,sha256=gxMVd1wjbsDvMv4byc8fKEdJFby4qgi6v38mO5qmhoY,453
40
43
  biolib/_internal/templates/init_template/.github/workflows/biolib.yml,sha256=sphjoiycV_oc4VbaA8wbUEokSMpnrdB6N-bYju_5Ibo,522
41
44
  biolib/_internal/templates/init_template/.gitignore,sha256=dR_jhtT0boUspgk3S5PPUwuO0o8gKGIbdwu8IH638CY,20
@@ -63,11 +66,11 @@ biolib/_internal/utils/__init__.py,sha256=xp1I-lVnu5owV1CW53jiPEZLKmqqHiPUDfauYD
63
66
  biolib/_internal/utils/job_url.py,sha256=YpwqCP56BD15M8p2tuSY_Z3O9vWAkG2rJbQu2Z5zqq0,1265
64
67
  biolib/_internal/utils/multinode.py,sha256=N7kR49xD1PdkMVlxxzRiSYHfgi9MG-kLCwemcY1rojg,8323
65
68
  biolib/_runtime/runtime.py,sha256=9q6Wuo8SBcJIezyScAgq2MDfpT0Pg8lcfbBFmeCWiUE,5974
66
- biolib/_session/session.py,sha256=US1Y1jfFIAm86-Lq3C7nCXpZXUJXXBVBkND9djMNYxI,1649
69
+ biolib/_session/session.py,sha256=Ymi9OQW_u_CfYA3JlBakPwRhNaKlb20P2G8SmtJhnzA,1824
67
70
  biolib/api/__init__.py,sha256=mQ4u8FijqyLzjYMezMUUbbBGNB3iFmkNdjXnWPZ7Jlw,138
68
71
  biolib/api/client.py,sha256=2GpKE7QrPgyPdgJgrV7XnZByIJf1n26UCy3aoaHBs1M,7881
69
72
  biolib/app/__init__.py,sha256=cdPtcfb_U-bxb9iSL4fCEq2rpD9OjkyY4W-Zw60B0LI,37
70
- biolib/app/app.py,sha256=Jc2PwNsZDKca9NxvasI_yrnb0q_S9PrJ94lva-y2Zpc,11882
73
+ biolib/app/app.py,sha256=FjiqT7jCH0pSzKpG_v2Z9ysdUaPhhdPmW5gC-IbnAl0,12230
71
74
  biolib/app/search_apps.py,sha256=K4a41f5XIWth2BWI7OffASgIsD0ko8elCax8YL2igaY,1470
72
75
  biolib/biolib_api_client/__init__.py,sha256=E5EMa19wJoblwSdQPYrxc_BtIeRsAuO0L_jQweWw-Yk,182
73
76
  biolib/biolib_api_client/api_client.py,sha256=IONzXeFCHl4wuct6fqOC_7NiTv_zFy6ys0hsAtvLzTA,7578
@@ -147,7 +150,7 @@ biolib/jobs/job_result.py,sha256=_xqQu9z9BqPQrU6tjqKPuKlQDt5W0Zw5xiQvzEBkDyE,526
147
150
  biolib/jobs/types.py,sha256=rFs6bQWsNI-nb1Hu9QzOW2zFZ8bOVt7ax4UpGVASxVA,1034
148
151
  biolib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
149
152
  biolib/runtime/__init__.py,sha256=MlRepA11n2H-3plB5rzWyyHK2JmP6PiaP3i6x3vt0mg,506
150
- biolib/sdk/__init__.py,sha256=Z1S5BgpvM87S2o1libtqkYN1CfYUhn_d4ChEJjwdFKM,2356
153
+ biolib/sdk/__init__.py,sha256=TATbgncVHIzxo_U1zpD1YrdngIIvJkT3S0o2qe3dcg4,2471
151
154
  biolib/tables.py,sha256=MmruV-nJLc3HbLVJBAiDuDCgS2-4oaUkpoCLLUNYbxQ,1173
152
155
  biolib/typing_utils.py,sha256=ntzrlyTkUaO2OtccLYzCAGztGdca0WT5fikJUmSkT-Y,148
153
156
  biolib/user/__init__.py,sha256=Db5wtxLfFz3ID9TULSSTo77csw9tO6RtxMRvV5cqKEE,39
@@ -158,8 +161,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
158
161
  biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
159
162
  biolib/utils/seq_util.py,sha256=rImaghQGuIqTVWks6b9P2yKuN34uePUYPUFW_Wyoa4A,6737
160
163
  biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
161
- pybiolib-1.2.1318.dist-info/METADATA,sha256=Kfin2a-7v8pg6206XqZNFcKTERbw6IVRCvIhR-yb-0E,1644
162
- pybiolib-1.2.1318.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
163
- pybiolib-1.2.1318.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
164
- pybiolib-1.2.1318.dist-info/licenses/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
165
- pybiolib-1.2.1318.dist-info/RECORD,,
164
+ pybiolib-1.2.1352.dist-info/METADATA,sha256=XynyBKvX9QaPKQoKAA1I_WX5_XFZDn9X_zjmP2ivUY0,1644
165
+ pybiolib-1.2.1352.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
166
+ pybiolib-1.2.1352.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
167
+ pybiolib-1.2.1352.dist-info/licenses/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
168
+ pybiolib-1.2.1352.dist-info/RECORD,,