Beispiel #1
0
def configure_parser(sub_parsers):
    p = sub_parsers.add_parser(
        'update',
        formatter_class=RawDescriptionHelpFormatter,
        description=description,
        help=description,
        epilog=example,
    )
    add_parser_prefix(p)
    p.add_argument(
        '-f',
        '--file',
        action='store',
        help='environment definition (default: environment.yml)',
        default='environment.yml',
    )
    p.add_argument(
        '--prune',
        action='store_true',
        default=False,
        help='remove installed packages not defined in environment.yml',
    )
    p.add_argument(
        '-q',
        '--quiet',
        action='store_true',
        default=False,
    )
    p.add_argument('remote_definition',
                   help='remote environment definition / IPython notebook',
                   action='store',
                   default=None,
                   nargs='?')
    add_parser_json(p)
    p.set_defaults(func=execute)
Beispiel #2
0
def configure_parser(sub_parsers):
    p = sub_parsers.add_parser(
        'update',
        formatter_class=RawDescriptionHelpFormatter,
        description=description,
        help=description,
        epilog=example,
    )
    add_parser_prefix(p)
    p.add_argument(
        '-f', '--file',
        action='store',
        help='environment definition (default: environment.yml)',
        default='environment.yml',
    )
    p.add_argument(
        '--prune',
        action='store_true',
        default=False,
        help='remove installed packages not defined in environment.yml',
    )
    p.add_argument(
        'remote_definition',
        help='remote environment definition / IPython notebook',
        action='store',
        default=None,
        nargs='?'
    )
    add_parser_json(p)
    p.set_defaults(func='.main_update.execute')
Beispiel #3
0
def configure_parser(sub_parsers):
    p = sub_parsers.add_parser(
        'create',
        formatter_class=RawDescriptionHelpFormatter,
        description=description,
        help=description,
        epilog=example,
    )
    p.add_argument(
        '-f', '--file',
        action='store',
        help='environment definition file (default: environment.yml)',
        default='environment.yml',
    )

    # Add name and prefix args
    add_parser_prefix(p)

    p.add_argument(
        'remote_definition',
        help='remote environment definition / IPython notebook',
        action='store',
        default=None,
        nargs='?'
    )
    p.add_argument(
        '--force',
        help=('force creation of environment (removing a previously existing '
              'environment of the same name).'),
        action='store_true',
        default=False,
    )
    add_parser_json(p)
    p.set_defaults(func='.main_create.execute')
Beispiel #4
0
def configure_parser(sub_parsers):
    p = sub_parsers.add_parser(
        'create',
        formatter_class=RawDescriptionHelpFormatter,
        description=description,
        help=description,
        epilog=example,
    )
    p.add_argument(
        '-f',
        '--file',
        action='store',
        help='environment definition file (default: environment.yml)',
        default='environment.yml',
    )

    # Add name and prefix args
    add_parser_prefix(p)

    p.add_argument('remote_definition',
                   help='remote environment definition / IPython notebook',
                   action='store',
                   default=None,
                   nargs='?')
    p.add_argument(
        '--force',
        help=('force creation of environment (removing a previously existing '
              'environment of the same name).'),
        action='store_true',
        default=False,
    )
    add_parser_json(p)
    p.set_defaults(func='.main_create.execute')
def configure_parser(sub_parsers):
    p = sub_parsers.add_parser(
        'upload',
        formatter_class=RawDescriptionHelpFormatter,
        description=description,
        help=description,
        epilog=example,
    )
    p.add_argument('-n',
                   '--name',
                   action='store',
                   help='environment definition [Deprecated]',
                   default=None,
                   dest='old_name')
    p.add_argument(
        '-f',
        '--file',
        action='store',
        help='environment definition file (default: environment.yml)',
        default='environment.yml',
    )
    p.add_argument('--summary',
                   help='Short summary of the environment',
                   default='Environment file')
    p.add_argument('-q', '--quiet', default=False, action='store_true')
    p.add_argument('name',
                   help='environment definition',
                   action='store',
                   default=None,
                   nargs='?')
    add_parser_json(p)
    p.set_defaults(func='.main_upload.execute')
Beispiel #6
0
def configure_parser_repoquery(sub_parsers):
    help = "Query repositories using mamba. "
    descr = (help)

    example = ("""
Examples:

    mamba repoquery search xtensor>=0.18
    mamba repoquery depends xtensor
    mamba repoquery whoneeds xtl

    """)

    import argparse
    from argparse import SUPPRESS

    p = sub_parsers.add_parser('repoquery',
                               description=descr,
                               help=help,
                               epilog=example)
    subsub_parser = p.add_subparsers(dest='subcmd')
    package_cmds = argparse.ArgumentParser(add_help=False)
    package_cmds.add_argument('package_query', help='the target package')
    package_cmds.add_argument("-i",
                              "--installed",
                              action="store_true",
                              help=SUPPRESS)

    package_cmds.add_argument(
        "-a",
        "--all-channels",
        action="store_true",
        help="Look at all channels (for depends / whoneeds)")

    view_cmds = argparse.ArgumentParser(add_help=False)
    view_cmds.add_argument("-t", "--tree", action="store_true")

    subsub_parser.add_parser(
        'whoneeds',
        help='shows packages that depends on this package',
        parents=[package_cmds, view_cmds])

    subsub_parser.add_parser(
        'depends',
        help='shows packages that depends on this package',
        parents=[package_cmds, view_cmds])

    subsub_parser.add_parser(
        'search',
        help='shows packages that depends on this package',
        parents=[package_cmds])

    from conda.cli import conda_argparse
    conda_argparse.add_parser_channels(p)
    conda_argparse.add_parser_networking(p)
    conda_argparse.add_parser_known(p)
    conda_argparse.add_parser_json(p)

    p.set_defaults(func='.main_repoquery.execute')
    return p
Beispiel #7
0
def configure_parser(sub_parsers):
    list_parser = sub_parsers.add_parser(
        'list',
        formatter_class=RawDescriptionHelpFormatter,
        description=description,
        help=description,
        epilog=example,
    )

    add_parser_json(list_parser)

    list_parser.set_defaults(func='.main_list.execute')
Beispiel #8
0
def configure_parser(sub_parsers):
    var_parser = sub_parsers.add_parser(
        'vars',
        formatter_class=RawDescriptionHelpFormatter,
        description=var_description,
        help=var_description,
        epilog=var_example,
    )
    var_subparser = var_parser.add_subparsers()

    list_parser = var_subparser.add_parser(
        'list',
        formatter_class=RawDescriptionHelpFormatter,
        description=list_description,
        help=list_description,
        epilog=list_example,
    )
    add_parser_prefix(list_parser)
    add_parser_json(list_parser)
    list_parser.set_defaults(func='.main_vars.execute_list')

    set_parser = var_subparser.add_parser(
        'set',
        formatter_class=RawDescriptionHelpFormatter,
        description=set_description,
        help=set_description,
        epilog=set_example,
    )
    set_parser.add_argument(
        'vars',
        action='store',
        nargs='*',
        help=
        'Environment variables to set in the form <KEY>=<VALUE> separated by spaces'
    )
    add_parser_prefix(set_parser)
    set_parser.set_defaults(func='.main_vars.execute_set')

    unset_parser = var_subparser.add_parser(
        'unset',
        formatter_class=RawDescriptionHelpFormatter,
        description=unset_description,
        help=unset_description,
        epilog=unset_example,
    )
    unset_parser.add_argument(
        'vars',
        action='store',
        nargs='*',
        help=
        'Environment variables to unset in the form <KEY> separated by spaces')
    add_parser_prefix(unset_parser)
    unset_parser.set_defaults(func='.main_vars.execute_unset')
Beispiel #9
0
def configure_parser(sub_parsers):
    p = sub_parsers.add_parser(
        'export',
        formatter_class=RawDescriptionHelpFormatter,
        description=description,
        help=description,
        epilog=example,
    )

    p.add_argument(
        '-c', '--channel',
        action='append',
        help='Additional channel to include in the export'
    )

    p.add_argument(
        "--override-channels",
        action="store_true",
        help="Do not include .condarc channels",
    )
    add_parser_prefix(p)

    p.add_argument(
        '-f', '--file',
        default=None,
        required=False
    )

    p.add_argument(
        '--no-builds',
        default=False,
        action='store_true',
        required=False,
        help='Remove build specification from dependencies'
    )

    p.add_argument(
        '--ignore-channels',
        default=False,
        action='store_true',
        required=False,
        help='Do not include channel names with package names.')
    add_parser_json(p)

    p.add_argument(
        '--from-history',
        default=False,
        action='store_true',
        required=False,
        help='Build environment spec from explicit specs in history'
    )
    p.set_defaults(func='.main_export.execute')
Beispiel #10
0
def configure_parser(sub_parsers):
    p = sub_parsers.add_parser(
        'attach',
        formatter_class=RawDescriptionHelpFormatter,
        description=description,
        help=description,
        epilog=example,
    )
    group = p.add_mutually_exclusive_group(required=True)
    group.add_argument(
        '-n', '--name',
        action='store',
        help='local environment definition',
        default=None
    )
    group.add_argument(
        '-r', '--remote',
        action='store',
        help='remote environment definition',
        default=None
    )
    p.add_argument(
        '-p', "--prefix",
        action="store",
        help="Full path to environment prefix",
        metavar='PATH',
        default=None
    )
    p.add_argument(
        '--force',
        action='store_true',
        default=False,
        help='Replace existing environment definition'
    )
    p.add_argument(
        '--no-builds',
        default=False,
        action='store_true',
        required=False,
        help='Remove build specification from dependencies'
    )
    p.add_argument(
        'notebook',
        help='notebook file',
        action='store',
        default=None
    )
    add_parser_json(p)
    p.set_defaults(func=execute)
