sdkagent

invoke API reference

98 public APIs from invoke (pyinvoke/invoke) — 18 classes, 14 functions, 66 methods. Signatures extracted by static analysis of the actual source.

Repository: pyinvoke/invoke

KindCount
Classes18
Functions14
Methods66

API list

funcintegration._explicit.foo(c:Context) -> None
Frobazz
funcintegration._util.only_utf8(f:Callable) -> Callable
Decorator causing tests to skip if local shell pipes aren't UTF-8.
classintegration.runners.Runner_.IO_hangs
IO hangs
classinvoke.collection.Collection
A collection of executable tasks.
methodinvoke.collection.Collection.add_task(task:'Task', name:Optional[str]=None, aliases:Optional[Tuple[str, ...]]=None, default:Optional[bool]=None) -> None
Add `.Task` ``task`` to this collection.
methodinvoke.collection.Collection.configuration(taskpath:Optional[str]=None) -> Dict[str, Any]
Obtain merged configuration values from collection & children.
methodinvoke.collection.Collection.configure(options:Dict[str, Any]) -> None
(Recursively) merge ``options`` into the current `.configuration`.
methodinvoke.collection.Collection.subcollection_from_path(path:str) -> 'Collection'
Given a ``path`` to a subcollection, return that subcollection.
methodinvoke.collection.Collection.task_with_config(name:Optional[str]) -> Tuple[str, Dict[str, Any]]
Return task named ``name`` plus its configuration dict.
methodinvoke.collection.Collection.transform(name:str) -> str
Transform ``name`` with the configured auto-dashes behavior.
classinvoke.config.Config
Invoke's primary configuration handling class.
methodinvoke.config.Config.clone(into:Optional[Type['Config']]=None) -> 'Config'
Return a copy of this configuration object.
methodinvoke.config.Config.global_defaults() -> Dict[str, Any]
Return the core default settings for Invoke.
methodinvoke.config.Config.load_collection(data:Dict[str, Any], merge:bool=True) -> None
Update collection-driven config data.
methodinvoke.config.Config.load_defaults(data:Dict[str, Any], merge:bool=True) -> None
Set or replace the 'defaults' configuration level, from ``data``.
methodinvoke.config.Config.load_project(merge:bool=True) -> None
Load a project-level config file, if possible.
methodinvoke.config.Config.load_runtime(merge:bool=True) -> None
Load a runtime-level config file, if one was specified.
methodinvoke.config.Config.load_shell_env() -> None
Load values from the shell environment.
methodinvoke.config.Config.load_system(merge:bool=True) -> None
Load a system-level config file, if possible.
methodinvoke.config.Config.load_user(merge:bool=True) -> None
Load a user-level config file, if possible.
methodinvoke.config.Config.merge() -> None
Merge all config sources, in order.
methodinvoke.config.Config.set_runtime_path(path:Optional[PathLike]) -> None
Set the runtime config file path.
classinvoke.config.DataProxy
Helper class implementing nested dict+attr access for `.Config`.
funcinvoke.config.obliterate(base:Dict[str, Any], deletions:Dict[str, Any]) -> None
Remove all (nested) keys mentioned in ``deletions``, from ``base``.
classinvoke.context.Context
Context-aware API wrapper & state-passing object.
methodinvoke.context.Context.run(command:str, **kwargs:Any) -> Result
Execute a local shell command, honoring config options.
methodinvoke.context.Context.sudo(command:str, **kwargs:Any) -> Result
Execute a shell command via ``sudo`` with password auto-response.
classinvoke.context.MockContext
A `.Context` whose methods' return values can be predetermined.
methodinvoke.context.MockContext.set_result_for(attname:str, command:str, result:Result) -> None
Modify the stored mock results for given ``attname`` (e.g.
methodinvoke.env.Environment.load() -> Dict[str, Any]
Return a nested dict containing values from `os.environ`.
classinvoke.exceptions.AuthFailure
An authentication failure, e.g.
classinvoke.exceptions.Exit
Simple custom stand-in for SystemExit.
classinvoke.exceptions.Failure
Exception subclass representing failure of a command execution.
classinvoke.exceptions.ThreadException
One or more exceptions were raised within background threads.
classinvoke.executor.Executor
An execution strategy for Task objects.
methodinvoke.executor.Executor.dedupe(calls:List['Call']) -> List['Call']
Deduplicate a list of `tasks <.Call>`.
methodinvoke.executor.Executor.execute(*tasks:Union[str, Tuple[str, Dict[str, Any]], ParserContext]) -> Dict['Task', 'Result']
Execute one or more ``tasks`` in sequence.
methodinvoke.executor.Executor.expand_calls(calls:List['Call']) -> List['Call']
Expand a list of `.Call` objects into a near-final list of same.
classinvoke.loader.FilesystemLoader
Loads Python files from the filesystem (e.g.
methodinvoke.loader.Loader.find(name:str) -> Optional[ModuleSpec]
Implementation-specific finder method seeking collection ``name``.
methodinvoke.loader.Loader.load(name:Optional[str]=None) -> Tuple[ModuleType, str]
Load and return collection module identified by ``name``.
classinvoke.parser.argument.Argument
A command-line argument/flag.
methodinvoke.parser.argument.Argument.name() -> Optional[str]
The canonical attribute-friendly name for this argument.
methodinvoke.parser.argument.Argument.set_value(value:Any, cast:bool=True) -> None
Actual explicit value-setting API call.
classinvoke.parser.context.ParserContext
Parsing context with knowledge of flags & their format.
methodinvoke.parser.context.ParserContext.help_for(flag:str) -> Tuple[str, str]
Return 2-tuple of ``(flag-spec, help-string)`` for given ``flag``.
funcinvoke.parser.context.flag_key(arg:Argument) -> List[Union[int, str]]
Obtain useful key list-of-ints for sorting CLI flags.
classinvoke.parser.parser.ParseResult
List-like object with some extra parse-related attributes.
methodinvoke.parser.parser.Parser.parse_argv(argv:List[str]) -> ParseResult
Parse an argv-style token list ``argv``.
methodinvoke.program.Program.args() -> 'Lexicon'
Obtain core program args from ``self.core`` parse result.
methodinvoke.program.Program.called_as() -> str
Returns the program name we were actually called as.
methodinvoke.program.Program.core_args() -> List['Argument']
Return default core `.Argument` objects, as a list.
methodinvoke.program.Program.initial_context() -> ParserContext
The initial parser context, aka core program flags.
methodinvoke.program.Program.name() -> str
Derive program's human-readable name based on `.binary`.
methodinvoke.program.Program.normalize_argv(argv:Optional[List[str]]) -> None
Massages ``argv`` into a useful list of strings.
methodinvoke.program.Program.parse_collection() -> None
Load a tasks collection & project-level config.
methodinvoke.program.Program.print_columns(tuples:Sequence[Tuple[str, Optional[str]]]) -> None
Print tabbed columns from (name, help) ``tuples``.
methodinvoke.program.Program.print_task_help(name:str) -> None
Print help for a specific task, e.g.
methodinvoke.program.Program.run(argv:Optional[List[str]]=None, exit:bool=True) -> None
Execute main CLI logic, based on ``argv``.
methodinvoke.program.Program.update_config(merge:bool=True) -> None
Update the previously instantiated `.Config` with parsed data.
funcinvoke.run(command:str, **kwargs:Any) -> Result
Run ``command`` in a subprocess and return a `.Result` object.
classinvoke.runners.Local
Execute a command on the local system in a subprocess.
classinvoke.runners.Result
A container for information about the result of a command execution.
methodinvoke.runners.Result.failed() -> bool
The inverse of ``ok``.
methodinvoke.runners.Result.ok() -> bool
A boolean equivalent to ``exited == 0``.
methodinvoke.runners.Result.return_code() -> int
An alias for ``.exited``.
methodinvoke.runners.Result.tail(stream:str, count:int=10) -> str
Return the last ``count`` lines of ``stream``, plus leading whitespace.
classinvoke.runners.Runner
Partially-abstract core command-running API.
methodinvoke.runners.Runner.close_proc_stdin() -> None
Close running process' stdin.
methodinvoke.runners.Runner.decode(data:bytes) -> str
Decode some ``data`` bytes, returning Unicode.
methodinvoke.runners.Runner.get_pid() -> Optional[int]
When possible, obtain the subprocess PID.
methodinvoke.runners.Runner.handle_stderr(buffer_:List[str], hide:bool, output:IO) -> None
Read process' stderr, storing into a buffer & printing/parsing.
methodinvoke.runners.Runner.handle_stdin(input_:IO, output:IO, echo:bool=False) -> None
Read local stdin, copying into process' stdin as necessary.
methodinvoke.runners.Runner.handle_stdout(buffer_:List[str], hide:bool, output:IO) -> None
Read process' stdout, storing into a buffer & printing/parsing.
methodinvoke.runners.Runner.kill() -> None
Forcibly terminate the subprocess.
methodinvoke.runners.Runner.process_is_finished() -> bool
Determine whether our subprocess has terminated.
methodinvoke.runners.Runner.read_our_stdin(input_:IO) -> Optional[str]
Read & decode bytes from a local stdin stream.
methodinvoke.runners.Runner.read_proc_stderr(num_bytes:int) -> Optional[bytes]
Read ``num_bytes`` from the running process' stderr stream.
methodinvoke.runners.Runner.read_proc_stdout(num_bytes:int) -> Optional[bytes]
Read ``num_bytes`` from the running process' stdout stream.
methodinvoke.runners.Runner.respond(buffer_:List[str]) -> None
Write to the program's stdin in response to patterns in ``buffer_``.
methodinvoke.runners.Runner.run(command:str, **kwargs:Any) -> 'Result'
Execute ``command``, returning an instance of `Result` once complete.
methodinvoke.runners.Runner.send_interrupt(interrupt:'KeyboardInterrupt') -> None
Submit an interrupt signal to the running subprocess.
methodinvoke.runners.Runner.should_use_pty(pty:bool, fallback:bool) -> bool
Should execution attempt to use a pseudo-terminal?
methodinvoke.runners.Runner.start(command:str, shell:str, env:Dict[str, Any]) -> None
Initiate execution of ``command`` (via ``shell``, with ``env``).
methodinvoke.runners.Runner.start_timer(timeout:int) -> None
Start a timer to `kill` our subprocess after ``timeout`` seconds.
methodinvoke.runners.Runner.stop() -> None
Perform final cleanup, if necessary.
methodinvoke.runners.Runner.wait() -> None
Block until the running command appears to have exited.
methodinvoke.runners.Runner.write_our_output(stream:IO, string:str) -> None
Write ``string`` to ``stream``.
methodinvoke.runners.Runner.write_proc_stdin(data:str) -> None
Write encoded ``data`` to the running process' stdin.
funcinvoke.runners.default_encoding() -> str
Obtain apparent interpreter-local default text encoding.
funcinvoke.sudo(command:str, **kwargs:Any) -> Result
Run ``command`` in a ``sudo`` subprocess and return a `.Result` object.
funcinvoke.terminals.bytes_to_read(input_:IO) -> int
Query stream ``input_`` to see how many bytes may be readable.
funcinvoke.terminals.character_buffered(stream:IO) -> Generator[None, None, None]
Force local terminal ``stream`` be character, not line, buffered.
funcinvoke.terminals.pty_size() -> Tuple[int, int]
Determine current local pseudoterminal dimensions.
funcinvoke.terminals.ready_for_reading(input_:IO) -> bool
Test ``input_`` to determine whether a read action will succeed.
funcinvoke.util.has_fileno(stream:IO) -> bool
Cleanly determine whether ``stream`` has a useful ``.fileno()``.
funcinvoke.util.isatty(stream:IO) -> Union[bool, Any]
Cleanly determine whether ``stream`` is a TTY.
funcinvoke.util.task_name_sort_key(name:str) -> Tuple[List[str], str]
Return key tuple for use sorting dotted task names, via e.g.

About this data

These signatures were extracted from the public source of pyinvoke/invoke using Python's ast module. Argument names, default values, type annotations and return types are taken verbatim from the code. Implementation bodies are never stored. See how it works for details.

Back to all 805 libraries