module

biopipen.utils.misc

Functions
  • require_package(package, version, python) Require a Python package to be installed with optional version check.</>
  • run_command(cmd, fg, wait, print_command, print_command_handler, **kwargs) (subprocess.popen | str) Run a command.</>
function

biopipen.utils.misc.require_package(package, version=None, python=None)

Require a Python package to be installed with optional version check.

The version specifier should follow the format used by pip, e.g., '>=1.2.3'. Multiple version specifiers can be separated by commas, e.g., '>=1.2.3,<2.0.0'.

Parameters
  • package (str) The name of the package to check.
  • version (str | None) The version specifier string.
  • python (str | None) The Python interpreter to use.
function

biopipen.utils.misc.run_command(cmd, fg=False, wait=True, print_command=True, print_command_handler=<built-in function print>, **kwargs)

Run a command.

Parameters
  • cmd (Union) A string or list of strings representing the command to run.
  • fg (bool, optional) Whether to run the command in the foreground.Redirects stdout and stderr to the current process.
  • wait (bool, optional) Whether to wait for the command to finish.The command will be waited for if fg is True.
  • print_command (bool, optional) Whether to print the command before running it.
  • print_command_handler (Callable, optional) The function to use to print the command.
  • kwargs Keyword arguments to pass to subprocess.Popen.
Returns (subprocess.popen | str)

The Popen object, or str when stdout is RETURN or return.