latch 2.45.2.dev1__tar.gz → 2.45.2.dev2__tar.gz

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 (172) hide show
  1. {latch-2.45.2.dev1/latch.egg-info → latch-2.45.2.dev2}/PKG-INFO +1 -1
  2. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/types/metadata.py +84 -4
  3. {latch-2.45.2.dev1 → latch-2.45.2.dev2/latch.egg-info}/PKG-INFO +1 -1
  4. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/nextflow/workflow.py +33 -10
  5. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/setup.py +1 -1
  6. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/LICENSE +0 -0
  7. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/MANIFEST.in +0 -0
  8. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/README.md +0 -0
  9. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/__init__.py +0 -0
  10. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/account.py +0 -0
  11. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/executions.py +0 -0
  12. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/functions/__init__.py +0 -0
  13. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/functions/messages.py +0 -0
  14. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/functions/operators.py +0 -0
  15. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/functions/secrets.py +0 -0
  16. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/ldata/__init__.py +0 -0
  17. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/ldata/_transfer/__init__.py +0 -0
  18. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/ldata/_transfer/download.py +0 -0
  19. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/ldata/_transfer/manager.py +0 -0
  20. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/ldata/_transfer/node.py +0 -0
  21. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/ldata/_transfer/progress.py +0 -0
  22. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/ldata/_transfer/remote_copy.py +0 -0
  23. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/ldata/_transfer/throttle.py +0 -0
  24. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/ldata/_transfer/upload.py +0 -0
  25. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/ldata/_transfer/utils.py +0 -0
  26. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/ldata/path.py +0 -0
  27. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/ldata/type.py +0 -0
  28. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/registry/__init__.py +0 -0
  29. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/registry/project.py +0 -0
  30. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/registry/record.py +0 -0
  31. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/registry/table.py +0 -0
  32. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/registry/types.py +0 -0
  33. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/registry/upstream_types/__init__.py +0 -0
  34. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/registry/upstream_types/types.py +0 -0
  35. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/registry/upstream_types/values.py +0 -0
  36. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/registry/utils.py +0 -0
  37. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/resources/__init__.py +0 -0
  38. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/resources/conditional.py +0 -0
  39. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/resources/dynamic.py +0 -0
  40. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/resources/launch_plan.py +0 -0
  41. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/resources/map_tasks.py +0 -0
  42. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/resources/reference_workflow.py +0 -0
  43. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/resources/tasks.py +0 -0
  44. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/resources/workflow.py +0 -0
  45. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/types/__init__.py +0 -0
  46. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/types/directory.py +0 -0
  47. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/types/file.py +0 -0
  48. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/types/glob.py +0 -0
  49. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/types/json.py +0 -0
  50. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/types/utils.py +0 -0
  51. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/utils.py +0 -0
  52. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/verified/__init__.py +0 -0
  53. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/verified/deseq2.py +0 -0
  54. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/verified/mafft.py +0 -0
  55. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/verified/pathway.py +0 -0
  56. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/verified/rnaseq.py +0 -0
  57. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch/verified/trim_galore.py +0 -0
  58. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch.egg-info/SOURCES.txt +0 -0
  59. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch.egg-info/dependency_links.txt +0 -0
  60. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch.egg-info/entry_points.txt +0 -0
  61. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch.egg-info/requires.txt +0 -0
  62. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch.egg-info/top_level.txt +0 -0
  63. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/__init__.py +0 -0
  64. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/auth/__init__.py +0 -0
  65. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/auth/csrf.py +0 -0
  66. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/auth/oauth2.py +0 -0
  67. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/auth/pkce.py +0 -0
  68. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/auth/utils.py +0 -0
  69. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/centromere/__init__.py +0 -0
  70. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/centromere/ctx.py +0 -0
  71. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/centromere/utils.py +0 -0
  72. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/click_utils.py +0 -0
  73. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/constants.py +0 -0
  74. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/docker_utils/__init__.py +0 -0
  75. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/exceptions/__init__.py +0 -0
  76. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/exceptions/cache.py +0 -0
  77. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/exceptions/errors.py +0 -0
  78. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/exceptions/handler.py +0 -0
  79. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/exceptions/traceback.py +0 -0
  80. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/main.py +0 -0
  81. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/menus.py +0 -0
  82. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/nextflow/__init__.py +0 -0
  83. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/nextflow/dependencies.py +0 -0
  84. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/nextflow/utils.py +0 -0
  85. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/__init__.py +0 -0
  86. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/cp/__init__.py +0 -0
  87. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/cp/autocomplete.py +0 -0
  88. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/cp/glob.py +0 -0
  89. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/cp/main.py +0 -0
  90. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/cp/utils.py +0 -0
  91. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/execute/__init__.py +0 -0
  92. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/execute/main.py +0 -0
  93. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/execute/utils.py +0 -0
  94. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/get.py +0 -0
  95. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/get_executions.py +0 -0
  96. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/get_params.py +0 -0
  97. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/__init__.py +0 -0
  98. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/__pycache__/__init__.cpython-310.pyc +0 -0
  99. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/__pycache__/init.cpython-310.pyc +0 -0
  100. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/assemble_and_sort/.env +0 -0
  101. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/assemble_and_sort/LICENSE +0 -0
  102. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/assemble_and_sort/README.md +0 -0
  103. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/assemble_and_sort/__init__.py +0 -0
  104. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/assemble_and_sort/assemble.py +0 -0
  105. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/assemble_and_sort/sort.py +0 -0
  106. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/assemble_and_sort/system-requirements.txt +0 -0
  107. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/common/.dockerignore +0 -0
  108. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_conda/__init__.py +0 -0
  109. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_conda/conda_task.py +0 -0
  110. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_conda/environment.yaml +0 -0
  111. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_docker/__init__.py +0 -0
  112. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_docker/task.py +0 -0
  113. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_nfcore/Dockerfile +0 -0
  114. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_nfcore/__init__.py +0 -0
  115. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_nfcore/task.py +0 -0
  116. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_r/__init__.py +0 -0
  117. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_r/environment.R +0 -0
  118. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_r/r_task.py +0 -0
  119. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_snakemake/.latch/latch_entrypoint +0 -0
  120. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_snakemake/Dockerfile +0 -0
  121. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_snakemake/Snakefile +0 -0
  122. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_snakemake/config.yaml +0 -0
  123. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_snakemake/environment.yaml +0 -0
  124. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_snakemake/latch_metadata.py +0 -0
  125. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_snakemake/scripts/plot-quals.py +0 -0
  126. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/example_snakemake/version +0 -0
  127. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/init.py +0 -0
  128. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/template/LICENSE +0 -0
  129. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/template/README.md +0 -0
  130. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/template/__init__.py +0 -0
  131. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/init/template/task.py +0 -0
  132. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/launch.py +0 -0
  133. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/local_dev.py +0 -0
  134. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/local_dev_old.py +0 -0
  135. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/login.py +0 -0
  136. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/ls.py +0 -0
  137. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/mkdir.py +0 -0
  138. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/move.py +0 -0
  139. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/preview.py +0 -0
  140. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/register/__init__.py +0 -0
  141. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/register/constants.py +0 -0
  142. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/register/register.py +0 -0
  143. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/register/utils.py +0 -0
  144. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/rm.py +0 -0
  145. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/stop_pod.py +0 -0
  146. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/sync.py +0 -0
  147. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/test_data/__init__.py +0 -0
  148. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/test_data/ls.py +0 -0
  149. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/test_data/remove.py +0 -0
  150. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/test_data/upload.py +0 -0
  151. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/test_data/utils.py +0 -0
  152. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/services/workspace.py +0 -0
  153. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/snakemake/__init__.py +0 -0
  154. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/snakemake/config/__init__.py +0 -0
  155. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/snakemake/config/parser.py +0 -0
  156. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/snakemake/config/utils.py +0 -0
  157. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/snakemake/serialize.py +0 -0
  158. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/snakemake/serialize_utils.py +0 -0
  159. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/snakemake/single_task_snakemake.py +0 -0
  160. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/snakemake/utils.py +0 -0
  161. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/snakemake/workflow.py +0 -0
  162. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/tinyrequests.py +0 -0
  163. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/tui/__init__.py +0 -0
  164. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/utils/__init__.py +0 -0
  165. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/utils/path.py +0 -0
  166. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/latch_cli/workflow_config.py +0 -0
  167. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/pyproject.toml +0 -0
  168. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/setup.cfg +0 -0
  169. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/tests/__init__.py +0 -0
  170. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/tests/cp/__init__.py +0 -0
  171. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/tests/fixtures.py +0 -0
  172. {latch-2.45.2.dev1 → latch-2.45.2.dev2}/tests/test_ls.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: latch
