A project to create a new cross-platform SSH wheel for Python.
- An easy to install, multi-platform SSH wheel
- To explore
gopy
- Respect and give kudos to all the work that's come before.
It is paramount that we all play nicely. To that end, please do your very best not to create churn or spur conversations that may upset other developers, and/or cause debate without offering solutions.
Install the library:
pip install ohpygosshImport and use the library to perform SSH operations:
from ohpygossh.gohpygossh import Run, Upload, Download
# SSH connection parameters
#
# The remote hostname or IP address
ssh_server = "example.com"
# Your user account on the remote machine
ssh_user = "ubuntu"
# A PEM encoded private key file (like ~/.ssh/id_ed25519 )
private_key = "/path/to/private/key"
# Execute a command on a remote host
output = Run(ssh_server, ssh_user, private_key, "ls -la")
# Upload a file to the remote host
Upload(ssh_server, ssh_user, private_key, "/local/file.txt", "/remote/file.txt")
# Download a file from the remote host
Download(ssh_server, ssh_user, private_key, "/remote/file.txt", "/local/file.txt")Development tasks are run with just, a
cross-platform command runner. All targets work the same way on macOS and
Linux; see the Justfile for the full list.
# One-time setup: installs Go, Python, gopy, poetry, pre-commit, etc. (via Homebrew)
just setup
# Run linters (golangci-lint, ruff, codespell, ...)
just lint
# Run the Go test suite
just test
# Build and validate the wheel: dist/ohpygossh-<version>-py3-none-any.whl
just build
# Remove build artifacts and the virtual environment
just cleanjust setup requires Homebrew to be installed first, since
it's the one package manager available on both macOS and Linux.
This project has to think about naming in two different contexts:
- The Python library, installed by end-users:
ohpygossh. - The Golang package, also used in the
pyproject.toml:gohpygossh.
Briefly:
# Install the library:
# pip install ohpygossh
# Import functions and data structures
from ohpygossh.gohpygossh import ...Based on:
