A Python library for SSH connections and remote command execution using Paramiko.
Run the following in your Python environment:
pip install "pyalma @ git+https://github.com/ICR-RSE-Group/pyalma.git@main"- Clone this repo locally to your machine: Make sure to navigate to the package directory before building
git clone [email protected]:ICR-RSE-Group/pyalma.git
cd pyalma- Create a Python Environment and activate it: Before building and installing the package, it is recommended to create a dedicated Python environment for your project.
python -m venv .env-py
source .env-py/bin/activate- Install Build Dependencies
python -m pip install --upgrade pip build- Build the Package Locally:
python -m build- Install locally using
pip:
pip install -e .pyalma-cli --cmd "ls -l"from pyalma import SshClient
ssh = SshClient(server='your_server', username='your_username', password='your_password')
result = ssh.run_cmd('ls -l')
print(result["output"])
print(result["err"])
from pyalma import SecureSshClient
secure_ssh = SecureSshClient(server='your_server', username='your_username')
result = ssh.run_cmd('ls -l')
print(result["output"])
print(result["err"])
from pyalma import LocalFileReader
local = LocalFileReader()
result = local.run_cmd('ls -l')
print(result["output"])
print(result["err"])
remote_path = "/full/remote/path/file.h5ad"
local_path = "local_copy.h5ad"
ssh = SshClient(server='your_server', username='your_username', password='your_password')
ssh.load_h5ad_file(path, local_path)
adata = ssh.read_h5ad(local_path)
print(adata)
path = "file.pdf"
ssh = SshClient(server='your_server', username='your_username', password='your_password')
# Read PDF into a DataFrame using pyalma
pdf_df = ssh.read_file_into_df(path,'pdf')
# returned dataframe contains three columns : "Page", "Content" and "Images"
ssh-keygen -t rsa -b 4096 -C "[email protected]"Access and copy the newly generated public key via:
cat ~/.ssh/id_rsa.pubThen paste it into the remote server’s ~/.ssh/authorized_keys file.
Before using the Python client, confirm the connection works:
You should connect without a password prompt