Skip to content

Instantly share code, notes, and snippets.

@axw
Created November 23, 2012 01:14
Show Gist options
  • Save axw/4133527 to your computer and use it in GitHub Desktop.
Save axw/4133527 to your computer and use it in GitHub Desktop.
Remotely import a local package with Pushy
import pushy
# Load the local package into a "PushyPackageLoader". This takes care of loading package
# sources and crafting them into a structure that can be loaded by "InMemoryImporter".
import whatever
loader = pushy.client.PushyPackageLoader()
packages = loader.load(whatever)
with pushy.connect("ssh:remotehost") as conn:
remote_importer = conn.modules.pushy.client.InMemoryImporter(*packages)
conn.modules.sys.meta_path.insert(0, remote_importer)
whatever = conn.remote_import("whatever")
print whatever.hostname()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment