Package

A Package is a Runhouse primitive for sharing code between various systems (ex: s3, cluster, local).

Package Factory Method

runhouse.package(name: str | None = None, install_method: str | None = None, install_str: str | None = None, path: str | None = None, system: str | None = None, load_from_den: bool = True, dryrun: bool = False) Package[source]

Builds an instance of Package.

Parameters:
  • name (str, optional) – Name to assign the package resource.

  • install_method (str, optional) – Method for installing the package. Options: [pip, conda, reqs, local]

  • install_str (str, optional) – Additional arguments to install.

  • path (str, optional) – URL of the package to install.

  • system (str, optional) – File system or cluster on which the package lives. Currently this must a cluster or one of: [file, s3, gs].

  • load_from_den (bool, optional) – Whether to try loading the Package from Den. (Default: True)

  • dryrun (bool, optional) – Whether to create the Package if it doesn’t exist, or load the Package object as a dryrun. (Default: False)

Returns:

The resulting package.

Return type:

Package

Example

>>> import runhouse as rh >>> reloaded_package = rh.package(name="my-package") >>> local_package = rh.package(path="local/folder/path", install_method="local")
runhouse.git_package(name: str | None = None, git_url: str | None = None, revision: str | None = None, install_method: str | None = None, install_str: str | None = None, load_from_den: bool = True, dryrun: bool = False)[source]

Builds an instance of GitPackage.

Parameters:
  • name (str, optional) – Name to assign the package resource.

  • git_url (str, optional) – The GitHub URL of the package to install.

  • revision (str, optional) – Version of the Git package to install.

  • install_method (str, optional) – Method for installing the package. If left blank, defaults to local installation.

  • install_str (str, optional) – Additional arguments to add to installation command.

  • load_from_den (bool, optional) – Whether to try loading the package from Den. (Default: True)

  • dryrun (bool, optional) – Whether to load the Package object as a dryrun, or create the Package if it doesn’t exist. (Default: False)

Returns:

The resulting GitHub Package.

Return type:

GitPackage

Example

>>> rh.git_package(git_url='https://github.com/runhouse/runhouse.git', >>> install_method='pip', revision='v0.0.1')

Package Class

class runhouse.Package(name: str | None = None, install_method: str | None = None, install_target: str | Folder | None = None, install_args: str | None = None, preferred_version: str | None = None, dryrun: bool = False, **kwargs)[source]
__init__(name: str | None = None, install_method: str | None = None, install_target: str | Folder | None = None, install_args: str | None = None, preferred_version: str | None = None, dryrun: bool = False, **kwargs)[source]

Runhouse Package resource.

Note

To create a git package, please use the factory method package().

static from_config(config: Dict, dryrun: bool = False, _resolve_children: bool = True)[source]

Load or construct resource from config.

Parameters:
  • config (Dict) – Resource config.

  • dryrun (bool, optional) – Whether to construct resource or load as dryrun (Default: False)

static split_req_install_method(req_str: str)[source]

Split a requirements string into a install method and the rest of the string.

to(system: str | Dict | Cluster, path: str | None = None)[source]

Copy the package onto filesystem or cluster, and return the new Package object.

Parameters:

system (str, Dict, or Cluster) – Cluster to send the package to.

GitPackage Docs

class runhouse.GitPackage(name: str | None = None, git_url: str | None = None, install_method: str | None = None, install_args: str | None = None, revision: str | None = None, dryrun: bool = False, **kwargs)[source]
__init__(name: str | None = None, git_url: str | None = None, install_method: str | None = None, install_args: str | None = None, revision: str | None = None, dryrun: bool = False, **kwargs)[source]

Runhouse Github Package resource.

Note

To create a git package, please use the factory method git_package() or package().

static from_config(config: Dict, dryrun: bool = False, _resolve_children: bool = True)[source]

Load or construct resource from config.

Parameters:
  • config (Dict) – Resource config.

  • dryrun (bool, optional) – Whether to construct resource or load as dryrun (Default: False)