How to use the invoke.Collection function in invoke

To help you get started, we’ve selected a few invoke 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 pyinvoke / invoke / tests / executor.py View on Github external
def subcollection_config_works_with_default_tasks(self):
            @task(default=True)
            def mytask(c):
                assert c.my_key == "value"

            # Sets up a task "known as" sub.mytask which may be called as
            # just 'sub' due to being default.
            sub = Collection("sub", mytask=mytask)
            sub.configure({"my_key": "value"})
            main = Collection(sub=sub)
            # Execute via collection default 'task' name.
            Executor(collection=main).execute("sub")
github bitprophet / lexicon / tasks.py View on Github external
from invoke import Collection
from invocations.testing import test
from invocations.packaging import release

ns = Collection(release, test)
ns.configure({
    'packaging': {
        'sign': True,
        'wheel': True,
    },
github behave / behave / tasks / clean.py View on Github external
"extra_directories": [],
        "extra_files": [],
    },
    "clean_all": {
        "directories": [".venv*", ".tox", "downloads", "tmp"],
        "files": [],
        "extra_directories": [],
        "extra_files": [],
    },
})

# -- SUPPORT ADDITIONAL CLEANUP TASKS (which are called by ``clean`` task)
cleanup_tasks = Collection("cleanup_tasks")
cleanup_tasks.add_task(clean_python)

cleanup_all_tasks = Collection("cleanup_all_tasks")

# -----------------------------------------------------------------------------
# TASK CONFIGURATION HELPERS: Can be used from other task modules
# -----------------------------------------------------------------------------
def config_add_cleanup_dirs(directories):
    cleanup_directories = namespace._configuration["clean"]["directories"]
    cleanup_directories.extend(directories)

def config_add_cleanup_files(files):
    cleanup_files = namespace._configuration["clean"]["files"]
    cleanup_files.extend(files)
github pypa / pip / tasks / __init__.py View on Github external
import invoke

from . import generate
from . import vendoring

ns = invoke.Collection(generate, vendoring)
github microsoft / DistributedDeepLearning / {{cookiecutter.project_name}} / TensorFlow_experiment / tensorflow_experiment.py View on Github external
dependencies_file="TensorFlow_imagenet/environment_gpu.yml",
        docker_args=["-v", f"{env_values['data']}:/data"],
        wait_for_completion=True,
    )
    print(run)


remote_collection = Collection("remote")
remote_collection.add_task(submit_images, "images")
remote_collection.add_task(submit_remote, "synthetic")

local_collection = Collection("local")
local_collection.add_task(submit_images_local, "images")
local_collection.add_task(submit_local, "synthetic")

submit_collection = Collection("submit", local_collection, remote_collection)
namespace = Collection("tf_experiment", submit_collection)
github F5Networks / f5-ansible / tasks / __init__.py View on Github external
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import absolute_import, division, print_function
__metaclass__ = type

from invoke import Collection

from . import container
from . import collection
from . import ip
from . import module
from . import test

ns = Collection(
    container,
    collection,
    ip,
    module,
    test,
)
github pyslackers / sir-bot-a-lot / tasks / __init__.py View on Github external
from invoke import Collection

from tasks import docker
from tasks.base import clean, test, lint, publish, fmt, fmt_dry, swagger

ns = Collection()
ns.add_collection(Collection.from_module(docker))

# we want these to be available at the base level
ns.add_task(clean)
ns.add_task(test)
ns.add_task(lint)
ns.add_task(publish)
ns.add_task(fmt)
ns.add_task(fmt_dry)
ns.add_task(swagger)
github davidmcclure / earthxray / tasks / __init__.py View on Github external
from invoke import Collection
from tasks import countries


ns = Collection()
ns.add_collection(Collection.from_module(countries))
github sdss / marvin / tasks.py View on Github external
marvin = os.path.join(MODULEPATH, 'marvin')
    wrap = os.path.join(MODULEPATH, 'wrapmarvin')
    update_module(ctx, path=marvin, version=version)
    update_module(ctx, path=wrap, wrap=True, version=version)

    # restart the new marvin
    # switch_module(ctx, version=version)
    update_uwsgi(ctx, version=version)
    print('Marvin version {0} is set up!\n'.format(version))
    print('Check for the new Marvin version at the bottom of the Marvin Web main page!')
    # print('Please run ...\n stopmarvin \n module switch wrapmarvin '
    #       'wrapmarvin/mangawork.marvin_{0} \n startmarvin \n'.format(version))


ns = Collection(clean, deploy, setup_utah)
docs = Collection('docs')
docs.add_task(build_docs, 'build')
docs.add_task(clean_docs, 'clean')
docs.add_task(show_docs, 'show')
ns.add_collection(docs)
updates = Collection('update')
updates.add_task(update_git, 'git')
updates.add_task(update_current, 'current')
updates.add_task(update_module, 'module')
updates.add_task(update_default, 'default')
ns.add_collection(updates)
github cucumber / cucumber / cucumber-tag-expressions / python / tasks / __init__.py View on Github external
from . import test
from . import release

# -----------------------------------------------------------------------------
# TASKS:
# -----------------------------------------------------------------------------
# None


# -----------------------------------------------------------------------------
# TASK CONFIGURATION:
# -----------------------------------------------------------------------------
namespace = Collection()
namespace.add_collection(Collection.from_module(cleanup), name="cleanup")
namespace.add_collection(Collection.from_module(test))
namespace.add_collection(Collection.from_module(release))

cleanup.cleanup_tasks.add_task(cleanup.clean_python)

# -- INJECT: clean configuration into this namespace
namespace.configure(cleanup.namespace.configuration())
if sys.platform.startswith("win"):
    # -- OVERRIDE SETTINGS: For platform=win32, ... (Windows)
    from ._compat_shutil import which
    run_settings = dict(echo=True, pty=False, shell=which("cmd"))
    namespace.configure({"run": run_settings})
else:
    namespace.configure({"run": dict(echo=True, pty=True)})