Command helpers -

Misc. legacy helpers subprocess and finding VCS binaries. will be deprecated by libvcs._internal.subprocess.


This is an internal API not covered by versioning policy.[source]#

From pypa/pip project, pip.backwardwardcompat. License MIT.

Return type:



s (bytes) –

class, keyword, *args, **kwargs)[source]#

Bases: LoggerAdapter

Adapter for additional command-related data to logging.

Extends logging.LoggerAdapter’s functionality.

Mixes in additional context via logging.LoggerAdapter.process() for logging.Formatter when emitting log entries.

  • bin_name (str) – name of the command or vcs tool being wrapped, e.g. β€˜git’

  • keyword (str) – directory basename, name of repo, hint, etc. e.g. β€˜django’

  • args (Any) –

  • kwargs (Any) –

Initialize the adapter with a logger and a dict-like object which provides contextual information. This constructor signature allows easy stacking of LoggerAdapters, if so desired.

You can effectively pass keyword arguments as shown in the following example:

adapter = LoggerAdapter(someLogger, dict(p1=v1, p2=”v2”))




directory basename, name of repository, hint, etc.

process(msg, kwargs)[source]#

Add additional context information for loggers.

Return type:

tuple[Any, MutableMapping[str, Any]]

class*args, **kwargs)[source]#

Bases: Protocol

Callback to report subprocess communication.

_abc_impl = <_abc._abc_data object>#
_is_protocol = True#, bufsize=-1, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=True, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0, restore_signals=True, start_new_session=False, pass_fds=(), *, text=None, encoding=None, errors=None, user=None, group=None, extra_groups=None, umask=-1, log_in_real_time=False, check_returncode=True, callback=None)[source]#

Run β€˜args’ in a shell and return the combined contents of stdout and stderr (Blocking). Throws an exception if the command exits non-zero.

Keyword arguments are passthrough to subprocess.Popen.

Return type: