Skip to content

Commit 8e96864

Browse files
committed
Refactor galaxy modules ....
- planemo.galaxy_test -> planemo.galaxy.test - planemo.galaxy_config -> planemo.galaxy.config - planemo.galaxy_run -> planemo.galaxy.run - planemo.galaxy_serve -> planemo.galaxy.serve
1 parent 2cf30e3 commit 8e96864

24 files changed

+138
-65
lines changed

docs/planemo.galaxy.rst

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
planemo.galaxy package
2+
======================
3+
4+
Subpackages
5+
-----------
6+
7+
.. toctree::
8+
9+
planemo.galaxy.test
10+
11+
Submodules
12+
----------
13+
14+
planemo.galaxy.config module
15+
----------------------------
16+
17+
.. automodule:: planemo.galaxy.config
18+
:members:
19+
:undoc-members:
20+
:show-inheritance:
21+
22+
planemo.galaxy.profiles module
23+
------------------------------
24+
25+
.. automodule:: planemo.galaxy.profiles
26+
:members:
27+
:undoc-members:
28+
:show-inheritance:
29+
30+
planemo.galaxy.run module
31+
-------------------------
32+
33+
.. automodule:: planemo.galaxy.run
34+
:members:
35+
:undoc-members:
36+
:show-inheritance:
37+
38+
planemo.galaxy.serve module
39+
---------------------------
40+
41+
.. automodule:: planemo.galaxy.serve
42+
:members:
43+
:undoc-members:
44+
:show-inheritance:
45+
46+
47+
Module contents
48+
---------------
49+
50+
.. automodule:: planemo.galaxy
51+
:members:
52+
:undoc-members:
53+
:show-inheritance:
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
planemo.galaxy_test package
1+
planemo.galaxy.test package
22
===========================
33

44
Submodules
55
----------
66

7-
planemo.galaxy_test.actions module
7+
planemo.galaxy.test.actions module
88
----------------------------------
99

10-
.. automodule:: planemo.galaxy_test.actions
10+
.. automodule:: planemo.galaxy.test.actions
1111
:members:
1212
:undoc-members:
1313
:show-inheritance:
1414

15-
planemo.galaxy_test.structures module
15+
planemo.galaxy.test.structures module
1616
-------------------------------------
1717

18-
.. automodule:: planemo.galaxy_test.structures
18+
.. automodule:: planemo.galaxy.test.structures
1919
:members:
2020
:undoc-members:
2121
:show-inheritance:
@@ -24,7 +24,7 @@ planemo.galaxy_test.structures module
2424
Module contents
2525
---------------
2626

27-
.. automodule:: planemo.galaxy_test
27+
.. automodule:: planemo.galaxy.test
2828
:members:
2929
:undoc-members:
3030
:show-inheritance:

docs/planemo.rst

+1-25
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Subpackages
88

99
planemo.commands
1010
planemo.cwl
11-
planemo.galaxy_test
11+
planemo.galaxy
1212
planemo.linters
1313
planemo.reports
1414
planemo.shed
@@ -58,30 +58,6 @@ planemo.exit_codes module
5858
:undoc-members:
5959
:show-inheritance:
6060

61-
planemo.galaxy_config module
62-
----------------------------
63-
64-
.. automodule:: planemo.galaxy_config
65-
:members:
66-
:undoc-members:
67-
:show-inheritance:
68-
69-
planemo.galaxy_run module
70-
-------------------------
71-
72-
.. automodule:: planemo.galaxy_run
73-
:members:
74-
:undoc-members:
75-
:show-inheritance:
76-
77-
planemo.galaxy_serve module
78-
---------------------------
79-
80-
.. automodule:: planemo.galaxy_serve
81-
:members:
82-
:undoc-members:
83-
:show-inheritance:
84-
8561
planemo.git module
8662
------------------
8763

planemo/commands/cmd_serve.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import click
22

33
from planemo.cli import pass_context
4-
from planemo import galaxy_serve
4+
from planemo.galaxy import galaxy_serve
55
from planemo import options
66

77

@@ -34,4 +34,4 @@ def cli(ctx, paths, **kwds):
3434
proof yet so please careful and do not try this against production Galaxy
3535
instances.
3636
"""
37-
galaxy_serve.serve(ctx, paths, **kwds)
37+
galaxy_serve(ctx, paths, **kwds)

planemo/commands/cmd_shed_serve.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from planemo.cli import pass_context
77
from planemo import options
8-
from planemo import galaxy_serve
8+
from planemo.galaxy import shed_serve
99
from planemo import shed
1010
from planemo import io
1111

@@ -29,7 +29,7 @@ def cli(ctx, paths, **kwds):
2929
logged into and explored interactively.
3030
"""
3131
install_args_list = shed.install_arg_lists(ctx, paths, **kwds)
32-
with galaxy_serve.shed_serve(ctx, install_args_list, **kwds) as config:
32+
with shed_serve(ctx, install_args_list, **kwds) as config:
3333
gx_url = "http://localhost:%d/" % config.port
3434
io.info("Galaxy running with tools installed at %s" % gx_url)
3535
time.sleep(1000000)

