sshcore
sshcore is the shared engine behind the sshcli and sshui applications. It provides a pure-Python API for reading, manipulating, and writing SSH configuration files with tag metadata, color definitions, backup helpers, and key-management utilities.
Features
- Parse SSH config files (including
Includedirectives) into structuredHostBlockobjects. - Attach metadata such as
@tagsand global tag color definitions. - Modify or append host blocks while preserving metadata comments.
- Manage key files (generation, listing, inspection) without touching the CLI/UI layers.
- Track config sources and settings (
sshcli.json) so other apps can share the same configuration state. - Backup and restore SSH configs with timestamped copies.
Installation
pip install ixlab-sshcore
This installs only the reusable library—no CLI or GUI dependencies.
Usage
from sshcore import config
blocks = config.load_host_blocks()
for block in blocks:
print(block.patterns, block.tags)
# Update a host's tags and persist them back to disk
target = config.default_config_path()
backup = config.replace_host_block_with_metadata(
target,
block,
block.patterns,
list(block.options.items()),
)
print("Updated host, backup saved to:", backup)
Development
-
Create a virtual environment and install dependencies:
pip install -e .[dev]
-
Run tests:
pytest
sshcore is MIT licensed. Issues and pull requests are welcome.
Metadata
Release files for ixlab-sshcore 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ixlab_sshcore-1.0.0.tar.gz | 14.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ixlab_sshcore-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.0 kB
Release files / ixlab_sshcore-1.0.0.tar.gz
| Download URL | ixlab_sshcore-1.0.0.tar.gz |
|---|---|
| Size | 14.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0437ab1afc01c8460abde628dafa040afbb31aa1d701dcbcc6cd59c3c7c4fc54
|
|
BLAKE2b-256 checksum How to use checksums |
f54d4f5845746022e2c8ed2add68d69cc652e844443f2d430ae75973f68c8c4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / ixlab_sshcore-1.0.0-py3-none-any.whl
| Download URL | ixlab_sshcore-1.0.0-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38a3b190541e4ec3550aefc93ffcdacd73e00bb04f7ef1e9453251e95e1c2be5
|
|
BLAKE2b-256 checksum How to use checksums |
fef0b01752925816186da2c25897595dfb5c82b0c8294c8759accf443f1879d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|