A simple Python package for SSH-ing into a Modal container.
pip install modal-sshOr install from source:
git clone https://github.com/yourusername/modal-ssh.git
cd modal-ssh
pip install -e .For development, install with pytest:
pip install -e ".[dev]"- You need to have Modal CLI set up and authenticated
- You need to have SSH keys set up on your local machine
import modal
from modal import App, Image, Volume
from modal_ssh import configure_ssh_image, ssh_function_wrapper
# Create a Modal app
app = App(name="my-ssh-app")
# Create a custom image with additional dependencies
base_image = Image.debian_slim(python_version="3.10").pip_install(
"numpy",
"pandas",
"scikit-learn"
)
ssh_image = configure_ssh_image(base_image=base_image)
volume = Volume.from_name("ssh-volume", create_if_missing=True)
@app.function(
gpu="A10G",
timeout=14400,
image=ssh_image,
volumes={
"/root/entry": volume
}
)
def ssh_function():
ssh_function_wrapper()MIT