planemo/commands/cmd_shed_test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
from planemo.cli import pass_context
99
from planemo import options
10-
from planemo import galaxy_serve
10+
from planemo.galaxy.serve import shed_serve
1111
from planemo import shed
12-
from planemo import galaxy_test
12+
from planemo.galaxy.test import run_in_config
1313

1414

1515
@click.command("shed_test")
@@ -36,9 +36,9 @@ def cli(ctx, paths, **kwds):
3636
port = get_free_port()
3737
kwds["port"] = port
3838
return_code = 1
39-
with galaxy_serve.shed_serve(ctx, install_args_list, **kwds) as config:
39+
with shed_serve(ctx, install_args_list, **kwds) as config:
4040
config.kill()
41-
return_code = galaxy_test.run_in_config(
41+
return_code = run_in_config(
4242
ctx,
4343
config,
4444
installed=True,

planemo/commands/cmd_test.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
from planemo.cli import pass_context
66
from planemo import options
7-
from planemo import galaxy_config
7+
from planemo.galaxy import galaxy_config
88

9-
from planemo.galaxy_test import (
9+
from planemo.galaxy.test import (
1010
run_in_config,
1111
)
1212

@@ -55,7 +55,7 @@ def cli(ctx, paths, **kwds):
5555
please careful and do not try this against production Galaxy instances.
5656
"""
5757
kwds["for_tests"] = True
58-
with galaxy_config.galaxy_config(ctx, paths, **kwds) as config:
58+
with galaxy_config(ctx, paths, **kwds) as config:
5959
return_value = run_in_config(ctx, config, **kwds)
6060
if return_value:
6161
sys.exit(return_value)

planemo/commands/cmd_test_reports.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from planemo.cli import pass_context
66
from planemo import io
77
from planemo import options
8-
from planemo.galaxy_test import StructuredData, handle_reports
8+
from planemo.galaxy.test import StructuredData, handle_reports
99

1010

1111
@click.command('test_reports')

planemo/commands/cmd_tool_factory.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import click
44
from planemo.cli import pass_context
55
from planemo import options
6-
from planemo import galaxy_serve
6+
from planemo.galaxy import serve
77

88

99
@click.command('tool_factory')
@@ -19,4 +19,4 @@ def cli(ctx, **kwds):
1919
"""
2020
mod_dir = os.path.dirname(__file__)
2121
tf_dir = os.path.join(mod_dir, '..', '..', 'planemo_ext', 'tool_factory_2')
22-
galaxy_serve.serve(ctx, [os.path.abspath(tf_dir)], **kwds)
22+
serve(ctx, [os.path.abspath(tf_dir)], **kwds)

planemo/conda.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
""" Planemo specific utilities for dealing with conda, extending Galaxy's
22
features with planemo specific idioms.
33
"""
4+
from __future__ import absolute_import
45

56
from galaxy.tools.deps import conda_util
67
from planemo.io import shell

planemo/cwl/run.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from planemo.io import conditionally_captured_io
2-
from planemo import galaxy_serve
2+
from planemo.galaxy.serve import serve_daemon
33
from .client import run_cwl_tool
44
from planemo import io
55

@@ -15,7 +15,7 @@ def run_galaxy(ctx, path, job_path, **kwds):
1515
kwds["cwl"] = True
1616
conformance_test = kwds.get("conformance_test", False)
1717
with conditionally_captured_io(conformance_test):
18-
with galaxy_serve.serve_daemon(ctx, [path], **kwds) as config:
18+
with serve_daemon(ctx, [path], **kwds) as config:
1919
try:
2020
cwl_run = run_cwl_tool(path, job_path, config, **kwds)
2121
except Exception:

planemo/galaxy/__init__.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""Entry-point for Galaxy specific functionality in Planemo."""
2+
3+
from __future__ import absolute_import
4+
5+
from .config import galaxy_config
6+
from .run import (
7+
setup_venv,
8+
run_galaxy_command,
9+
)
10+
from .serve import shed_serve
11+
from .serve import serve as galaxy_serve
12+
13+
__all__ = [
14+
"galaxy_config",
15+
"setup_venv",
16+
"run_galaxy_command",
17+
"galaxy_serve",
18+
"shed_serve",
19+
]

planemo/galaxy_config.py renamed to planemo/galaxy/config.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313

1414
import click
1515

16-
from planemo import galaxy_run
16+
from .run import (
17+
setup_common_startup_args,
18+
setup_venv,
19+
DOWNLOAD_GALAXY,
20+
)
1721
from planemo.conda import build_conda_context
1822
from planemo.io import warn
1923
from planemo.io import shell
@@ -547,7 +551,7 @@ def _install_galaxy(ctx, config_directory, env, kwds):
547551
def _install_galaxy_via_download(ctx, config_directory, env, kwds):
548552
branch = _galaxy_branch(kwds)
549553
tar_cmd = "tar -zxvf %s" % branch
550-
command = galaxy_run.DOWNLOAD_GALAXY + "; %s | tail" % tar_cmd
554+
command = DOWNLOAD_GALAXY + "; %s | tail" % tar_cmd
551555
_install_with_command(ctx, config_directory, command, env, kwds)
552556

553557

@@ -599,14 +603,14 @@ def _install_with_command(ctx, config_directory, command, env, kwds):
599603
pip_install_command = PIP_INSTALL_CMD % " ".join(pip_installs)
600604
else:
601605
pip_install_command = ""
602-
setup_venv_command = galaxy_run.setup_venv(ctx, kwds)
606+
setup_venv_command = setup_venv(ctx, kwds)
603607
install_cmd = shell_join(
604608
"cd %s" % config_directory,
605609
command,
606610
"cd galaxy-dev",
607611
setup_venv_command,
608612
pip_install_command,
609-
galaxy_run.setup_common_startup_args(),
613+
setup_common_startup_args(),
610614
COMMAND_STARTUP_COMMAND,
611615
)
612616
shell(install_cmd, env=env)

planemo/galaxy_run.py renamed to planemo/galaxy/run.py

+7
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,10 @@ def run_galaxy_command(ctx, command, env, action, daemon=False):
9797
ctx.vlog('%s="%s"' % (key, value))
9898
ctx.vlog("============================")
9999
return shell(command, env=env)
100+
101+
__all__ = [
102+
"setup_venv",
103+
"run_galaxy_command",
104+
"DOWNLOAD_GALAXY",
105+
"setup_common_startup_args",
106+
]

planemo/galaxy_serve.py renamed to planemo/galaxy/serve.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import contextlib
22
import os
33

4-
from planemo import galaxy_config
5-
from planemo import galaxy_run
4+
from .config import galaxy_config
5+
from .run import (
6+
setup_venv,
7+
run_galaxy_command,
8+
)
69
from planemo import io
710

811

@@ -15,9 +18,9 @@ def serve(ctx, paths, **kwds):
1518
if daemon:
1619
kwds["no_cleanup"] = True
1720

18-
with galaxy_config.galaxy_config(ctx, paths, **kwds) as config:
21+
with galaxy_config(ctx, paths, **kwds) as config:
1922
# TODO: Allow running dockerized Galaxy here instead.
20-
setup_venv_command = galaxy_run.setup_venv(ctx, kwds)
23+
setup_venv_command = setup_venv(ctx, kwds)
2124
run_script = os.path.join(config.galaxy_root, "run.sh")
2225
run_script += " $COMMON_STARTUP_ARGS"
2326
if daemon:
@@ -34,7 +37,7 @@ def serve(ctx, paths, **kwds):
3437
run_script,
3538
)
3639
action = "Starting galaxy"
37-
galaxy_run.run_galaxy_command(
40+
run_galaxy_command(
3841
ctx,
3942
cmd,
4043
config.env,
File renamed without changes.

planemo/galaxy_test/actions.py renamed to planemo/galaxy/test/actions.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
from . import structures as test_structures
66
from planemo.io import info, warn, shell_join
7-
from planemo import galaxy_run
7+
from planemo.galaxy.run import (
8+
run_galaxy_command,
9+
setup_venv,
10+
)
811
from planemo.reports import build_report
912

1013

@@ -58,15 +61,15 @@ def run_in_config(ctx, config, **kwds):
5861
'export COMMON_STARTUP_ARGS; '
5962
'echo "Set COMMON_STARTUP_ARGS to ${COMMON_STARTUP_ARGS}"'
6063
)
61-
setup_venv_command = galaxy_run.setup_venv(ctx, kwds)
64+
setup_venv_command = setup_venv(ctx, kwds)
6265
cmd = shell_join(
6366
cd_to_galaxy_command,
6467
setup_common_startup_args,
6568
setup_venv_command,
6669
test_cmd,
6770
)
6871
action = "Testing tools"
69-
return_code = galaxy_run.run_galaxy_command(
72+
return_code = run_galaxy_command(
7073
ctx,
7174
cmd,
7275
config.env,
File renamed without changes.

planemo/options.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
""" Click definitions for various shared options and arguments.
22
"""
33

4+
from __future__ import absolute_import
5+
46
import functools
57
import os
68

0 commit comments

Comments
 (0)