comparison env/lib/python3.9/site-packages/planemo/options.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 """Click definitions for various shared options and arguments."""
2
3 from __future__ import absolute_import
4
5 import functools
6 import os
7
8 import click
9 from galaxy.tool_util.deps import docker_util
10
11 from .config import planemo_option
12
13
14 def force_option(what="files"):
15 """Annotate click command as consume the -f/--force option."""
16 return planemo_option(
17 "-f",
18 "--force",
19 is_flag=True,
20 help="Overwrite existing %s if present." % what,
21 )
22
23
24 def skip_venv_option():
25 """Annotate click command as consume the --skip_venv option."""
26 return planemo_option(
27 "--skip_venv",
28 is_flag=True,
29 help=("Do not create or source a virtualenv environment for Galaxy, "
30 "this should be used to preserve an externally configured "
31 "virtual environment or conda environment.")
32 )
33
34
35 def skip_client_build_option():
36 """Annotate click command as consume the --skip_client_build option."""
37 return planemo_option(
38 "--skip_client_build",
39 is_flag=True,
40 default=False,
41 help=("Do not build Galaxy client when serving Galaxy.")
42 )
43
44
45 def run_engine_option():
46 """Annotate click command as consume the --engine option."""
47 return planemo_option(
48 "--engine",
49 type=click.Choice(["galaxy", "docker_galaxy", "cwltool", "toil", "external_galaxy"]),
50 default=None,
51 use_global_config=True,
52 help=("Select an engine to run or test artifacts such as tools "
53 "and workflows. Defaults to a local Galaxy, but running Galaxy within "
54 "a Docker container or the CWL reference implementation 'cwltool' and "
55 "'toil' be selected.")
56 )
57
58
59 def non_strict_cwl_option():
60 """Annotate click command as consume the --non_strict_cwl option."""
61 return planemo_option(
62 "--non_strict_cwl",
63 default=False,
64 is_flag=True,
65 help="Disable strict validation of CWL.",
66 )
67
68
69 def serve_engine_option():
70 """Annotate click command as consume the --engine option.
71
72 This variant of the engine command is restricted to engines that can serve Galaxy
73 servers.
74 """
75 return planemo_option(
76 "--engine",
77 type=click.Choice(["galaxy", "docker_galaxy", "external_galaxy"]),
78 default="galaxy",
79 use_global_config=True,
80 use_env_var=True,
81 help=("Select an engine to serve artifacts such as tools "
82 "and workflows. Defaults to a local Galaxy, but running Galaxy within "
83 "a Docker container.")
84 )
85
86
87 def ignore_dependency_problems_option():
88 """Annotate click command as consume the --ignore_dependency_problems option."""
89 return planemo_option(
90 "--ignore_dependency_problems",
91 is_flag=True,
92 default=False,
93 use_global_config=True,
94 help=("When installing shed repositories for workflows, ignore dependency issues. "
95 "These likely indicate a problem but in some cases may not prevent a workflow "
96 "from successfully executing.")
97 )
98
99
100 def cwltool_no_container_option():
101 """Annotate click command as consume the --no_container option.
102
103 This option is for the CWL CLI runner interface.
104 """
105 return planemo_option(
106 "--no-container",
107 "--no_container",
108 is_flag=True,
109 default=False,
110 use_global_config=True,
111 help=("If cwltool engine is used, disable Docker container usage.")
112 )
113
114
115 def test_data_option():
116 """Annotate click command as consume the --test_data option."""
117 return planemo_option(
118 "--test_data",
119 type=click.Path(exists=True, file_okay=False, resolve_path=True),
120 help="test-data directory to for specified tool(s).",
121 )
122
123
124 def extra_tools_option():
125 return planemo_option(
126 "--extra_tools",
127 type=click.Path(exists=True,
128 file_okay=True,
129 dir_okay=True,
130 resolve_path=True),
131 multiple=True,
132 help=("Extra tool sources to include in Galaxy's tool panel (file or "
133 "directory). These will not be linted/tested/etc... but they "
134 "will be available to workflows and for interactive use.")
135 )
136
137
138 def tool_data_table_option():
139 return planemo_option(
140 "--tool_data_table",
141 type=click.Path(exists=True, file_okay=True, resolve_path=True),
142 help="tool_data_table_conf.xml file to for specified tool(s).",
143 )
144
145
146 def galaxy_email_option():
147 return planemo_option(
148 "--galaxy_email",
149 type=str,
150 default="planemo@galaxyproject.org",
151 use_global_config=True,
152 use_env_var=True,
153 help="E-mail address to use when launching single-user Galaxy server.",
154 )
155
156
157 def galaxy_python_version():
158 return planemo_option(
159 '--galaxy_python_version',
160 use_global_config=True,
161 default=None,
162 type=click.Choice(['3', '3.6', '3.7', '3.8', '3.9']),
163 help="Python version to start Galaxy under",
164 )
165
166
167 def galaxy_root_option():
168 return planemo_option(
169 "--galaxy_root",
170 use_global_config=True,
171 extra_global_config_vars=["galaxy_root"],
172 use_env_var=True,
173 type=click.Path(file_okay=False, dir_okay=True, resolve_path=True),
174 help="Root of development galaxy directory to execute command with.",
175 )
176
177
178 def galaxy_cwl_root_option():
179 return planemo_option(
180 "--cwl_galaxy_root",
181 use_global_config=True,
182 extra_global_config_vars=["cwl_galaxy_root"],
183 use_env_var=True,
184 type=click.Path(exists=True, file_okay=False, resolve_path=True),
185 help=("Root of development galaxy directory to execute command with"
186 " (must be branch of Galaxy with CWL support, this option"
187 " is experimental and will be replaced with --galaxy_root when"
188 " and if CWL support is merged into Galaxy."),
189 )
190
191
192 def galaxy_port_option():
193 return planemo_option(
194 "--port",
195 type=int,
196 default="9090",
197 use_global_config=True,
198 help="Port to serve Galaxy on (default is 9090).",
199 )
200
201
202 def galaxy_host_option():
203 return planemo_option(
204 "--host",
205 type=str,
206 default="127.0.0.1",
207 use_global_config=True,
208 help=("Host to bind Galaxy to. Default is 127.0.0.1 that is "
209 "restricted to localhost connections for security reasons "
210 "set to 0.0.0.0 to bind Galaxy to all ports including "
211 "potentially publicly accessible ones."),
212 )
213
214
215 def dependency_resolvers_option():
216 return planemo_option(
217 "--dependency_resolvers_config_file",
218 type=click.Path(
219 exists=True,
220 file_okay=True,
221 dir_okay=False,
222 resolve_path=True
223 ),
224 use_global_config=True,
225 help="Dependency resolver configuration for Galaxy to target.",
226 )
227
228
229 def enable_cwl_option():
230 return planemo_option(
231 "--cwl",
232 is_flag=True,
233 help=("Configure Galaxy for use with CWL tool."
234 " (this option is experimental and will be replaced when"
235 " and if CWL support is merged into Galaxy)."),
236 )
237
238
239 def build_cwl_option():
240 return planemo_option(
241 "--cwl",
242 is_flag=True,
243 help="Build a CWL tool instead of a Galaxy tool.",
244 )
245
246
247 def run_output_directory_option():
248 return planemo_option(
249 "output_directory",
250 "--output_directory",
251 "--outdir",
252 type=click.Path(
253 file_okay=False,
254 dir_okay=True,
255 resolve_path=True,
256 ),
257 default=None,
258 help=("Where to store outputs of a 'run' task."),
259 )
260
261
262 def run_output_json_option():
263 return planemo_option(
264 "output_json",
265 "--output_json",
266 type=click.Path(
267 file_okay=True,
268 dir_okay=False,
269 resolve_path=True,
270 ),
271 default=None,
272 help=("Where to store JSON dictionary describing outputs of "
273 "a 'run' task."),
274 )
275
276
277 def no_dependency_resolution():
278 return planemo_option(
279 "--no_dependency_resolution",
280 is_flag=True,
281 help="Configure Galaxy with no dependency resolvers.",
282 )
283
284
285 def brew_dependency_resolution():
286 return planemo_option(
287 "--brew_dependency_resolution",
288 is_flag=True,
289 help="Configure Galaxy to use plain brew dependency resolution.",
290 )
291
292
293 def conda_dependency_resolution():
294 return planemo_option(
295 "--conda_dependency_resolution",
296 is_flag=True,
297 help="Configure Galaxy to use only conda for dependency resolution.",
298 )
299
300
301 def shed_dependency_resolution():
302 return planemo_option(
303 "--shed_dependency_resolution",
304 is_flag=True,
305 help=("Configure Galaxy to use brewed Tool Shed dependency"
306 " resolution."),
307 )
308
309
310 def file_path_option():
311 return planemo_option(
312 "--file_path",
313 type=click.Path(
314 file_okay=False,
315 dir_okay=True,
316 resolve_path=True
317 ),
318 help="Location for files created by Galaxy (e.g. database/files).",
319 default=None,
320 use_global_config=True,
321 )
322
323
324 def database_connection_option():
325 return planemo_option(
326 "--database_connection",
327 type=str,
328 help="Database connection string to use for Galaxy.",
329 default=None,
330 use_global_config=True,
331 )
332
333
334 def shed_tools_conf_option():
335 return planemo_option(
336 "--shed_tool_conf",
337 type=str,
338 help="Location of shed tools conf file for Galaxy.",
339 default=None,
340 use_global_config=True,
341 )
342
343
344 def shed_tools_directory_option():
345 return planemo_option(
346 "--shed_tool_path",
347 type=str,
348 help="Location of shed tools directory for Galaxy.",
349 default=None,
350 use_global_config=True,
351 )
352
353
354 def tool_dependency_dir_option():
355 return planemo_option(
356 "--tool_dependency_dir",
357 type=click.Path(
358 exists=True,
359 file_okay=False,
360 dir_okay=True,
361 resolve_path=True
362 ),
363 default=None,
364 use_global_config=True,
365 help="Tool dependency dir for Galaxy to target.",
366 )
367
368
369 def job_config_option():
370 return planemo_option(
371 "--job_config_file",
372 type=click.Path(
373 exists=True,
374 file_okay=True,
375 dir_okay=False,
376 resolve_path=True
377 ),
378 help="Job configuration file for Galaxy to target.",
379 default=None,
380 use_global_config=True,
381 )
382
383
384 def mulled_containers_option():
385 return planemo_option(
386 "mulled_containers",
387 "--mulled_containers",
388 "--biocontainers",
389 is_flag=True,
390 help="Test tools against mulled containers (forces --docker).",
391 )
392
393
394 def install_galaxy_option():
395 return planemo_option(
396 "--install_galaxy",
397 is_flag=True,
398 help="Download and configure a disposable copy of Galaxy from github."
399 )
400
401
402 def docker_galaxy_image_option():
403 return planemo_option(
404 "--docker_galaxy_image",
405 default="quay.io/bgruening/galaxy",
406 use_global_config=True,
407 help=("Docker image identifier for docker-galaxy-flavor used if "
408 "engine type is specified as ``docker-galaxy``. Defaults to "
409 "quay.io/bgruening/galaxy.")
410 )
411
412
413 def docker_extra_volume_option():
414 arg_type = click.Path(
415 exists=True,
416 file_okay=True,
417 dir_okay=True,
418 readable=True,
419 resolve_path=True,
420 )
421 return planemo_option(
422 "--docker_extra_volume",
423 type=arg_type,
424 default=None,
425 use_global_config=True,
426 help=("Extra path to mount if --engine docker.")
427 )
428
429
430 def galaxy_url_option():
431 return planemo_option(
432 "--galaxy_url",
433 use_global_config=True,
434 extra_global_config_vars=["galaxy_url"],
435 use_env_var=True,
436 type=str,
437 help="Remote Galaxy URL to use with external Galaxy engine.",
438 )
439
440
441 def galaxy_admin_key_option():
442 return planemo_option(
443 "--galaxy_admin_key",
444 use_global_config=True,
445 extra_global_config_vars=["admin_key"],
446 use_env_var=True,
447 type=str,
448 help="Admin key to use with external Galaxy engine.",
449 )
450
451
452 def galaxy_user_key_option():
453 return planemo_option(
454 "--galaxy_user_key",
455 use_global_config=True,
456 extra_global_config_vars=["admin_key"],
457 use_env_var=True,
458 type=str,
459 help="User key to use with external Galaxy engine.",
460 )
461
462
463 def history_name():
464 return planemo_option(
465 "--history_name",
466 type=str,
467 help="Name to give a Galaxy history, if one is created.",
468 )
469
470
471 def no_cache_galaxy_option():
472 return planemo_option(
473 "--no_cache_galaxy",
474 is_flag=True,
475 help=("Skip caching of Galaxy source and dependencies obtained with "
476 "--install_galaxy. Not caching this results in faster "
477 "downloads (no git) - so is better on throw away instances such "
478 "with TravisCI. ")
479 )
480
481
482 def galaxy_branch_option():
483 return planemo_option(
484 "--galaxy_branch",
485 default=None,
486 use_global_config=True,
487 use_env_var=True,
488 help=("Branch of Galaxy to target (defaults to master) if a Galaxy "
489 "root isn't specified.")
490 )
491
492
493 def galaxy_source_option():
494 return planemo_option(
495 "--galaxy_source",
496 default=None,
497 use_global_config=True,
498 help=("Git source of Galaxy to target (defaults to the official "
499 "galaxyproject github source if a Galaxy root isn't "
500 "specified.")
501 )
502
503
504 def skip_install_option():
505 return planemo_option(
506 "--skip_install",
507 is_flag=True,
508 help="Skip installation - only source requirements already available."
509 )
510
511
512 def brew_option():
513 return planemo_option(
514 "--brew",
515 use_global_config=True,
516 type=click.Path(exists=True, file_okay=True, dir_okay=False),
517 help="Homebrew 'brew' executable to use."
518 )
519
520
521 def conda_prefix_option():
522 return planemo_option(
523 "--conda_prefix",
524 use_global_config=True,
525 use_env_var=True,
526 type=click.Path(file_okay=False, dir_okay=True),
527 help="Conda prefix to use for conda dependency commands."
528 )
529
530
531 def conda_exec_option():
532 return planemo_option(
533 "--conda_exec",
534 use_global_config=True,
535 type=click.Path(exists=True, file_okay=True, dir_okay=False),
536 help="Location of conda executable."
537 )
538
539
540 def conda_debug_option():
541 return planemo_option(
542 "--conda_debug",
543 is_flag=True,
544 help="Enable more verbose conda logging."
545 )
546
547
548 def conda_use_local_option():
549 return planemo_option(
550 "--conda_use_local",
551 is_flag=True,
552 help="Use locally built packages while building Conda environments."
553 )
554
555
556 def conda_ensure_channels_option():
557 return planemo_option(
558 "conda_ensure_channels",
559 "--conda_channels",
560 "--conda_ensure_channels",
561 type=str,
562 use_global_config=True,
563 use_env_var=True,
564 help=("Ensure conda is configured with specified comma separated "
565 "list of channels."),
566 default="iuc,conda-forge,bioconda,defaults",
567 )
568
569
570 def conda_copy_dependencies_option():
571 return planemo_option(
572 "--conda_copy_dependencies",
573 is_flag=True,
574 help=("Conda dependency resolution for Galaxy will copy dependencies "
575 "instead of attempting to link them.")
576 )
577
578
579 def conda_auto_install_option():
580 return planemo_option(
581 "--conda_auto_install/--no_conda_auto_install",
582 is_flag=True,
583 default=True,
584 help=("Conda dependency resolution for Galaxy will attempt to install "
585 "requested but missing packages.")
586 )
587
588
589 def conda_auto_init_option():
590 return planemo_option(
591 "--conda_auto_init/--no_conda_auto_init",
592 is_flag=True,
593 default=True,
594 help=("Conda dependency resolution for Galaxy will auto install "
595 "conda itself using miniconda if not availabe on conda_prefix.")
596 )
597
598
599 def conda_global_option():
600 return planemo_option(
601 "--global",
602 is_flag=True,
603 default=False,
604 help=("Install Conda dependencies globally instead of in requirement specific "
605 "environments packaged for tools. If the Conda bin directory is on your "
606 "PATH, tools may still use binaries but this is more designed for "
607 "interactive testing and debugging.")
608 )
609
610
611 def required_tool_arg(allow_uris=False):
612 """ Decorate click method as requiring the path to a single tool.
613 """
614 arg_type_class = click.Path if not allow_uris else UriLike
615 arg_type = arg_type_class(
616 exists=True,
617 file_okay=True,
618 dir_okay=False,
619 readable=True,
620 resolve_path=True,
621 )
622 if allow_uris:
623 name = "uri"
624 metavar = "TOOL_URI"
625 else:
626 name = "path"
627 metavar = "TOOL_PATH"
628 return click.argument(name, metavar=metavar, type=arg_type)
629
630
631 def paste_test_data_paths_option():
632 return planemo_option(
633 "--paste_test_data_paths/--no_paste_test_data_paths",
634 is_flag=True,
635 default=None,
636 help=("By default Planemo will use or not use Galaxy's path paste option to load "
637 "test data into a history based on the engine type it is targeting. This can "
638 "override the logic to explicitly enable or disable path pasting.")
639 )
640
641
642 def shed_install_option():
643 return planemo_option(
644 "--shed_install/--no_shed_install",
645 is_flag=True,
646 default=True,
647 help=("By default Planemo will attempt to install repositories needed for workflow "
648 "testing. This may not be appropriate for production servers and so this can "
649 "disabled by calling planemo with --no_shed_install.")
650 )
651
652
653 def install_tool_dependencies_option():
654 return planemo_option(
655 "--install_tool_dependencies/--no_install_tool_dependencies",
656 is_flag=True,
657 default=False,
658 help=("Turn on installation of tool dependencies using classic toolshed packages.")
659 )
660
661
662 def install_resolver_dependencies_option():
663 return planemo_option(
664 "--install_resolver_dependencies/--no_install_resolver_dependencies",
665 is_flag=True,
666 default=True,
667 help=("Skip installing tool dependencies through resolver (e.g. conda).")
668 )
669
670
671 def install_repository_dependencies_option():
672 return planemo_option(
673 "--install_repository_dependencies/--no_install_repository_dependencies",
674 is_flag=True,
675 default=True,
676 help=("Skip installing the repository dependencies.")
677 )
678
679
680 def single_user_mode_option():
681 return planemo_option(
682 "galaxy_single_user",
683 "--galaxy_single_user/--no_galaxy_single_user",
684 is_flag=True,
685 default=True,
686 help=("By default Planemo will configure Galaxy to run in single-user mode where there "
687 "is just one user and this user is automatically logged it. Use --no_galaxy_single_user "
688 "to prevent Galaxy from running this way.")
689 )
690
691
692 def required_workflow_arg():
693 return click.argument(
694 'workflow_identifier',
695 metavar="WORKFLOW_PATH_OR_ID",
696 type=str,
697 )
698
699
700 def split_job_and_test():
701 return click.option("--split_test/--no_split_test", default=False, help="Write workflow job and test definitions to separate files.")
702
703
704 def required_job_arg():
705 """Decorate click method as requiring the path to a single tool.
706 """
707 arg_type = click.Path(
708 exists=True,
709 file_okay=True,
710 dir_okay=False,
711 readable=True,
712 resolve_path=False,
713 )
714 return click.argument("job_path", metavar="JOB_PATH", type=arg_type)
715
716
717 def required_runnable_arg():
718 return click.argument(
719 'runnable_identifier',
720 metavar="RUNNABLE_PATH_OR_ID",
721 type=str,
722 )
723
724
725 def _optional_tools_default(ctx, param, value):
726 if param.name in ["paths", "uris"] and len(value) == 0:
727 return [os.path.abspath(os.getcwd())]
728 else:
729 return value
730
731
732 def optional_tools_or_packages_arg(multiple=False):
733 """ Decorate click method as optionally taking in the path to a tool
734 or directory of tools or a Conda package. If no such argument is given
735 the current working directory will be treated as a directory of tools.
736 """
737 name = "paths" if multiple else "path"
738 nargs = -1 if multiple else 1
739 return click.argument(
740 name,
741 metavar="TARGET",
742 nargs=nargs,
743 )
744
745
746 class UriLike(click.Path):
747
748 def convert(self, value, param, ctx):
749 if "://" in value:
750 return value
751 else:
752 return super(UriLike, self).convert(value, param, ctx)
753
754
755 def optional_tools_arg(multiple=False, allow_uris=False):
756 """ Decorate click method as optionally taking in the path to a tool
757 or directory of tools. If no such argument is given the current working
758 directory will be treated as a directory of tools.
759 """
760 arg_type_class = click.Path if not allow_uris else UriLike
761 arg_type = arg_type_class(
762 exists=True,
763 file_okay=True,
764 dir_okay=True,
765 readable=True,
766 resolve_path=True,
767 )
768 if allow_uris:
769 name = "uris" if multiple else "uri"
770 else:
771 name = "paths" if multiple else "path"
772 nargs = -1 if multiple else 1
773 return click.argument(
774 name,
775 metavar="TOOL_PATH",
776 type=arg_type,
777 nargs=nargs,
778 callback=_optional_tools_default,
779 )
780
781
782 class ProjectOrRepositry(click.Path):
783
784 def __init__(self, **kwds):
785 super(ProjectOrRepositry, self).__init__(**kwds)
786
787 def convert(self, value, param, ctx):
788 if value and value.startswith("git:") or value.startswith("git+"):
789 return value
790 else:
791 return super(ProjectOrRepositry, self).convert(value, param, ctx)
792
793
794 def shed_project_arg(multiple=True):
795 arg_type = ProjectOrRepositry(
796 exists=True,
797 file_okay=False,
798 dir_okay=True,
799 resolve_path=True,
800 )
801 name = "paths" if multiple else "path"
802 nargs = -1 if multiple else 1
803 return click.argument(
804 name,
805 metavar="PROJECT",
806 type=arg_type,
807 nargs=nargs,
808 callback=_optional_tools_default,
809 )
810
811
812 def recipe_arg(multiple=True):
813 name = "paths" if multiple else "path"
814 nargs = -1 if multiple else 1
815 return click.argument(
816 name,
817 metavar="RECIPE_DIR",
818 type=click.Path(
819 exists=True,
820 file_okay=True,
821 dir_okay=True,
822 resolve_path=True,
823 ),
824 nargs=nargs,
825 callback=_optional_tools_default,
826 )
827
828
829 def optional_project_arg(exists=True, default="."):
830 arg_type = click.Path(
831 exists=exists,
832 file_okay=False,
833 dir_okay=True,
834 writable=True,
835 resolve_path=True,
836 )
837 return click.argument(
838 "path",
839 metavar="PROJECT",
840 default=default,
841 type=arg_type
842 )
843
844
845 def no_cleanup_option():
846 return planemo_option(
847 "--no_cleanup",
848 is_flag=True,
849 help=("Do not cleanup temp files created for and by Galaxy.")
850 )
851
852
853 def docker_enable_option():
854 return planemo_option(
855 "--docker/--no_docker",
856 default=False,
857 help=("Run Galaxy tools in Docker if enabled.")
858 )
859
860
861 def docker_cmd_option():
862 return planemo_option(
863 "--docker_cmd",
864 default=docker_util.DEFAULT_DOCKER_COMMAND,
865 help="Command used to launch docker (defaults to docker)."
866 )
867
868
869 def docker_sudo_option():
870 return planemo_option(
871 "--docker_sudo/--no_docker_sudo",
872 is_flag=True,
873 help="Flag to use sudo when running docker."
874 )
875
876
877 def docker_sudo_cmd_option():
878 return planemo_option(
879 "--docker_sudo_cmd",
880 help="sudo command to use when --docker_sudo is enabled " +
881 "(defaults to sudo).",
882 default=docker_util.DEFAULT_SUDO_COMMAND,
883 use_global_config=True,
884 )
885
886
887 def docker_host_option():
888 return planemo_option(
889 "--docker_host",
890 help="Docker host to target when executing docker commands " +
891 "(defaults to localhost).",
892 use_global_config=True,
893 default=docker_util.DEFAULT_HOST,
894 )
895
896
897 def docker_config_options():
898 return _compose(
899 docker_cmd_option(),
900 docker_sudo_option(),
901 docker_host_option(),
902 docker_sudo_cmd_option(),
903 )
904
905
906 def galaxy_docker_options():
907 return _compose(
908 docker_enable_option(),
909 docker_config_options(),
910 )
911
912
913 def shed_owner_option():
914 return planemo_option(
915 "--owner",
916 help="Tool Shed repository owner (username)."
917 )
918
919
920 def shed_name_option():
921 return planemo_option(
922 "--name",
923 help="Tool Shed repository name (defaults to the inferred "
924 "tool directory name)."
925 )
926
927
928 def validate_shed_target_callback(ctx, param, value):
929 if value is None:
930 ctx.fail("default_shed_target set to None, must specify a value for "
931 "--shed_target to run this command.")
932 return value
933
934
935 def shed_target_option():
936 return planemo_option(
937 "-t",
938 "--shed_target",
939 help="Tool Shed to target (this can be 'toolshed', 'testtoolshed', "
940 "'local' (alias for http://localhost:9009/), an arbitrary url "
941 "or mappings defined ~/.planemo.yml.",
942 default=None,
943 use_global_config=True,
944 callback=validate_shed_target_callback,
945 )
946
947
948 def shed_key_option():
949 return planemo_option(
950 "--shed_key",
951 help=("API key for Tool Shed access. An API key is required unless "
952 "e-mail and password is specified. This key can be specified "
953 "with either --shed_key or --shed_key_from_env.")
954 )
955
956
957 def shed_key_from_env_option():
958 return planemo_option(
959 "--shed_key_from_env",
960 help="Environment variable to read API key for Tool Shed access from."
961 )
962
963
964 def shed_email_option():
965 return planemo_option(
966 "--shed_email",
967 help="E-mail for Tool Shed auth (required unless shed_key is "
968 "specified)."
969 )
970
971
972 def shed_password_option():
973 return planemo_option(
974 "--shed_password",
975 help="Password for Tool Shed auth (required unless shed_key is "
976 "specified)."
977 )
978
979
980 def shed_skip_upload():
981 return planemo_option(
982 "--skip_upload",
983 is_flag=True,
984 help=("Skip upload contents as part of operation, only update "
985 "metadata.")
986 )
987
988
989 def shed_skip_metadata():
990 return planemo_option(
991 "--skip_metadata",
992 is_flag=True,
993 help=("Skip metadata update as part of operation, only upload "
994 "new contents.")
995 )
996
997
998 def shed_message_option():
999 return planemo_option(
1000 "-m",
1001 "--message",
1002 help="Commit message for tool shed upload."
1003 )
1004
1005
1006 def shed_force_create_option():
1007 return planemo_option(
1008 "--force_repository_creation",
1009 help=("If a repository cannot be found for the specified user/repo "
1010 "name pair, then automatically create the repository in the "
1011 "toolshed."),
1012 is_flag=True,
1013 default=False
1014 )
1015
1016
1017 def shed_check_diff_option():
1018 return planemo_option(
1019 "--check_diff",
1020 is_flag=True,
1021 help=("Skip uploading if the shed_diff detects there would be no "
1022 "'difference' (only attributes populated by the shed would "
1023 "be updated.)")
1024 )
1025
1026
1027 def shed_upload_options():
1028 return _compose(
1029 shed_message_option(),
1030 shed_force_create_option(),
1031 shed_check_diff_option(),
1032 )
1033
1034
1035 def shed_realization_options():
1036 return _compose(
1037 shed_project_arg(multiple=True),
1038 recursive_shed_option(),
1039 shed_fail_fast_option(),
1040 )
1041
1042
1043 def shed_repo_options():
1044 return _compose(
1045 shed_owner_option(),
1046 shed_name_option(),
1047 )
1048
1049
1050 def shed_publish_options():
1051 """ Common options for commands that require publishing to a
1052 a shed.
1053 """
1054 return _compose(
1055 shed_realization_options(),
1056 shed_repo_options(),
1057 shed_target_options(),
1058 )
1059
1060
1061 def shed_read_options():
1062 """ Common options that require read access to mapped repositories
1063 in a shed.
1064 """
1065 return _compose(
1066 shed_realization_options(),
1067 shed_repo_options(),
1068 shed_target_options(),
1069 )
1070
1071
1072 def shed_target_options():
1073 """ Common options for commands that require read-only
1074 interactions with a shed.
1075 """
1076 return _compose(
1077 shed_email_option(),
1078 shed_key_option(),
1079 shed_key_from_env_option(),
1080 shed_password_option(),
1081 shed_target_option(),
1082 )
1083
1084
1085 def conda_target_options(include_local=True):
1086 return _compose(
1087 conda_prefix_option(),
1088 conda_exec_option(),
1089 conda_debug_option(),
1090 conda_ensure_channels_option(),
1091 conda_use_local_option(),
1092 )
1093
1094
1095 def github_namespace():
1096 return planemo_option(
1097 '--namespace',
1098 use_env_var=True,
1099 help=('Organization or username under which to create or update workflow repository. '
1100 'Must be a valid github username or organization'),
1101 default="iwc-workflows"
1102 )
1103
1104
1105 def dry_run():
1106 return planemo_option(
1107 '--dry_run',
1108 help="Don't execute action, show preview of action.",
1109 is_flag=True,
1110 default=False,
1111 )
1112
1113
1114 def galaxy_run_options():
1115 return _compose(
1116 galaxy_target_options(),
1117 galaxy_port_option(),
1118 galaxy_host_option(),
1119 )
1120
1121
1122 def galaxy_config_options():
1123 return _compose(
1124 test_data_option(),
1125 tool_data_table_option(),
1126 dependency_resolvers_option(),
1127 brew_dependency_resolution(),
1128 shed_dependency_resolution(),
1129 no_dependency_resolution(),
1130 conda_target_options(),
1131 conda_dependency_resolution(),
1132 conda_copy_dependencies_option(),
1133 conda_auto_install_option(),
1134 conda_auto_init_option(),
1135 # Profile options...
1136 profile_option(),
1137 profile_database_options(),
1138 file_path_option(),
1139 database_connection_option(),
1140 shed_tools_conf_option(),
1141 shed_tools_directory_option(),
1142 single_user_mode_option(),
1143 )
1144
1145
1146 def galaxy_target_options():
1147 return _compose(
1148 galaxy_root_option(),
1149 galaxy_python_version(),
1150 extra_tools_option(),
1151 install_galaxy_option(),
1152 galaxy_branch_option(),
1153 galaxy_source_option(),
1154 skip_venv_option(),
1155 no_cache_galaxy_option(),
1156 no_cleanup_option(),
1157 galaxy_email_option(),
1158 galaxy_docker_options(),
1159 mulled_containers_option(),
1160 # Profile options...
1161 job_config_option(),
1162 tool_dependency_dir_option(),
1163 )
1164
1165
1166 def pid_file_option():
1167 pid_file_type = click.Path(
1168 file_okay=True,
1169 dir_okay=False,
1170 resolve_path=True,
1171 )
1172 return planemo_option(
1173 "--pid_file",
1174 type=pid_file_type,
1175 default=None,
1176 help="Location of pid file is executed with --daemon."
1177 )
1178
1179
1180 def daemon_option():
1181 return planemo_option(
1182 "--daemon",
1183 is_flag=True,
1184 help="Serve Galaxy process as a daemon."
1185 )
1186
1187
1188 def profile_option(required=False):
1189 return planemo_option(
1190 "--profile",
1191 type=click.STRING,
1192 required=required,
1193 default=None,
1194 help=("Name of profile (created with the profile_create command) to use "
1195 "with this command.")
1196 )
1197
1198
1199 def alias_option(required=False):
1200 return planemo_option(
1201 "--alias",
1202 type=click.STRING,
1203 required=required,
1204 default=None,
1205 help=("Name of an alias.")
1206 )
1207
1208
1209 def galaxy_serve_options():
1210 return _compose(
1211 galaxy_run_options(),
1212 serve_engine_option(),
1213 non_strict_cwl_option(),
1214 docker_galaxy_image_option(),
1215 docker_extra_volume_option(),
1216 galaxy_config_options(),
1217 daemon_option(),
1218 pid_file_option(),
1219 ignore_dependency_problems_option(),
1220 skip_client_build_option(),
1221 shed_install_option()
1222 )
1223
1224
1225 def training_topic_name_option():
1226 return planemo_option(
1227 "--topic_name",
1228 required=True,
1229 help="Name (directory name) of the topic to create or in which "
1230 "a tutorial should be created or updates"
1231 )
1232
1233
1234 def training_topic_option():
1235 return _compose(
1236 training_topic_name_option(),
1237 planemo_option(
1238 "--topic_title",
1239 default="Title of the topic",
1240 help="Title of the topic to create"),
1241 planemo_option(
1242 "--topic_summary",
1243 default="Summary of the topic",
1244 help="Summary of the topic"),
1245 planemo_option(
1246 "--topic_target",
1247 type=click.Choice(['use', 'admin-dev', 'instructors']),
1248 default="use",
1249 help="Target audience for the topic")
1250 )
1251
1252
1253 def training_tutorial_name_option():
1254 return planemo_option(
1255 "--tutorial_name",
1256 help="Name (directory name) of the tutorial to create or to modify"
1257 )
1258
1259
1260 def training_tutorial_name_req_option():
1261 return planemo_option(
1262 "--tutorial_name",
1263 required=True,
1264 help="Name (directory name) of the tutorial to modify"
1265 )
1266
1267
1268 def training_datatype_option():
1269 return planemo_option(
1270 "--datatypes",
1271 type=click.Path(file_okay=True, resolve_path=True),
1272 help="YAML file with the correspondance between Zenodo extension and Galaxy datatypes",
1273 default="shared/datatypes.yaml"
1274 )
1275
1276
1277 def training_zenodo_option():
1278 return planemo_option(
1279 "--zenodo_link",
1280 help="Zenodo URL with the input data")
1281
1282
1283 def training_tutorial_worflow_option():
1284 return _compose(
1285 planemo_option(
1286 "--workflow",
1287 type=click.Path(file_okay=True, resolve_path=True),
1288 help="Workflow of the tutorial (locally)",
1289 default=None),
1290 planemo_option(
1291 "--galaxy_url",
1292 help="URL of a Galaxy instance with the workflow"),
1293 planemo_option(
1294 "--galaxy_api_key",
1295 help="API key on the Galaxy instance with the workflow"),
1296 planemo_option(
1297 "--workflow_id",
1298 help="ID of the workflow on the Galaxy instance")
1299 )
1300
1301
1302 def training_tutorial_option():
1303 return _compose(
1304 training_tutorial_name_option(),
1305 planemo_option(
1306 "--tutorial_title",
1307 default="Title of the tutorial",
1308 help="Title of the tutorial"),
1309 planemo_option(
1310 "--hands_on",
1311 is_flag=True,
1312 default=True,
1313 help="Add hands-on for the new tutorial"),
1314 planemo_option(
1315 "--slides",
1316 is_flag=True,
1317 default=False,
1318 help="Add slides for the new tutorial"),
1319 training_tutorial_worflow_option(),
1320 training_zenodo_option()
1321 )
1322
1323
1324 def training_init_options():
1325 return _compose(
1326 training_topic_option(),
1327 training_tutorial_option(),
1328 training_datatype_option()
1329 )
1330
1331
1332 def training_fill_data_library_options():
1333 return _compose(
1334 training_topic_name_option(),
1335 training_tutorial_name_req_option(),
1336 training_zenodo_option(),
1337 training_datatype_option()
1338 )
1339
1340
1341 def training_generate_tuto_from_wf_options():
1342 return _compose(
1343 training_topic_name_option(),
1344 training_tutorial_name_req_option(),
1345 training_tutorial_worflow_option()
1346 )
1347
1348
1349 def shed_fail_fast_option():
1350 return planemo_option(
1351 "--fail_fast",
1352 is_flag=True,
1353 default=False,
1354 help="If multiple repositories are specified and an error occurs "
1355 "stop immediately instead of processing remaining repositories."
1356 )
1357
1358
1359 def lint_xsd_option():
1360 return planemo_option(
1361 "--xsd/--no_xsd",
1362 is_flag=True,
1363 default=True,
1364 help=("Include tool XSD validation in linting process.")
1365 )
1366
1367
1368 def report_level_option():
1369 return planemo_option(
1370 "--report_level",
1371 type=click.Choice(["all", "warn", "error"]),
1372 default="all",
1373 )
1374
1375
1376 def report_xunit():
1377 return planemo_option(
1378 "--report_xunit",
1379 type=click.Path(file_okay=True, resolve_path=True),
1380 help="Output an XUnit report, useful for CI testing",
1381 default=None,
1382 )
1383
1384
1385 def skip_option():
1386 return planemo_option(
1387 "-s",
1388 "--skip",
1389 default=None,
1390 help=("Comma-separated list of lint tests to skip (e.g. passing "
1391 "--skip 'citations,xml_order' would skip linting of citations "
1392 "and best-practice XML ordering.")
1393 )
1394
1395
1396 def fail_level_option():
1397 return planemo_option(
1398 "--fail_level",
1399 type=click.Choice(['warn', 'error']),
1400 default="warn"
1401 )
1402
1403
1404 def recursive_shed_option():
1405 return recursive_option(
1406 "Recursively perform command for nested repository directories.",
1407 )
1408
1409
1410 def recursive_option(help="Recursively perform command for subdirectories."):
1411 return planemo_option(
1412 "-r",
1413 "--recursive",
1414 is_flag=True,
1415 help=help,
1416 )
1417
1418
1419 def merge_test_json():
1420 target_path = click.Path(
1421 file_okay=True,
1422 dir_okay=False,
1423 resolve_path=True,
1424 )
1425 return click.argument(
1426 'input_paths',
1427 metavar="INPUT_PATHS",
1428 type=target_path,
1429 nargs=-1,
1430 )
1431
1432
1433 def tool_test_json(var="path"):
1434 target_path = click.Path(
1435 file_okay=True,
1436 dir_okay=False,
1437 resolve_path=True,
1438 )
1439 return click.argument(
1440 var,
1441 metavar="FILE_PATH",
1442 type=target_path,
1443 default="tool_test_output.json",
1444 )
1445
1446
1447 def engine_options():
1448 return _compose(
1449 run_engine_option(),
1450 non_strict_cwl_option(),
1451 cwltool_no_container_option(),
1452 docker_galaxy_image_option(),
1453 docker_extra_volume_option(),
1454 ignore_dependency_problems_option(),
1455 shed_install_option(),
1456 install_tool_dependencies_option(),
1457 install_resolver_dependencies_option(),
1458 install_repository_dependencies_option(),
1459 galaxy_url_option(),
1460 galaxy_admin_key_option(),
1461 galaxy_user_key_option(),
1462 history_name()
1463 )
1464
1465
1466 def test_report_options():
1467 return _compose(
1468 planemo_option(
1469 "--test_output",
1470 type=click.Path(file_okay=True, resolve_path=True),
1471 use_global_config=True,
1472 default="tool_test_output.html",
1473 help=("Output test report (HTML - for humans) defaults to "
1474 "tool_test_output.html."),
1475 ),
1476 planemo_option(
1477 "--test_output_text",
1478 type=click.Path(file_okay=True, resolve_path=True),
1479 use_global_config=True,
1480 help=("Output test report (Basic text - for display in CI)"),
1481 default=None,
1482 ),
1483 planemo_option(
1484 "--test_output_markdown",
1485 type=click.Path(file_okay=True, resolve_path=True),
1486 use_global_config=True,
1487 help=("Output test report (Markdown style - for humans & "
1488 "computers)"),
1489 default=None,
1490 ),
1491 planemo_option(
1492 "--test_output_xunit",
1493 type=click.Path(file_okay=True, resolve_path=True),
1494 use_global_config=True,
1495 help=("Output test report (xunit style - for CI systems"),
1496 default=None,
1497 ),
1498 planemo_option(
1499 "--test_output_junit",
1500 type=click.Path(file_okay=True, resolve_path=True),
1501 use_global_config=True,
1502 help=("Output test report (jUnit style - for CI systems"),
1503 default=None,
1504 ),
1505 planemo_option(
1506 "--test_output_allure",
1507 type=click.Path(file_okay=False, resolve_path=True),
1508 use_global_config=True,
1509 help=("Output test allure2 framework resutls"),
1510 default=None,
1511 )
1512 )
1513
1514
1515 def profile_name_argument():
1516 return click.argument(
1517 'profile_name',
1518 metavar="PROFILE_NAME",
1519 type=str,
1520 )
1521
1522
1523 def database_identifier_argument():
1524 return click.argument(
1525 'identifier',
1526 metavar="IDENTIFIER",
1527 type=str,
1528 )
1529
1530
1531 def postgres_datatype_type_option():
1532 return planemo_option(
1533 "--postgres",
1534 "database_type",
1535 flag_value="postgres",
1536 help=("Use postgres database type."),
1537 )
1538
1539
1540 def database_type_option():
1541 return planemo_option(
1542 "--database_type",
1543 default="auto",
1544 type=click.Choice([
1545 "postgres",
1546 "postgres_docker",
1547 "sqlite",
1548 "auto",
1549 ]),
1550 use_global_config=True,
1551 help=("Type of database to use for profile - "
1552 "'auto', 'sqlite', 'postgres', and 'postgres_docker' are available options. "
1553 "Use postgres to use an existing postgres server you user can "
1554 "access without a password via the psql command. Use postgres_docker "
1555 "to have Planemo manage a docker container running postgres. "
1556 "Data with postgres_docker is not yet persisted past when you restart "
1557 "the docker container launched by Planemo so be careful with this option."),
1558 )
1559
1560
1561 def database_source_options():
1562 """Database connection options for commands that utilize a database."""
1563 return _compose(
1564 planemo_option(
1565 "--postgres_psql_path",
1566 default="psql",
1567 use_global_config=True,
1568 help=("Name or or path to postgres client binary (psql)."),
1569 ),
1570 planemo_option(
1571 "--postgres_database_user",
1572 default="postgres",
1573 use_global_config=True,
1574 help=("Postgres username for managed development databases."),
1575 ),
1576 planemo_option(
1577 "--postgres_database_host",
1578 default=None,
1579 use_global_config=True,
1580 help=("Postgres host name for managed development databases."),
1581 ),
1582 planemo_option(
1583 "--postgres_database_port",
1584 default=None,
1585 use_global_config=True,
1586 help=("Postgres port for managed development databases."),
1587 ),
1588 )
1589
1590
1591 def profile_database_options():
1592 return _compose(
1593 postgres_datatype_type_option(),
1594 database_type_option(),
1595 database_source_options(),
1596 )
1597
1598
1599 def test_options():
1600 return _compose(
1601 planemo_option(
1602 "--update_test_data",
1603 is_flag=True,
1604 help="Update test-data directory with job outputs (normally"
1605 " written to directory --job_output_files if specified.)"
1606 ),
1607 paste_test_data_paths_option(),
1608 test_report_options(),
1609 planemo_option(
1610 "--test_output_json",
1611 type=click.Path(file_okay=True, resolve_path=True),
1612 use_global_config=True,
1613 help=("Output test report (planemo json) defaults to "
1614 "tool_test_output.json."),
1615 default="tool_test_output.json",
1616 ),
1617 planemo_option(
1618 "--job_output_files",
1619 type=click.Path(file_okay=False, resolve_path=True),
1620 help="Write job outputs to specified directory.",
1621 default=None,
1622 ),
1623 planemo_option(
1624 "--summary",
1625 type=click.Choice(["none", "minimal", "compact"]),
1626 default="minimal",
1627 help=("Summary style printed to planemo's standard output (see "
1628 "output reports for more complete summary). Set to 'none' "
1629 "to disable completely.")
1630 )
1631 )
1632
1633
1634 def _compose(*functions):
1635 def compose2(f, g):
1636 return lambda x: f(g(x))
1637 return functools.reduce(compose2, functions)
1638
1639
1640 def dependencies_script_options():
1641 return _compose(
1642 planemo_option(
1643 "--download_cache",
1644 type=click.Path(file_okay=False, resolve_path=True),
1645 use_global_config=True,
1646 help=("Directory to cache downloaded files, default is $DOWNLOAD_CACHE"),
1647 default=None,
1648 ),
1649 )
1650
1651
1652 def filter_exclude_option():
1653 return planemo_option(
1654 "--exclude",
1655 type=click.Path(resolve_path=False),
1656 multiple=True,
1657 help="Paths to exclude.",
1658 )
1659
1660
1661 def filter_exclude_from_option():
1662 return planemo_option(
1663 "--exclude_from",
1664 type=click.Path(exists=True, file_okay=True, dir_okay=False, resolve_path=True),
1665 multiple=True,
1666 help="File of paths to exclude.",
1667 )
1668
1669
1670 def filter_changed_in_commit_option():
1671 return planemo_option(
1672 "--changed_in_commit_range",
1673 help="Exclude paths unchanged in git commit range.",
1674 )
1675
1676
1677 def ci_chunk_count_option():
1678 return planemo_option(
1679 "--chunk_count",
1680 type=int,
1681 help="Split output into chunks of this many item and print --chunk such group.",
1682 default=1,
1683 )
1684
1685
1686 def ci_group_tools_option():
1687 return planemo_option(
1688 "--group_tools",
1689 is_flag=True,
1690 help="Group tools of the same repository on a single line."
1691 )
1692
1693
1694 def ci_chunk_option():
1695 return planemo_option(
1696 "--chunk",
1697 type=int,
1698 help=("When output is split into --chunk_count groups, output the group 0-indexed"
1699 "by this option."),
1700 default=0,
1701 )
1702
1703
1704 def ci_output_option():
1705 return planemo_option(
1706 "--output",
1707 help="File to output to, or - for standard output.",
1708 default="-",
1709 )
1710
1711
1712 def ci_find_options():
1713 return _compose(
1714 filter_exclude_option(),
1715 filter_exclude_from_option(),
1716 filter_changed_in_commit_option(),
1717 ci_chunk_count_option(),
1718 ci_chunk_option(),
1719 ci_output_option(),
1720 )
1721
1722
1723 def workflow_output_artifact():
1724 return planemo_option(
1725 "-o", "--output",
1726 default=None,
1727 type=click.Path(
1728 file_okay=True,
1729 dir_okay=False,
1730 readable=True,
1731 resolve_path=True,
1732 )
1733 )
1734
1735
1736 def tool_init_id_option(prompt=True):
1737 return planemo_option(
1738 "-i",
1739 "--id",
1740 type=click.STRING,
1741 prompt=prompt,
1742 help="Short identifier for new tool (no whitespace)",
1743 )
1744
1745
1746 def tool_init_tool_option():
1747 return planemo_option(
1748 "-t",
1749 "--tool",
1750 default=None,
1751 type=click.Path(exists=False,
1752 file_okay=True,
1753 dir_okay=False,
1754 writable=True,
1755 resolve_path=True),
1756 help="Output path for new tool (default is <id>.xml)",
1757 )
1758
1759
1760 def tool_init_name_option(prompt=True, help="Name for new tool (user facing)"):
1761 return planemo_option(
1762 "-n",
1763 "--name",
1764 type=click.STRING,
1765 prompt=prompt,
1766 help=help,
1767 )
1768
1769
1770 def tool_init_version_option():
1771 return planemo_option(
1772 "--version",
1773 default="0.1.0",
1774 type=click.STRING,
1775 help="Tool XML version.",
1776 )
1777
1778
1779 def tool_init_description_option():
1780 return planemo_option(
1781 "-d",
1782 "--description",
1783 type=click.STRING,
1784 default=None,
1785 prompt=False,
1786 help="Short description for new tool (user facing)",
1787 )
1788
1789
1790 def tool_init_command_option():
1791 return planemo_option(
1792 "-c",
1793 "--command",
1794 type=click.STRING,
1795 default=None,
1796 prompt=False,
1797 help=("Command potentially including cheetah variables ()"
1798 "(e.g. 'seqtk seq -a $input > $output')"),
1799 )
1800
1801
1802 def tool_init_doi_option():
1803 return planemo_option(
1804 "--doi",
1805 type=click.STRING,
1806 default=None,
1807 multiple=True,
1808 prompt=False,
1809 help=("Supply a DOI (http://www.doi.org/) easing citation of the tool "
1810 "for Galxy users (e.g. 10.1101/014043).")
1811 )
1812
1813
1814 def tool_init_test_case_option():
1815 return planemo_option(
1816 "--test_case",
1817 is_flag=True,
1818 default=None,
1819 prompt=False,
1820 help=("For use with --example_commmand, generate a tool test case from "
1821 "the supplied example."),
1822 )
1823
1824
1825 def tool_init_macros_option():
1826 return planemo_option(
1827 "--macros",
1828 is_flag=True,
1829 default=None,
1830 prompt=False,
1831 help="Generate a macros.xml for reuse across many tools.",
1832 )
1833
1834
1835 def tool_init_cite_url_option():
1836 return planemo_option(
1837 "--cite_url",
1838 type=click.STRING,
1839 default=None,
1840 multiple=True,
1841 prompt=False,
1842 help=("Supply a URL for citation.")
1843 )
1844
1845
1846 def tool_init_input_option():
1847 return planemo_option(
1848 "--input",
1849 type=click.STRING,
1850 default=None,
1851 prompt=False,
1852 multiple=True,
1853 help="An input description (e.g. input.fasta)",
1854 )
1855
1856
1857 def tool_init_output_option():
1858 return planemo_option(
1859 "--output",
1860 type=click.STRING,
1861 multiple=True,
1862 default=None,
1863 prompt=False,
1864 help=("An output location (e.g. output.bam), the Galaxy datatype is "
1865 "inferred from the extension."),
1866 )
1867
1868
1869 def tool_init_help_text_option():
1870 return planemo_option(
1871 "--help_text",
1872 type=click.STRING,
1873 default=None,
1874 prompt=False,
1875 help="Help text (reStructuredText)",
1876 )
1877
1878
1879 def tool_init_help_from_command_option():
1880 return planemo_option(
1881 "--help_from_command",
1882 type=click.STRING,
1883 default=None,
1884 prompt=False,
1885 help="Auto populate help from supplied command.",
1886 )
1887
1888
1889 def tool_init_example_input_option():
1890 return planemo_option(
1891 "--example_input",
1892 type=click.STRING,
1893 default=None,
1894 prompt=False,
1895 multiple=True,
1896 help=("For use with --example_command, replace input file (e.g. 2.fastq "
1897 "with a data input parameter)."),
1898 )
1899
1900
1901 def tool_init_example_output_option():
1902 return planemo_option(
1903 "--example_output",
1904 type=click.STRING,
1905 default=None,
1906 prompt=False,
1907 multiple=True,
1908 help=("For use with --example_command, replace input file (e.g. 2.fastq "
1909 "with a tool output)."),
1910 )
1911
1912
1913 def tool_init_named_output_option():
1914 return planemo_option(
1915 "--named_output",
1916 type=click.STRING,
1917 multiple=True,
1918 default=None,
1919 prompt=False,
1920 help=("Create a named output for use with command block for example "
1921 "specify --named_output=output1.bam and then use '-o $output1' "
1922 "in your command block."),
1923 )
1924
1925
1926 def tool_init_version_command_option():
1927 return planemo_option(
1928 "--version_command",
1929 type=click.STRING,
1930 default=None,
1931 prompt=False,
1932 help="Command to print version (e.g. 'seqtk --version')",
1933 )
1934
1935
1936 REQUIREMENT_HELP = "Add a tool requirement package (e.g. 'seqtk' or 'seqtk@1.68')."
1937
1938
1939 def tool_init_requirement_option(help=REQUIREMENT_HELP):
1940 return planemo_option(
1941 "--requirement",
1942 type=click.STRING,
1943 default=None,
1944 multiple=True,
1945 prompt=False,
1946 help=help,
1947 )
1948
1949
1950 def tool_init_container_option():
1951 return planemo_option(
1952 "--container",
1953 type=click.STRING,
1954 default=None,
1955 multiple=True,
1956 prompt=False,
1957 help="Add a Docker image identifier for this tool."
1958 )
1959
1960
1961 EXAMPLE_COMMAND_HELP = (
1962 "Example to command with paths to build Cheetah template from "
1963 "(e.g. 'seqtk seq -a 2.fastq > 2.fasta'). Option cannot be used "
1964 "with --command, should be used --example_input and "
1965 "--example_output."
1966 )
1967
1968
1969 def tool_init_example_command_option(help=EXAMPLE_COMMAND_HELP):
1970 return planemo_option(
1971 "--example_command",
1972 type=click.STRING,
1973 default=None,
1974 prompt=False,
1975 help=help,
1976 )
1977
1978
1979 def mulled_conda_option():
1980 return planemo_option(
1981 "--mulled_conda_version",
1982 type=click.STRING,
1983 default=None,
1984 help=("Install a specific version of Conda before running the command, by "
1985 "default the version that comes with the continuumio miniconda3 image "
1986 "will be used under Linux and under Mac OS X Conda will be upgraded to "
1987 "to work around a bug in 4.2.")
1988 )
1989
1990
1991 def mulled_namespace_option():
1992 return planemo_option(
1993 "--mulled_namespace",
1994 type=click.STRING,
1995 default="biocontainers",
1996 help=("Build a mulled image with the specified namespace - defaults to "
1997 "biocontainers. Galaxy currently only recognizes images with the "
1998 "namespace biocontainers.")
1999 )
2000
2001
2002 def mulled_action_option():
2003 return planemo_option(
2004 "--mulled_command",
2005 type=click.STRING,
2006 default="build-and-test",
2007 help=("Mulled action to perform for targets - this defaults to 'build-and-test'.")
2008 )
2009
2010
2011 def mulled_options():
2012 return _compose(
2013 mulled_conda_option(),
2014 mulled_namespace_option(),
2015 mulled_action_option(),
2016 )