Beispiel #11
0
def configure_parser(sub_parsers):
    p = sub_parsers.add_parser(
        'attach',
        formatter_class=RawDescriptionHelpFormatter,
        description=description,
        help=description,
        epilog=example,
    )
    group = p.add_mutually_exclusive_group(required=True)
    group.add_argument(
        '-n', '--name',
        action='store',
        help='local environment definition',
        default=None
    )
    group.add_argument(
        '-r', '--remote',
        action='store',
        help='remote environment definition',
        default=None
    )
    p.add_argument(
        '-p', "--prefix",
        action="store",
        help="Full path to environment prefix",
        metavar='PATH',
        default=None
    )
    p.add_argument(
        '--force',
        action='store_true',
        default=False,
        help='Replace existing environment definition'
    )
    p.add_argument(
        '--no-builds',
        default=False,
        action='store_true',
        required=False,
        help='Remove build specification from dependencies'
    )
    p.add_argument(
        'notebook',
        help='notebook file',
        action='store',
        default=None
    )
    add_parser_json(p)
    p.set_defaults(func='.main_attach.execute')
Beispiel #12
0
def configure_parser(sub_parsers):
    p = sub_parsers.add_parser(
        'remove',
        formatter_class=RawDescriptionHelpFormatter,
        description=_description,
        help=_help,
        epilog=_example,
    )

    add_parser_prefix(p)
    add_parser_json(p)
    add_parser_quiet(p)
    add_parser_yes(p)

    p.set_defaults(func=execute)
Beispiel #13
0
def configure_parser(sub_parsers):
    p = sub_parsers.add_parser(
        'remove',
        formatter_class=RawDescriptionHelpFormatter,
        description=_description,
        help=_help,
        epilog=_example,
    )

    add_parser_prefix(p)
    add_parser_json(p)
    add_parser_quiet(p)
    add_parser_yes(p)

    p.set_defaults(func='.main_remove.execute')
Beispiel #14
0
def configure_parser(sub_parsers):
    p = sub_parsers.add_parser(
        'export',
        formatter_class=RawDescriptionHelpFormatter,
        description=description,
        help=description,
        epilog=example,
    )

    p.add_argument(
        '-c', '--channel',
        action='append',
        help='Additional channel to include in the export'
    )

    p.add_argument(
        "--override-channels",
        action="store_true",
        help="Do not include .condarc channels",
    )
    add_parser_prefix(p)

    p.add_argument(
        '-f', '--file',
        default=None,
        required=False
    )

    p.add_argument(
        '--no-builds',
        default=False,
        action='store_true',
        required=False,
        help='Remove build specification from dependencies'
    )

    p.add_argument(
        '--ignore-channels',
        default=False,
        action='store_true',
        required=False,
        help='Do not include channel names with package names.')
    add_parser_json(p)
    p.set_defaults(func='.main_export.execute')
Beispiel #15
0
def configure_parser_repoquery(sub_parsers):
    help_cli = "Query repositories using mamba. "
    descr = help_cli

    example = """
Examples:

    mamba repoquery search xtensor>=0.18
    mamba repoquery depends xtensor
    mamba repoquery whoneeds xtl

    """

    import argparse
    from argparse import SUPPRESS

    p = sub_parsers.add_parser("repoquery",
                               description=descr,
                               help=help_cli,
                               epilog=example)
    subsub_parser = p.add_subparsers(dest="subcmd")
    package_cmds = argparse.ArgumentParser(add_help=False)
    package_cmds.add_argument("package_query", help="the target package")
    package_cmds.add_argument("-i",
                              "--installed",
                              action="store_true",
                              default=True,
                              help=SUPPRESS)

    package_cmds.add_argument("-p", "--platform")
    package_cmds.add_argument("--no-installed", action="store_true")
    package_cmds.add_argument("--pretty", action="store_true")

    package_cmds.add_argument(
        "-a",
        "--all-channels",
        action="store_true",
        help="Look at all channels (for depends / whoneeds)",
    )

    view_cmds = argparse.ArgumentParser(add_help=False)
    view_cmds.add_argument("-t", "--tree", action="store_true")

    c1 = subsub_parser.add_parser(
        "whoneeds",
        help="shows packages that depends on this package",
        parents=[package_cmds, view_cmds],
    )

    c2 = subsub_parser.add_parser(
        "depends",
        help="shows packages that depends on this package",
        parents=[package_cmds, view_cmds],
    )

    c3 = subsub_parser.add_parser(
        "search",
        help="shows packages that depends on this package",
        parents=[package_cmds],
    )

    from conda.cli import conda_argparse

    for cmd in (c1, c2, c3):
        conda_argparse.add_parser_channels(cmd)
        conda_argparse.add_parser_networking(cmd)
        conda_argparse.add_parser_known(cmd)
        conda_argparse.add_parser_json(cmd)

    p.set_defaults(func=".main_repoquery.execute")
    return p