Permalink
Browse files

Various improvements and bug fixes for Conda.

Fixes #616.
  • Loading branch information...
jmchilton committed Jan 23, 2017
1 parent f08375a commit 459595303c0fbcc4b55f2f4d2ebc2330a0a31b05
Showing with 71 additions and 39 deletions.
  1. +7 −1 HISTORY.rst
  2. +57 −33 planemo/galaxy/config.py
  3. +5 −3 planemo/options.py
  4. +1 −1 requirements.txt
  5. +1 −1 tests/test_cmd_test_conda.py
@@ -9,7 +9,13 @@ History
0.37.0.dev0
---------------------


* Update to the latest `galaxy-lib`_ release. This means new installs start with
Miniconda 3 instaed of Minicoda 2 and at a newer version. This fixes many

This comment has been minimized.

@peterjc

peterjc Jan 30, 2017

Contributor

Typo: instaed --> instead

Conda_ related bugs.
* Change defaults so that Conda auto initializes and aut install tools by default

This comment has been minimized.

@peterjc

peterjc Jan 30, 2017

Contributor

Typo: aut --> auto

from within Galaxy. The trio of flags ``--conda_dependency_resolution``,
``--conda_auto_install``, and ``--conda_auto_init`` are effectively the new
defaults.

---------------------
0.36.1 (2016-12-12)
@@ -93,6 +93,16 @@
"""


# Like Conda resolution above, but allow tool shed packages to be used for
# shed_serve and shed_test.
DEFAULT_DEPENDENCY_RESOLUTION_CONF = """<dependency_resolvers>
<tool_shed_packages />
<conda ${attributes} />
<conda versionless="true" ${attributes} />
</dependency_resolvers>
"""


BREW_DEPENDENCY_RESOLUTION_CONF = """<dependency_resolvers>
<homebrew />
<!--
@@ -143,6 +153,7 @@
"brew_dependency_resolution": BREW_DEPENDENCY_RESOLUTION_CONF,
"shed_dependency_resolution": SHED_DEPENDENCY_RESOLUTION_CONF,
"conda_dependency_resolution": CONDA_DEPENDENCY_RESOLUTION_CONF,
"default_dependency_resolution": DEFAULT_DEPENDENCY_RESOLUTION_CONF,
}

EMPTY_TOOL_CONF_TEMPLATE = """<toolbox></toolbox>"""
@@ -1145,29 +1156,16 @@ def _handle_job_config_file(config_directory, server_name, kwds):


def _handle_dependency_resolution(ctx, config_directory, kwds):
resolutions_strategies = [
"brew_dependency_resolution",
"dependency_resolvers_config_file",
"shed_dependency_resolution",
"conda_dependency_resolution",
]

selected_strategies = 0
for key in resolutions_strategies:
if kwds.get(key):
selected_strategies += 1

if selected_strategies > 1:
message = "At most one option from [%s] may be specified"
raise click.UsageError(message % resolutions_strategies)
_validate_dependency_resolution_options(kwds)
always_specify_attribute = object()

dependency_attribute_kwds = {
'conda_prefix': None,
'conda_exec': None,
'conda_debug': False,
'conda_copy_dependencies': False,
'conda_auto_init': False,
'conda_auto_install': False,
'conda_auto_init': always_specify_attribute,
'conda_auto_install': always_specify_attribute,
'conda_ensure_channels': '',
}
attributes = []
@@ -1191,23 +1189,49 @@ def add_attribute(key, value):

attribute_str = " ".join(attributes)

for key in STOCK_DEPENDENCY_RESOLUTION_STRATEGIES:
if kwds.get("dependency_resolvers_config_file", None):
resolution_type = "__explicit__"
else:
resolution_type = "default_dependency_resolution"
for key in STOCK_DEPENDENCY_RESOLUTION_STRATEGIES:
if kwds.get(key):
resolution_type = key

if resolution_type != "__explicit__":
# Planemo manages the dependency resolve conf file.
resolvers_conf = os.path.join(
config_directory,
"resolvers_conf.xml"
)
template_str = STOCK_DEPENDENCY_RESOLUTION_STRATEGIES[resolution_type]
conf_contents = Template(template_str).safe_substitute({
'attributes': attribute_str
})
open(resolvers_conf, "w").write(conf_contents)
ctx.vlog(
"Writing dependency_resolvers_config_file to path %s with contents [%s]",
resolvers_conf,
conf_contents,
)
kwds["dependency_resolvers_config_file"] = resolvers_conf


def _validate_dependency_resolution_options(kwds):
resolutions_strategies = [
"brew_dependency_resolution",
"dependency_resolvers_config_file",
"shed_dependency_resolution",
"conda_dependency_resolution",
]

selected_strategies = 0
for key in resolutions_strategies:
if kwds.get(key):
resolvers_conf = os.path.join(
config_directory,
"resolvers_conf.xml"
)
template_str = STOCK_DEPENDENCY_RESOLUTION_STRATEGIES[key]
conf_contents = Template(template_str).safe_substitute({
'attributes': attribute_str
})
open(resolvers_conf, "w").write(conf_contents)
ctx.vlog(
"Writing dependency_resolvers_config_file to path %s with contents [%s]",
resolvers_conf,
conf_contents,
)
kwds["dependency_resolvers_config_file"] = resolvers_conf
selected_strategies += 1

if selected_strategies > 1:
message = "At most one option from [%s] may be specified"
raise click.UsageError(message % resolutions_strategies)


def _handle_container_resolution(ctx, kwds, galaxy_properties):
@@ -448,7 +448,7 @@ def conda_ensure_channels_option():
use_env_var=True,
help=("Ensure conda is configured with specified comma separated "
"list of channels."),
default="conda-forge,r,bioconda,iuc",
default="iuc,bioconda,r,defaults,conda-forge",
)


@@ -463,17 +463,19 @@ def conda_copy_dependencies_option():

def conda_auto_install_option():
return planemo_option(
"--conda_auto_install",
"--conda_auto_install/--no_conda_auto_install",
is_flag=True,
default=True,
help=("Conda dependency resolution for Galaxy will auto install "
"will attempt to install requested but missing packages.")
)


def conda_auto_init_option():
return planemo_option(
"--conda_auto_init",
"--conda_auto_init/--no_conda_auto_init",
is_flag=True,
default=True,
help=("Conda dependency resolution for Galaxy will auto install "
"conda itself using miniconda if not availabe on conda_prefix.")
)
@@ -13,6 +13,6 @@ virtualenv
lxml
gxformat2>=0.1.1
ephemeris>=0.2.0
galaxy-lib>=16.10.5
galaxy-lib>=17.01.2
html5lib>=0.9999999,!=0.99999999,!=0.999999999,!=1.0b10,!=1.0b09 ; python_version == '2.7'
cwltool==1.0.20160726135535 ; python_version == '2.7'
@@ -9,7 +9,7 @@
)


class CmdTestTestCase(CliTestCase):
class CmdTestCondaTestCase(CliTestCase):
"""Integration tests for the ``test`` command."""

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")

0 comments on commit 4595953

Please sign in to comment.