How to use the planemo.io.info function in planemo

To help you get started, we’ve selected a few planemo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github galaxyproject / planemo / planemo / training / tutorial.py View on Github external
def get_zenodo_record(zenodo_link):
    """Get the content of a Zenodo record."""
    # get the record in the Zenodo link
    if 'doi' in zenodo_link:
        z_record = zenodo_link.split('.')[-1]
    else:
        z_record = zenodo_link.split('/')[-1]
    # get JSON corresponding to the record from Zenodo API
    req = "https://zenodo.org/api/records/%s" % (z_record)
    r = requests.get(req)
    if r:
        req_res = r.json()
    else:
        info("The Zenodo link (%s) seems invalid" % (zenodo_link))
        req_res = {'files': []}
        z_record = None
    return(z_record, req_res)
github galaxyproject / planemo / planemo / training.py View on Github external
def get_zenodo_record(zenodo_link):
    """Get the content of a Zenodo record"""
    # get the record in the Zenodo link
    if 'doi' in zenodo_link:
        z_record = zenodo_link.split('.')[-1]
    else:
        z_record = zenodo_link.split('/')[-1]
    # get JSON corresponding to the record from Zenodo API
    req = "https://zenodo.org/api/records/%s" % (z_record)
    r = requests.get(req)
    if r:
        req_res = r.json()
    else:
        info("The Zenodo link (%s) seems invalid" % (zenodo_link))
        req_res = {'files': []}
        z_record = None
    return(z_record, req_res)
github galaxyproject / planemo / planemo / training.py View on Github external
def fill_data_library(ctx, kwds):
    """Fill a data library for a tutorial"""
    topic_dir, tuto_dir, metadata, metadata_path, tuto_metadata = prepare_tuto_update(kwds)

    # get the zenodo link
    z_link = ''
    if 'zenodo_link' in tuto_metadata and tuto_metadata['zenodo_link'] != '':
        if kwds['zenodo']:
            info("The data library and the metadata will be updated with the new Zenodo link")
            z_link = kwds['zenodo']
            tuto_metadata['zenodo_link'] = z_link
        else:
            info("The data library will be extracted using the Zenodo link in the metadata")
            z_link = tuto_metadata['zenodo_link']
    elif kwds['zenodo']:
        info("The data library will be created and the metadata will be filled with the new Zenodo link")
        z_link = kwds['zenodo']
        tuto_metadata['zenodo_link'] = z_link

    if z_link == '' or z_link is None:
        raise Exception("A Zenodo link should be provided either in the metadata file or as argument of the command")

    # extract the data library from Zenodo
    topic_kwds = {
        'topic_title': metadata['title'],
        'topic_summary': metadata['summary'],
        'tutorial_title': tuto_metadata['title'],
        'zenodo': z_link,
        'datatypes': kwds['datatypes']
    }
    prepare_data_library_from_zenodo(topic_kwds, tuto_dir)
    print(metadata)
github galaxyproject / planemo / planemo / commands / cmd_shed_update.py View on Github external
exit = 0
        metadata_ok = True
        repository_destination_label = "repository '%s' on the %s" % (realized_repository.name, shed_context.label)
        if not skip_metadata:
            repo_id = shed.handle_force_create(realized_repository, ctx, shed_context, **kwds)
            # failing to create the repo, give up
            if repo_id is None:
                exit = shed.report_non_existent_repository(realized_repository)
                metadata_ok = False
                error("Failed to update metadata for %s." % repository_destination_label)
            else:
                metadata_ok = realized_repository.update(ctx, shed_context, repo_id)
                if metadata_ok:
                    info("Repository metadata updated successfully for %s." % repository_destination_label)
        else:
            info("Skipping metadata update for %s" % repository_destination_label)

        if metadata_ok and upload_ok:
            pass
        elif upload_ok:
            collected_data['results']['skips'] += 1
            repo_result.update({
                'errorType': 'FailedMetadata',
                'errorMessage': 'Failed to update repository metadata',
            })
            if not skip_upload:
                error("Repository contents updated but failed to update metadata for %s." % repository_destination_label)
            exit = exit or 1
        else:
            collected_data['results']['failures'] += 1
            repo_result.update({
                'errorType': 'FailedUpdate',
github galaxyproject / planemo / planemo / training / __init__.py View on Github external
def fill_data_library(self, ctx):
        """Fill a data library for a tutorial."""
        self.check_topic_init_tuto()
        # get the zenodo link
        z_link = ''
        update_metadata = False
        if self.tuto.zenodo_link != '':
            if self.kwds['zenodo_link']:
                info("The data library and the metadata will be updated with the new Zenodo link")
                z_link = self.kwds['zenodo_link']
                self.tuto.zenodo_link = z_link
                update_metadata = True
            else:
                info("The data library will be extracted using the Zenodo link in the metadata of the tutorial")
                z_link = self.tuto.zenodo_link
        elif self.kwds['zenodo_link']:
            info("The data library will be created and the metadata will be filled with the new Zenodo link")
            z_link = self.kwds['zenodo_link']
            self.tuto.zenodo_link = z_link
            update_metadata = True

        if z_link == '' or z_link is None:
            raise Exception("A Zenodo link should be provided either in the metadata file or as argument of the command")

        # extract the data library from Zenodo
        self.tuto.prepare_data_library_from_zenodo()

        # update the metadata
        if update_metadata:
            self.tuto.write_hands_on_tutorial(add_z_file_links=False)
github galaxyproject / planemo / planemo / conda_recipes.py View on Github external
if bioconda_dir_path is None:
        bioconda_recipe_path = os.path.join(os.path.expanduser("~"), "bioconda-recipes")
    else:
        bioconda_recipe_path = os.path.join(bioconda_dir_path, "bioconda-recipes")

    # Clone
    if clone and (not os.path.exists(bioconda_recipe_path)):
        clone_bioconda_repo(bioconda_recipe_path)
        info("bioconda-recipes cloned and writing to %s" % bioconda_dir_path)
    else:
        info("Bioconda repository not cloned or already exists")

    # Check if package_name is in recipes
    presence = any(package_name in r for r, d, f in os.walk(bioconda_recipe_path))
    if presence:
        info("Package already exists in bioconda")
        if update:
            info("Package will be updated")
            recipe_dir = os.path.join(bioconda_recipe_path, "recipes")
            bioconductor_skeleton.write_recipe(package_name, recipe_dir, True)
    elif not presence:
        info("Package found in bioconda recipes")
        recipe_dir = os.path.join(bioconda_recipe_path, "recipes")
        bioconductor_skeleton.write_recipe(package_name, recipe_dir, True)
    return
github galaxyproject / planemo / planemo / conda_lint.py View on Github external
def lint_conda_recipe(ctx, recipe_dir, **kwds):
    info("Linting conda recipe %s" % recipe_dir)
    lint_args, lint_ctx = setup_lint(ctx, **kwds)

    def apply(f):
        lint_ctx.lint(f.__name__, f, recipe_dir)

    apply(lint_name)
    apply(lint_version)
    apply(lint_summary)
    apply(lint_build_number)
    apply(lint_directory_content)
    apply(lint_license_family)
    apply(lint_about_urls)
    apply(lint_source)
    apply(lint_fields)
    apply(lint_requirements)
github galaxyproject / planemo / planemo / training.py View on Github external
def get_param_desc(step_params, step_inputs, tp_desc, level, wf_steps, should_be_there=False):
    """Parse the parameters of the tool and return the formatted list of the
    parameters and values set in the workflow"""
    paramlist = ''
    for n, tp_d in tp_desc.items():
        if n not in step_params:
            if not should_be_there:
                info("%s not in workflow" % n)
            else:
                raise ValueError("%s not in workflow" % n)
        else:
            step_param = get_lower_params(step_params, n)
            paramlist += format_param_desc(step_param, step_inputs, tp_d, level, wf_steps)
    return paramlist
github galaxyproject / planemo / planemo / tools.py View on Github external
def _is_tool_source(ctx, tool_path, tool_source):
    if os.path.basename(tool_path) in SHED_FILES:
        return False
    root = getattr(tool_source, "root", None)
    if root is not None:
        if root.tag != "tool":
            if ctx.verbose:
                info(SKIP_XML_MESSAGE % tool_path)
            return False
    return True