3
- Version: 2.45.2.dev1
3
+ Version: 2.45.2.dev2
4
4
  Summary: The Latch SDK
5
5
  Author-email: kenny@latch.bio
6
6
  Classifier: Programming Language :: Python :: 3.8
@@ -1,21 +1,27 @@
1
+ import csv
2
+ import functools
1
3
  import re
2
- from dataclasses import Field, asdict, dataclass, field
4
+ from dataclasses import Field, asdict, dataclass, field, fields, is_dataclass
3
5
  from enum import Enum
4
6
  from pathlib import Path
5
- from textwrap import indent
7
+ from textwrap import dedent, indent
6
8
  from typing import (
7
9
  Any,
10
+ Callable,
8
11
  ClassVar,
9
12
  Collection,
10
13
  Dict,
11
14
  Generic,
12
15
  List,
16
+ Literal,
13
17
  Optional,
14
18
  Protocol,
15
19
  Tuple,
16
20
  Type,
17
21
  TypeVar,
18
22
  Union,
23
+ get_args,
24
+ get_origin,
19
25
  )
20
26
 
21
27
  import click
@@ -477,10 +483,84 @@ class NextflowParameter(Generic[T], LatchParameter):
477
483
  The python type of the parameter.
478
484
  """
479
485
  default: Optional[T] = None
486
+ """
487
+ Default value of the parameter
488
+ """
489
+
490
+ samplesheet_type: Literal["csv", "tsv", None] = None
491
+ """
492
+ The type of samplesheet to construct from the input parameter.
493
+
494
+ Only used if the provided parameter is a samplesheet (samplesheet=True)
495
+ """
496
+ samplesheet_constructor: Optional[Callable[[T], Path]] = None
497
+ """
498
+ A custom samplesheet constructor.
499
+
500
+ Should return the path of the constructed samplesheet. If samplesheet_type is also specified, this takes precedence.
501
+ Only used if the provided parameter is a samplesheet (samplesheet=True)
502
+ """
480
503
 
481
504
  def __post_init__(self):
482
- if self.samplesheet is True:
483
- self.type = Annotated[self.type, "samplesheet"]
505
+ if not self.samplesheet or self.samplesheet_constructor is not None:
506
+ return
507
+
508
+ t = self.type
509
+ if get_origin(t) is not list or not is_dataclass(get_args(t)[0]):
510
+ click.secho(
511
+ dedent("""\
512
+ Samplesheets must be a list of dataclasses.
513
+ """),
514
+ fg="red",
515
+ )
516
+ raise click.exceptions.Exit(1)
517
+
518
+ if self.samplesheet_type is not None:
519
+ delim = "," if self.samplesheet_type == "csv" else "\t"
520
+ self.samplesheet_constructor = functools.partial(
521
+ _samplesheet_constructor, t=get_args(self.type)[0], delim=delim
522
+ )
523
+ return
524
+
525
+ click.secho(
526
+ dedent("""\
527
+ A Samplesheet constructor is required for a samplesheet parameter. Please either provide a value for
528
+ `samplesheet_type` or provide a custom callable to the `samplesheet_constructor` argument.
529
+ """),
530
+ fg="red",
531
+ )
532
+ raise click.exceptions.Exit(1)
533
+
534
+
535
+ DC = TypeVar("DC", bound=_IsDataclass)
536
+
537
+
538
+ def _samplesheet_repr(v: Any) -> str:
539
+ if v is None:
540
+ return ""
541
+ if isinstance(v, LatchFile) or isinstance(v, LatchDir):
542
+ return v.remote_path
543
+ if isinstance(v, Enum):
544
+ return getattr(v, "value")
545
+
546
+ return str(v)
547
+
548
+
549
+ def _samplesheet_constructor(samples: List[DC], t: DC, delim: str = ",") -> Path:
550
+ samplesheet = Path("samplesheet.csv")
551
+
552
+ with open(samplesheet, "w") as f:
553
+ writer = csv.DictWriter(f, [f.name for f in fields(t)], delimiter=delim)
554
+ writer.writeheader()
555
+
556
+ for sample in samples:
557
+ row_data = {
558
+ f.name: _samplesheet_repr(getattr(sample, f.name))
559
+ for f in fields(sample)
560
+ }
561
+ writer.writerow(row_data)
562
+
563
+ return samplesheet
484
564
 
485
565
 
486
566
  @dataclass(frozen=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: latch
3
- Version: 2.45.2.dev1
3
+ Version: 2.45.2.dev2
4
4
  Summary: The Latch SDK
5
5
  Author-email: kenny@latch.bio
6
6
  Classifier: Programming Language :: Python :: 3.8
@@ -1,5 +1,4 @@
1
- import re
2
- from dataclasses import fields, is_dataclass
1
+ from dataclasses import asdict, fields, is_dataclass
3
2
  from enum import Enum
4
3
  from pathlib import Path
5
4
  from typing import Any, List, Optional, Tuple
@@ -37,15 +36,15 @@ from flytekit.core.annotation import FlyteAnnotation
37
36
 
38
37
  import latch_metadata
39
38
 
40
-
41
39
  @custom_task(cpu=0.25, memory=0.5, storage_gib=1)
42
40
  def initialize() -> str:
43
41
  token = os.environ.get("FLYTE_INTERNAL_EXECUTION_ID")
44
42
  if token is None:
45
43
  raise RuntimeError("failed to get execution token")
46
44
 
47
- print("Provisioning shared storage volume...")
48
45
  headers = {{"Authorization": f"Latch-Execution-Token {{token}}"}}
46
+
47
+ print("Provisioning shared storage volume... ", end="")
49
48
  resp = requests.post(
50
49
  "http://nf-dispatcher-service.flyte.svc.cluster.local/provision-storage",
51
50
  headers=headers,
@@ -54,11 +53,14 @@ def initialize() -> str:
54
53
  }}
55
54
  )
56
55
  resp.raise_for_status()
56
+ print("Done.")
57
+
57
58
  return resp.json()["name"]
58
59
 
59
60
 
60
61
  {preambles}
61
62
 
63
+ {samplesheet_constructors}
62
64
 
63
65
  @nextflow_runtime_task(cpu={cpu}, memory={memory})
64
66
  def nextflow_runtime(pvc_name: str, {param_signature}) -> None:
@@ -80,13 +82,15 @@ def nextflow_runtime(pvc_name: str, {param_signature}) -> None:
80
82
  }}
81
83
  subprocess.run(
82
84
  [
83
- "/root/.latch/bin/nextflow",
85
+ "/root/nextflow",
84
86
  "run",
85
87
  str(shared_dir / "{nf_script}"),
86
88
  "-work-dir",
87
89
  str(shared_dir),
88
90
  "-profile",
89
91
  "{execution_profile}",
92
+ "-process.executor",
93
+ "k8s",
90
94
  {params_to_flags}
91
95
  ],
92
96
  env=env,
@@ -94,6 +98,7 @@ def nextflow_runtime(pvc_name: str, {param_signature}) -> None:
94
98
  )
95
99
  except subprocess.CalledProcessError:
96
100
  remote = LPath(urljoins("{remote_output_dir}", _get_execution_name(), "nextflow.log"))
101
+ print()
97
102
  print(f"Uploading .nextflow.log to {{remote.path}}")
98
103
  remote.upload_from(Path("/root/.nextflow.log"))
99
104
  raise
@@ -165,12 +170,10 @@ def generate_nextflow_workflow(
165
170
  resources = metadata._nextflow_metadata.runtime_resources
166
171
 
167
172
  flags = []
168
- for param_name, param in parameters.items():
169
- flags.append(reindent(f"*get_flag({repr(param_name)}, {param_name})", 3))
170
-
171
173
  defaults: List[Tuple[str, str]] = []
172
174
  no_defaults: List[str] = []
173
175
  preambles: List[str] = []
176
+ samplesheet_constructors: List[str] = []
174
177
  for param_name, param in parameters.items():
175
178
  sig = f"{param_name}: {type_repr(param.type)}"
176
179
  if param.default is not None:
@@ -191,6 +194,26 @@ def generate_nextflow_workflow(
191
194
  else:
192
195
  no_defaults.append(sig)
193
196
 
197
+ if param.samplesheet:
198
+ samplesheet_constructors.append(
199
+ reindent(
200
+ f"""
201
+ {param_name}_construct_samplesheet = metadata._nextflow_metadata.parameters[{repr(param_name)}].samplesheet_constructor
202
+ """,
203
+ 0,
204
+ ),
205
+ )
206
+
207
+ flags.append(
208
+ reindent(
209
+ f"*get_flag({repr(param_name)},"
210
+ f" {param_name}_construct_samplesheet({param_name}))",
211
+ 4,
212
+ )
213
+ )
214
+ else:
215
+ flags.append(reindent(f"*get_flag({repr(param_name)}, {param_name})", 4))
216
+
194
217
  preamble = get_preamble(param.type)
195
218
  if len(preamble) > 0:
196
219
  preambles.append(preamble)
@@ -216,6 +239,7 @@ def generate_nextflow_workflow(
216
239
  execution_profile if execution_profile is not None else "standard"
217
240
  ),
218
241
  preambles="\n\n".join(preambles),
242
+ samplesheet_constructors="\n".join(samplesheet_constructors),
219
243
  cpu=resources.cpus,
220
244
  memory=resources.memory,
221
245
  storage_gib=resources.storage_gib,
@@ -227,6 +251,5 @@ def generate_nextflow_workflow(
227
251
  entrypoint_path.write_text(entrypoint)
228
252
 
229
253
  click.secho(
230
- f"Nextflow workflow written to {pkg_root / 'wf' / 'entrypoint.py'}",
231
- fg="green",
254
+ f"Nextflow workflow written to {pkg_root / 'wf' / 'entrypoint.py'}", fg="green"
232
255
  )
@@ -13,7 +13,7 @@ if cur_ver < (3, 8) or cur_ver > (3, 11):
13
13
 
14
14
  setup(
15
15
  name="latch",
16
- version="v2.45.2.dev1",
16
+ version="v2.45.2.dev2",
17
17
  author_email="kenny@latch.bio",
18
18
  description="The Latch SDK",
19
19
  packages=find_packages(),
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes