@gen3/workspaces 0.12.64 → 0.12.65

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.
Files changed (100) hide show
  1. package/LICENSE +201 -0
  2. package/dist/jupyterlite-builds/free-private/jupyter_lite_config.json +5 -19
  3. package/dist/jupyterlite-builds/free-private/requirements.txt +1 -1
  4. package/dist/jupyterlite-builds/scripts/build-gen3sdk-lite.sh +428 -0
  5. package/dist/jupyterlite-builds/scripts/build-jupyterlite.sh +150 -33
  6. package/dist/jupyterlite-builds/scripts/setup-env.sh +81 -0
  7. package/dist/jupyterlite-builds/scripts/sync-jupyter-assets-into-package.sh +19 -2
  8. package/dist/jupyterlite-builds/scripts/validate-jupyterlite-assets.sh +3 -0
  9. package/jupyterlite-builds/free-private/jupyter_lite_config.json +5 -19
  10. package/jupyterlite-builds/free-private/requirements.txt +1 -1
  11. package/package.json +7 -4
  12. package/scripts/build-gen3sdk-lite.sh +428 -0
  13. package/scripts/build-jupyterlite.sh +150 -33
  14. package/scripts/patch-pyidode-lock.py +100 -0
  15. package/scripts/setup-env.sh +81 -0
  16. package/scripts/sync-jupyter-assets-into-package.sh +19 -2
  17. package/scripts/validate-jupyterlite-assets.sh +3 -0
  18. package/dist/jupyterlite-builds/scripts/build-gen3sdk-lite_v2.sh +0 -310
  19. package/dist/jupyterlite-builds/scripts/build-jupyterlite_v2.sh +0 -111
  20. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/aiofiles-25.1.0-py3-none-any.whl +0 -0
  21. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/backoff-2.2.1-py3-none-any.whl +0 -0
  22. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/cdislogging-1.2.0-py3-none-any.whl +0 -0
  23. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/comm-0.2.3-py3-none-any.whl +0 -0
  24. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/dataclasses_json-0.5.9-py3-none-any.whl +0 -0
  25. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/dictionaryutils-4.0.0-py3-none-any.whl +0 -0
  26. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/drsclient-0.4.0-py3-none-any.whl +0 -0
  27. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/fastavro-1.12.2-py3-none-any.whl +0 -0
  28. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/gen3-4.28.3-py3-none-any.whl +0 -0
  29. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/gen3dictionary-3.0.0-py3-none-any.whl +0 -0
  30. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/gen3users-1.1.1-py3-none-any.whl +0 -0
  31. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/humanfriendly-10.0-py2.py3-none-any.whl +0 -0
  32. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/importlib_metadata-8.9.0-py3-none-any.whl +0 -0
  33. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/indexclient-6.3.0-py3-none-any.whl +0 -0
  34. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/ipykernel-6.9.2-py3-none-any.whl +0 -0
  35. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/ipython_pygments_lexers-1.1.1-py3-none-any.whl +0 -0
  36. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/marshmallow-3.26.2-py3-none-any.whl +0 -0
  37. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/marshmallow_enum-1.5.1-py2.py3-none-any.whl +0 -0
  38. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/mypy_extensions-1.1.0-py3-none-any.whl +0 -0
  39. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/piplite-0.8.5-py3-none-any.whl +0 -0
  40. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/pyodide_http-0.2.2-py3-none-any.whl +0 -0
  41. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/pyodide_kernel-0.8.5-py3-none-any.whl +0 -0
  42. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/pypfb-0.6.2-py3-none-any.whl +0 -0
  43. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/python_dateutil-2.9.0.post0-py2.py3-none-any.whl +0 -0
  44. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/python_json_logger-4.2.0-py3-none-any.whl +0 -0
  45. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/typing_inspect-0.9.0-py3-none-any.whl +0 -0
  46. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/xmltodict-0.13.0-py2.py3-none-any.whl +0 -0
  47. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_uv_wheels/zipp-4.1.0-py3-none-any.whl +0 -0
  48. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_work/constraints.txt +0 -354
  49. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_work/excludes.txt +0 -3
  50. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_work/pylock.toml +0 -347
  51. package/jupyterlite-builds/free-private/.cache/pyodide-lock/_work/requirements.in +0 -26
  52. package/jupyterlite-builds/free-private/.cache/pyodide-lock/patched-pyodide-lock.json +0 -1
  53. package/jupyterlite-builds/free-private/.cache/pyodide-lock/pyodide-lock.json +0 -1
  54. package/jupyterlite-builds/free-private/.cache/pyodide-lock/remote-pyodide-lock.json +0 -1
  55. package/jupyterlite-builds/free-private/.cache/wheels/aiofiles-25.1.0-py3-none-any.whl.meta.json +0 -24
  56. package/jupyterlite-builds/free-private/.cache/wheels/backoff-2.2.1-py3-none-any.whl.meta.json +0 -24
  57. package/jupyterlite-builds/free-private/.cache/wheels/cdislogging-1.2.0-py3-none-any.whl.meta.json +0 -24
  58. package/jupyterlite-builds/free-private/.cache/wheels/dataclasses_json-0.5.9-py3-none-any.whl.meta.json +0 -24
  59. package/jupyterlite-builds/free-private/.cache/wheels/dictionaryutils-4.0.0-py3-none-any.whl.meta.json +0 -24
  60. package/jupyterlite-builds/free-private/.cache/wheels/drsclient-0.4.0-py3-none-any.whl.meta.json +0 -24
  61. package/jupyterlite-builds/free-private/.cache/wheels/fastavro-1.12.2-py3-none-any.whl.meta.json +0 -24
  62. package/jupyterlite-builds/free-private/.cache/wheels/gen3-4.28.3-py3-none-any.whl.meta.json +0 -24
  63. package/jupyterlite-builds/free-private/.cache/wheels/gen3dictionary-3.0.0-py3-none-any.whl.meta.json +0 -24
  64. package/jupyterlite-builds/free-private/.cache/wheels/gen3users-1.1.1-py3-none-any.whl.meta.json +0 -24
  65. package/jupyterlite-builds/free-private/.cache/wheels/humanfriendly-10.0-py2.py3-none-any.whl.meta.json +0 -24
  66. package/jupyterlite-builds/free-private/.cache/wheels/importlib_metadata-8.9.0-py3-none-any.whl.meta.json +0 -24
  67. package/jupyterlite-builds/free-private/.cache/wheels/indexclient-6.3.0-py3-none-any.whl.meta.json +0 -24
  68. package/jupyterlite-builds/free-private/.cache/wheels/marshmallow-3.26.2-py3-none-any.whl.meta.json +0 -24
  69. package/jupyterlite-builds/free-private/.cache/wheels/marshmallow_enum-1.5.1-py2.py3-none-any.whl.meta.json +0 -24
  70. package/jupyterlite-builds/free-private/.cache/wheels/mypy_extensions-1.1.0-py3-none-any.whl.meta.json +0 -24
  71. package/jupyterlite-builds/free-private/.cache/wheels/pypfb-0.6.2-py3-none-any.whl.meta.json +0 -24
  72. package/jupyterlite-builds/free-private/.cache/wheels/python_dateutil-2.9.0.post0-py2.py3-none-any.whl.meta.json +0 -24
  73. package/jupyterlite-builds/free-private/.cache/wheels/python_json_logger-4.2.0-py3-none-any.whl.meta.json +0 -24
  74. package/jupyterlite-builds/free-private/.cache/wheels/typing_inspect-0.9.0-py3-none-any.whl.meta.json +0 -24
  75. package/jupyterlite-builds/free-private/.cache/wheels/xmltodict-0.13.0-py2.py3-none-any.whl.meta.json +0 -24
  76. package/jupyterlite-builds/free-private/.cache/wheels/zipp-4.1.0-py3-none-any.whl.meta.json +0 -24
  77. package/jupyterlite-builds/free-private/cockle-config.json +0 -71
  78. package/jupyterlite-builds/free-private/cockle_wasm_env/.mambarc +0 -1
  79. package/jupyterlite-builds/free-private/cockle_wasm_env/bin/coreutils.js +0 -5421
  80. package/jupyterlite-builds/free-private/cockle_wasm_env/bin/coreutils.wasm +0 -0
  81. package/jupyterlite-builds/free-private/cockle_wasm_env/bin/fs.d.ts +0 -375
  82. package/jupyterlite-builds/free-private/cockle_wasm_env/bin/fs.js +0 -3401
  83. package/jupyterlite-builds/free-private/cockle_wasm_env/bin/fs.wasm +0 -0
  84. package/jupyterlite-builds/free-private/cockle_wasm_env/bin/grep.js +0 -3839
  85. package/jupyterlite-builds/free-private/cockle_wasm_env/bin/grep.wasm +0 -0
  86. package/jupyterlite-builds/free-private/cockle_wasm_env/bin/less.data +0 -0
  87. package/jupyterlite-builds/free-private/cockle_wasm_env/bin/less.js +0 -5060
  88. package/jupyterlite-builds/free-private/cockle_wasm_env/bin/less.wasm +0 -0
  89. package/jupyterlite-builds/free-private/cockle_wasm_env/bin/sed.js +0 -3843
  90. package/jupyterlite-builds/free-private/cockle_wasm_env/bin/sed.wasm +0 -0
  91. package/jupyterlite-builds/free-private/cockle_wasm_env/conda-meta/cockle_fs-0.3.0-h27506cd_2.json +0 -60
  92. package/jupyterlite-builds/free-private/cockle_wasm_env/conda-meta/coreutils-9.10-h072c4ef_3.json +0 -52
  93. package/jupyterlite-builds/free-private/cockle_wasm_env/conda-meta/emscripten-abi-4.0.9-h267e887_9.json +0 -31
  94. package/jupyterlite-builds/free-private/cockle_wasm_env/conda-meta/grep-3.12-h8b79025_0.json +0 -52
  95. package/jupyterlite-builds/free-private/cockle_wasm_env/conda-meta/history +0 -10
  96. package/jupyterlite-builds/free-private/cockle_wasm_env/conda-meta/less-693-hf259948_0.json +0 -60
  97. package/jupyterlite-builds/free-private/cockle_wasm_env/conda-meta/sed-4.9-h072c4ef_0.json +0 -52
  98. package/scripts/aiohttp-3.13.5-cp314-cp314-pyemscripten_2026_0_wasm32.whl +0 -0
  99. package/scripts/build-gen3sdk-lite_v2.sh +0 -310
  100. package/scripts/build-jupyterlite_v2.sh +0 -111
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -3,24 +3,10 @@
3
3
  "apps": ["lab"],
4
4
  "output_dir": "site"
5
5
  },
6
- "LiteServerConfig": {
7
- "contents": ["./notebooks"],
8
- "settings_overrides": {
9
- "@jupyterlite/piplite-extension:plugin": {
10
- "pipliteDeps": [
11
- "numpy",
12
- "pandas",
13
- "scipy",
14
- "matplotlib",
15
- "seaborn",
16
- "biopython",
17
- "scanpy",
18
- "anndata",
19
- "pysam",
20
- "boto3",
21
- "s3fs"
22
- ]
23
- }
24
- }
6
+ "PyodideAddon": {
7
+ "pyodide_url": "https://github.com/pyodide/pyodide/releases/download/314.0.5/pyodide-314.0.5.tar.bz2"
8
+ },
9
+ "PyodideLockAddon": {
10
+ "enabled": false
25
11
  }
26
12
  }
@@ -1,3 +1,3 @@
1
1
  jupyterlite-core>=0.8.1
2
2
  jupyterlab>=4.6.0
3
- jupyterlite-pyodide-kernel
3
+ jupyterlite-pyodide-kernel[lock]
@@ -0,0 +1,428 @@
1
+ #!/usr/bin/env bash
2
+ # =============================================================================
3
+ # build-gen3sdk-lite.sh — Build Gen3 SDK and dependencies as pure-Python wheels
4
+ #
5
+ # All packages in REPOS are pure Python (fastavro has Python fallbacks for its
6
+ # C extensions). They are therefore built with `pip wheel` and retagged to
7
+ # py3-none-any, which loads under any Pyodide/Python version.
8
+ #
9
+ # If a package with genuine C extensions is added to REPOS, the pure-Python
10
+ # assertion below will fail the build rather than silently shipping a wheel
11
+ # that cannot load in the browser.
12
+ #
13
+ # Prerequisites:
14
+ # - uv (https://docs.astral.sh/uv/getting-started/installation/)
15
+ # - git
16
+ #
17
+ # Usage:
18
+ # ./build-gen3sdk-lite.sh # full build (setup + all packages)
19
+ # ./build-gen3sdk-lite.sh --setup # environment setup only
20
+ # ./build-gen3sdk-lite.sh --build # build wheels only (assumes setup done)
21
+ # ./build-gen3sdk-lite.sh --clean # remove build artifacts
22
+ # =============================================================================
23
+ set -euo pipefail
24
+
25
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
26
+
27
+ # ── Parse flags (strip before positional args are consumed) ──────────────────
28
+ NO_EXTRAS=false
29
+ POSITIONAL_ARGS=()
30
+ for _arg in "$@"; do
31
+ case "$_arg" in
32
+ --no-extras) NO_EXTRAS=true ;;
33
+ *) POSITIONAL_ARGS+=("$_arg") ;;
34
+ esac
35
+ done
36
+ set -- "${POSITIONAL_ARGS[@]+"${POSITIONAL_ARGS[@]}"}"
37
+
38
+ # ── Path constants (always defined, no external dependency) ──────────────────
39
+ ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
40
+ SRC_DIR="$ROOT_DIR/free-private"
41
+
42
+ # Resolves a possibly-relative path against INIT_CWD (or $PWD) rather than
43
+ # whatever directory happens to be current when this runs. See setup-env.sh
44
+ # for why: it's what keeps a relative build_dir out of dist/ or node_modules.
45
+ _resolve_against_init_cwd() {
46
+ local path="$1"
47
+ local base="${INIT_CWD:-$(pwd)}"
48
+ case "$path" in
49
+ /*) printf '%s' "$path" ;;
50
+ *) printf '%s/%s' "$base" "$path" ;;
51
+ esac
52
+ }
53
+
54
+ BUILD_DIR="$(_resolve_against_init_cwd "${2:-builds}")"
55
+ mkdir -p "$BUILD_DIR"
56
+ BUILD_DIR="$(cd "$BUILD_DIR" && pwd)"
57
+
58
+ VENV_DIR="$BUILD_DIR/.venv"
59
+ WORK_DIR="$BUILD_DIR/work"
60
+ SOURCES_DIR="$BUILD_DIR/sources"
61
+ OUTPUT_DIR="$BUILD_DIR/pypi"
62
+ LOG_DIR="$BUILD_DIR/logs"
63
+
64
+ export BUILD_DIR # setup-env.sh reads this
65
+
66
+ # Browser Python version, used for `pip download` of pure-Python extras.
67
+ # Must match jupyterlite_pyodide_kernel.constants.PYODIDE_PYTHON_VERSION.
68
+ # Check with:
69
+ # python -c "from jupyterlite_pyodide_kernel.constants import \
70
+ # PYODIDE_PYTHON_VERSION; print(PYODIDE_PYTHON_VERSION)"
71
+ BROWSER_PYTHON_TAG="${BROWSER_PYTHON_TAG:-314}"
72
+
73
+ # ── Colours / helpers (available immediately, before setup-env.sh) ───────────
74
+ RED='\033[0;31m'
75
+ GREEN='\033[0;32m'
76
+ YELLOW='\033[1;33m'
77
+ CYAN='\033[0;36m'
78
+ NC='\033[0m'
79
+
80
+ info() { echo -e "${CYAN}[INFO]${NC} $*"; }
81
+ success() { echo -e "${GREEN}[OK]${NC} $*"; }
82
+ warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
83
+ fail() { echo -e "${RED}[FAIL]${NC} $*"; exit 1; }
84
+
85
+ elapsed() {
86
+ local t=$1
87
+ printf '%dm%ds' $((t/60)) $((t%60))
88
+ }
89
+
90
+ # Portable in-place sed. GNU sed reads `-i ''` as the script and the following
91
+ # expression as a filename; BSD/macOS sed requires the empty suffix. Detect once.
92
+ if sed --version >/dev/null 2>&1; then
93
+ sedi() { sed -i "$@"; } # GNU
94
+ else
95
+ sedi() { sed -i '' "$@"; } # BSD / macOS
96
+ fi
97
+
98
+ # Apply a sed substitution and fail loudly if it changed nothing. `sed` exits 0
99
+ # on a non-match, which previously let stale patterns pass as "Patched …".
100
+ patch_file() {
101
+ local desc="$1" expr="$2" path="$3"
102
+ [[ -f "$path" ]] || { warn "${desc}: file not found, skipping (${path})"; return 0; }
103
+ local before after
104
+ before="$(cat "$path")"
105
+ sedi "$expr" "$path"
106
+ after="$(cat "$path")"
107
+ if [[ "$before" == "$after" ]]; then
108
+ warn "${desc}: pattern did not match — upstream may have changed"
109
+ return 0
110
+ fi
111
+ info "${desc}"
112
+ }
113
+
114
+ # ── Repositories to build (order matters — independent packages first) ───────
115
+ # Format: "name|git_url|subdir" (subdir is optional)
116
+ REPOS=(
117
+ "cdislogging|https://github.com/uc-cdis/cdislogging.git"
118
+ "python-json-logger|https://github.com/nhairs/python-json-logger.git"
119
+ "fastavro|https://github.com/fastavro/fastavro.git"
120
+ "drsclient|https://github.com/uc-cdis/drsclient.git"
121
+ "indexd|https://github.com/uc-cdis/indexd.git|indexclient"
122
+ "dictionaryutils|https://github.com/uc-cdis/dictionaryutils.git"
123
+ "pypfb|https://github.com/uc-cdis/pypfb.git"
124
+ "gen3sdk-python|https://github.com/uc-cdis/gen3sdk-python.git"
125
+ "gen3users|https://github.com/uc-cdis/gen3users.git"
126
+ "gen3dictionary|https://github.com/uc-cdis/datadictionary.git"
127
+ )
128
+
129
+ # ── Source shared environment (venv + Python + core tooling) ────────────────
130
+ source_shared_env() {
131
+ # shellcheck disable=SC1091
132
+ source "${SCRIPT_DIR}/setup-env.sh"
133
+ }
134
+
135
+ # ── Environment setup ───────────────────────────────────────────────────────
136
+ setup_environment() {
137
+ source_shared_env
138
+ mkdir -p "${WORK_DIR}" "${SOURCES_DIR}" "${OUTPUT_DIR}" "${LOG_DIR}"
139
+
140
+ # `wheel` provides `python -m wheel tags`, used to retag to py3-none-any.
141
+ info "Installing wheel …"
142
+ uv pip install wheel 2>&1 | tail -2
143
+ success "Build tooling ready"
144
+ }
145
+
146
+ # ── Clone / update sources ──────────────────────────────────────────────────
147
+ clone_repos() {
148
+ info "Cloning / updating repositories …"
149
+ for entry in "${REPOS[@]}"; do
150
+ IFS='|' read -r name url _subdir <<< "${entry}"
151
+ local dest="${SOURCES_DIR}/${name}"
152
+ if [[ -d "${dest}/.git" ]]; then
153
+ # Sources are patched in place below, so a pull would conflict. Reset to
154
+ # a clean tree first, otherwise the pull fails silently through the pipe.
155
+ info " ${name}: resetting and pulling latest …"
156
+ git -C "${dest}" checkout -- . 2>&1 | tail -1 || true
157
+ git -C "${dest}" pull --ff-only 2>&1 | tail -1
158
+ else
159
+ info " ${name}: cloning …"
160
+ git clone "${url}" "${dest}" 2>&1 | tail -1
161
+ fi
162
+ done
163
+ success "All repositories ready"
164
+ }
165
+
166
+ # ── Source patches ──────────────────────────────────────────────────────────
167
+ apply_patches() {
168
+ # gen3users: old poetry.masonry.api → poetry.core.masonry.api
169
+ patch_file "Patched gen3users: build-backend updated to poetry.core.masonry.api" \
170
+ 's|build-backend = "poetry.masonry.api"|build-backend = "poetry.core.masonry.api"|' \
171
+ "${SOURCES_DIR}/gen3users/pyproject.toml"
172
+
173
+ # gen3sdk-python: relax indexclient pin so the locally built 6.3.0 satisfies it
174
+ patch_file "Patched gen3sdk-python: indexclient constraint relaxed to >=2.3.0" \
175
+ 's/indexclient = "\^2\.3\.0"/indexclient = ">=2.3.0"/' \
176
+ "${SOURCES_DIR}/gen3sdk-python/pyproject.toml"
177
+
178
+ # dictionaryutils: relax the jsonschema pin.
179
+ #
180
+ # NOTE: upstream pins jsonschema<=4.23.0 deliberately — "limiting to a version
181
+ # where RefResolver is deprecated but still functioning". Relaxing it resolves
182
+ # jsonschema 4.26.0 in the browser, where RefResolver exists only as a
183
+ # module-level __getattr__ shim forwarding to validators._RefResolver. It
184
+ # imports and works today, but this is borrowed time. If dictionaryutils
185
+ # starts failing on import, this patch is the first thing to revert.
186
+ patch_file "Patched dictionaryutils: jsonschema constraint relaxed to >=4.0.0" \
187
+ 's/jsonschema = "<=4\.23\.0"/jsonschema = ">=4.0.0"/' \
188
+ "${SOURCES_DIR}/dictionaryutils/pyproject.toml"
189
+
190
+
191
+
192
+ # fastavro: force setup.py to skip building the Cython/C extensions.
193
+ #
194
+ # FASTAVRO_USE_PYTHON only selects the pure-Python fallback at import time
195
+ # (fastavro/__init__.py) — setup.py itself always builds the _read/_write/
196
+ # etc. extensions unless the interpreter is PyPy, so `pip wheel` still
197
+ # invokes `cc`, which the build image doesn't have.yes Short-circuit the PyPy check instead
198
+ # so ext_modules stays empty and the wheel is genuinely pure Python.
199
+ patch_file "Patched fastavro: setup.py forced to skip C extensions" \
200
+ 's/if not hasattr(sys, "pypy_version_info"):/if False: # gen3-lite: force pure-Python build/' \
201
+ "${SOURCES_DIR}/fastavro/setup.py"
202
+ }
203
+
204
+ # ── Build wheels ────────────────────────────────────────────────────────────
205
+ build_wheels() {
206
+ # shellcheck disable=SC1091
207
+ source "${VENV_DIR}/bin/activate"
208
+
209
+ local total=${#REPOS[@]}
210
+ local built=0
211
+ local failed=0
212
+ local failed_names=()
213
+
214
+ apply_patches
215
+
216
+ info "Building ${total} packages …"
217
+ echo ""
218
+
219
+ for entry in "${REPOS[@]}"; do
220
+ IFS='|' read -r name _url subdir <<< "${entry}"
221
+ local src="${SOURCES_DIR}/${name}"
222
+ local build_dir="${src}"
223
+ [[ -n "${subdir}" ]] && build_dir="${src}/${subdir}"
224
+ local logfile="${LOG_DIR}/${name}.log"
225
+ local start_ts
226
+ start_ts=$(date +%s)
227
+
228
+ local label="${name}"
229
+ [[ -n "${subdir}" ]] && label="${name}/${subdir}"
230
+ printf " [%d/%d] %-25s " $((built + failed + 1)) "${total}" "${label}"
231
+
232
+ # Build as a normal wheel, then force the py3-none-any tag. `pip wheel` can
233
+ # emit a platform-specific tag on macOS even for pure Python; retagging
234
+ # makes the result portable and loadable by micropip under any Pyodide ABI.
235
+ local build_cmd='rm -rf dist && pip wheel . --no-deps -w dist/ \
236
+ && python -m wheel tags --python-tag py3 --abi-tag none --platform-tag any --remove dist/*.whl'
237
+
238
+ # fastavro ships Python fallbacks for every C extension; this env var
239
+ # selects them so no compiler is needed and the wheel stays pure Python.
240
+ [[ "${name}" == "fastavro" ]] && build_cmd="FASTAVRO_USE_PYTHON=1 ${build_cmd}"
241
+
242
+ if (cd "${build_dir}" && eval "${build_cmd}") > "${logfile}" 2>&1; then
243
+ local end_ts
244
+ end_ts=$(date +%s)
245
+ echo -e "${GREEN}OK${NC} ($(elapsed $((end_ts - start_ts))))"
246
+ built=$((built + 1))
247
+ else
248
+ local end_ts
249
+ end_ts=$(date +%s)
250
+ echo -e "${RED}FAILED${NC} ($(elapsed $((end_ts - start_ts)))) — see ${logfile}"
251
+ failed=$((failed + 1))
252
+ failed_names+=("${name}")
253
+ fi
254
+ done
255
+
256
+ echo ""
257
+
258
+ # ── Collect wheels ─────────────────────────────────────────────────────
259
+ info "Collecting .whl files into ${OUTPUT_DIR} …"
260
+ local count=0
261
+ for entry in "${REPOS[@]}"; do
262
+ IFS='|' read -r name _url subdir <<< "${entry}"
263
+ local src="${SOURCES_DIR}/${name}"
264
+ local build_dir="${src}"
265
+ [[ -n "${subdir}" ]] && build_dir="${src}/${subdir}"
266
+ if compgen -G "${build_dir}/dist/*.whl" > /dev/null 2>&1; then
267
+ cp "${build_dir}"/dist/*.whl "${OUTPUT_DIR}/"
268
+ count=$((count + $(ls -1 "${build_dir}"/dist/*.whl 2>/dev/null | wc -l)))
269
+ fi
270
+ done
271
+
272
+ download_extras
273
+
274
+ verify_pure_python
275
+
276
+ # ── Summary ────────────────────────────────────────────────────────────
277
+ echo ""
278
+ echo "========================================="
279
+ echo " Build Summary"
280
+ echo "========================================="
281
+ echo " Succeeded : ${built}"
282
+ echo " Failed : ${failed}"
283
+ echo " Wheels : ${count} built, $(ls -1 "${OUTPUT_DIR}"/*.whl 2>/dev/null | wc -l | tr -d ' ') total in ${OUTPUT_DIR}/"
284
+ if (( failed > 0 )); then
285
+ echo ""
286
+ echo " Failed packages:"
287
+ for n in "${failed_names[@]}"; do
288
+ echo " - ${n} (log: ${LOG_DIR}/${n}.log)"
289
+ done
290
+ fi
291
+ echo "========================================="
292
+ echo ""
293
+
294
+ if (( failed > 0 )); then
295
+ warn "Some packages failed. Check the logs above."
296
+ return 1
297
+ fi
298
+
299
+ success "All wheels built and collected in ${OUTPUT_DIR}/"
300
+ echo ""
301
+ ls -lh "${OUTPUT_DIR}"/*.whl
302
+ }
303
+
304
+ # ── Pure-Python deps not present in the Pyodide distribution ────────────────
305
+ # PyodideLockAddon is disabled (it cannot resolve a vendored local distribution
306
+ # in jupyterlite-pyodide-kernel 0.8.5), so nothing resolves these for us. They
307
+ # reach the browser through PipliteAddon, which indexes everything in
308
+ # OUTPUT_DIR. Without them, micropip falls back to PyPI at runtime.
309
+ download_extras() {
310
+ if [[ "${NO_EXTRAS}" == "true" ]]; then
311
+ info "Skipping pure-Python extras download (--no-extras)"
312
+ warn " gen3's pure-Python deps will be fetched from PyPI in the browser"
313
+ return 0
314
+ fi
315
+
316
+ local deps=(
317
+ "aiofiles"
318
+ "backoff"
319
+ "dataclasses-json<=0.5.9"
320
+ "humanfriendly"
321
+ "importlib-metadata>=8,<9"
322
+ "marshmallow>=3.3.0,<4.0.0"
323
+ "marshmallow-enum"
324
+ "mypy-extensions"
325
+ "python-dateutil"
326
+ "typing-inspect"
327
+ "xmltodict>=0.13.0,<0.14.0"
328
+ "zipp"
329
+ )
330
+
331
+ info "Downloading pure-Python deps missing from the Pyodide distribution …"
332
+ local dep base
333
+ for dep in "${deps[@]}"; do
334
+ # Strip any version specifier to get the distribution name for the glob.
335
+ base="${dep%%[<>=!~]*}"
336
+ if compgen -G "${OUTPUT_DIR}/${base//-/_}-*.whl" > /dev/null 2>&1 || \
337
+ compgen -G "${OUTPUT_DIR}/${base}-*.whl" > /dev/null 2>&1; then
338
+ info " ${base}: already present, skipping"
339
+ continue
340
+ fi
341
+ if pip download "${dep}" \
342
+ --no-deps \
343
+ --only-binary=:all: \
344
+ --python-version "${BROWSER_PYTHON_TAG}" \
345
+ --platform any \
346
+ -d "${OUTPUT_DIR}" \
347
+ --quiet 2>/dev/null; then
348
+ info " ${base}: downloaded"
349
+ else
350
+ warn " ${base}: download failed — will fall back to PyPI in the browser"
351
+ fi
352
+ done
353
+ }
354
+
355
+ # ── Verify every wheel is loadable in the browser ───────────────────────────
356
+ verify_pure_python() {
357
+ info "Verifying all wheels are pure-Python (py3-none-any) …"
358
+ local bad=()
359
+ local whl base
360
+ for whl in "${OUTPUT_DIR}"/*.whl; do
361
+ [[ -f "${whl}" ]] || continue
362
+ base="$(basename "${whl}")"
363
+ case "${base}" in
364
+ *-py3-none-any.whl|*-py2.py3-none-any.whl) ;;
365
+ *) bad+=("${base}") ;;
366
+ esac
367
+ done
368
+
369
+ if (( ${#bad[@]} > 0 )); then
370
+ for base in "${bad[@]}"; do
371
+ warn " not pure-Python: ${base}"
372
+ done
373
+ fail "${#bad[@]} wheel(s) carry a platform tag and cannot load in the browser.
374
+ Either the package has real C extensions (it needs a Pyodide-ABI build
375
+ matching the vendored distribution), or 'python -m wheel tags' did not
376
+ run. Check ${LOG_DIR}/ for the corresponding build log."
377
+ fi
378
+
379
+ success "All $(ls -1 "${OUTPUT_DIR}"/*.whl 2>/dev/null | wc -l | tr -d ' ') wheels are pure-Python"
380
+ }
381
+
382
+ # ── Clean ───────────────────────────────────────────────────────────────────
383
+ clean() {
384
+ info "Cleaning build artifacts …"
385
+ rm -rf "${WORK_DIR}" "${OUTPUT_DIR}" "${LOG_DIR}"
386
+ success "Clean complete"
387
+ }
388
+
389
+ # ── Main ────────────────────────────────────────────────────────────────────
390
+ main() {
391
+ local mode="${1:-all}"
392
+
393
+ case "${mode}" in
394
+ --setup)
395
+ setup_environment
396
+ ;;
397
+ --build)
398
+ source_shared_env
399
+ clone_repos
400
+ build_wheels
401
+ ;;
402
+ --clean)
403
+ clean
404
+ ;;
405
+ --help|-h)
406
+ echo "Usage: $0 [--setup | --build | --clean | --help] [--no-extras] [build_dir]"
407
+ echo ""
408
+ echo " (no flag) Full run: setup environment, clone repos, build wheels"
409
+ echo " --setup Set up Python venv and build tooling"
410
+ echo " --build Clone/update repos and build wheels (requires prior --setup)"
411
+ echo " --clean Remove work/, pypi/, and logs/"
412
+ echo " --help Show this message"
413
+ echo ""
414
+ echo " --no-extras Skip downloading pure-Python deps (aiofiles, backoff, etc.)"
415
+ echo " Only safe if 'import gen3' is not needed"
416
+ echo ""
417
+ echo "Env:"
418
+ echo " BROWSER_PYTHON_TAG Python version for extras download (default 314)"
419
+ ;;
420
+ *)
421
+ setup_environment
422
+ clone_repos
423
+ build_wheels
424
+ ;;
425
+ esac
426
+ }
427
+
428
+ main "$@"