Core SSH config/tagging engine shared by sshcli and sshui.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ixlab_sshcore-1.0.0.tar.gz.
File metadata
- Download URL: ixlab_sshcore-1.0.0.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0437ab1afc01c8460abde628dafa040afbb31aa1d701dcbcc6cd59c3c7c4fc54
|
|
| MD5 |
217e428747f52ed0218cea7e5d13c49c
|
|
| BLAKE2b-256 |
f54d4f5845746022e2c8ed2add68d69cc652e844443f2d430ae75973f68c8c4d
|
File details
Details for the file ixlab_sshcore-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ixlab_sshcore-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38a3b190541e4ec3550aefc93ffcdacd73e00bb04f7ef1e9453251e95e1c2be5
|
|
| MD5 |
b485aebe8e97dd27dcf3f3fe412a13be
|
|
| BLAKE2b-256 |
fef0b01752925816186da2c25897595dfb5c82b0c8294c8759accf443f1879d4
|