helpers#

Collection of helper functions to standardize reused CLI arguments.

Classes#

BooleanOptionalAction

Information about how to convert command line strings to Python objects.

Functions#

add_parser_create_install_update(p[, prefix_required])

add_parser_pscheck(→ None)

add_parser_show_channel_urls(→ None)

add_parser_help(→ None)

So we can use consistent capitalization and periods in the help. You must

add_parser_prefix(→ argparse._MutuallyExclusiveGroup)

add_parser_json(→ argparse._ArgumentGroup)

add_output_and_prompt_options(→ argparse._ArgumentGroup)

add_parser_channels(→ argparse._ArgumentGroup)

add_parser_solver_mode(→ argparse._ArgumentGroup)

add_parser_update_modifiers(solver_mode_options)

add_parser_prune(→ None)

add_parser_solver(→ None)

Add a command-line flag for alternative solver backends.

add_parser_networking(→ argparse._ArgumentGroup)

add_parser_package_install_options(...)

add_parser_known(→ None)

add_parser_default_packages(→ None)

add_parser_platform(parser)

add_parser_verbose(→ None)

class BooleanOptionalAction(option_strings, dest, default=None, type=None, choices=None, required=False, help=None, metavar=None)#

Bases: argparse.Action

Information about how to convert command line strings to Python objects.

Action objects are used by an ArgumentParser to represent the information needed to parse a single argument from one or more strings from the command line. The keyword arguments to the Action constructor are also all attributes of Action instances.

Keyword Arguments:
  • which (- option_strings -- A list of command-line option strings) -- should be associated with this action.

  • object (- dest -- The name of the attribute to hold the created)

  • be (- nargs -- The number of command-line arguments that should) --

    consumed. By default, one argument will be consumed and a single value will be produced. Other values include:

    • N (an integer) consumes N arguments (and produces a list)

    • '?' consumes zero or one arguments

    • '*' consumes zero or more arguments (and produces a list)

    • '+' consumes one or more arguments (and produces a list)

    Note that the difference between the default and nargs=1 is that with the default, a single value will be produced, while with nargs=1, a list containing a single value will be produced.

  • the (- metavar -- The name to be used for the option's argument with) -- option uses an action that takes no values.

  • specified. (- default -- The value to be produced if the option is not)

  • and (- type -- A callable that accepts a single string argument,) -- returns the converted value. The standard Python types str, int, float, and complex are useful examples of such callables. If None, str is used.

  • None, (- choices -- A container of values that should be allowed. If not) -- after a command-line argument has been converted to the appropriate type, an exception will be raised if it is not a member of this collection.

  • the -- command line. This is only meaningful for optional command-line arguments.

  • argument. (- help -- The help string describing the)

  • the -- help string. If None, the 'dest' value will be used as the name.

__call__(parser, namespace, values, option_string=None)#
format_usage()#
add_parser_create_install_update(p, prefix_required=False)#
add_parser_pscheck(p: argparse.ArgumentParser) None#
add_parser_show_channel_urls(p: argparse.ArgumentParser | argparse._ArgumentGroup) None#
add_parser_help(p: argparse.ArgumentParser) None#

So we can use consistent capitalization and periods in the help. You must use the add_help=False argument to ArgumentParser or add_parser to use this. Add this first to be consistent with the default argparse output.

add_parser_prefix(p: argparse.ArgumentParser, prefix_required: bool = False) argparse._MutuallyExclusiveGroup#
add_parser_json(p: argparse.ArgumentParser) argparse._ArgumentGroup#
add_output_and_prompt_options(p: argparse.ArgumentParser) argparse._ArgumentGroup#
add_parser_channels(p: argparse.ArgumentParser) argparse._ArgumentGroup#
add_parser_solver_mode(p: argparse.ArgumentParser) argparse._ArgumentGroup#
add_parser_update_modifiers(solver_mode_options: argparse.ArgumentParser)#
add_parser_prune(p: argparse.ArgumentParser) None#
add_parser_solver(p: argparse.ArgumentParser) None#

Add a command-line flag for alternative solver backends.

See context.solver for more info.

add_parser_networking(p: argparse.ArgumentParser) argparse._ArgumentGroup#
add_parser_package_install_options(p: argparse.ArgumentParser) argparse._ArgumentGroup#
add_parser_known(p: argparse.ArgumentParser) None#
add_parser_default_packages(p: argparse.ArgumentParser) None#
add_parser_platform(parser)#
add_parser_verbose(parser: argparse.ArgumentParser | argparse._ArgumentGroup) None#