sshmirror 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,192 @@
1
+ Metadata-Version: 2.4
2
+ Name: sshmirror
3
+ Version: 0.1.0
4
+ Summary: SSH directory synchronization library and CLI
5
+ Author: FellowCode
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/FellowCode/sshmirror
8
+ Project-URL: Repository, https://github.com/FellowCode/sshmirror
9
+ Project-URL: Issues, https://github.com/FellowCode/sshmirror/issues
10
+ Keywords: ssh,sync,deployment,cli,remote-files,project-management
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Software Development :: Version Control
20
+ Classifier: Topic :: System :: Networking
21
+ Classifier: Topic :: Utilities
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: aiofiles
26
+ Requires-Dist: aioshutil
27
+ Requires-Dist: asyncssh
28
+ Requires-Dist: beartype
29
+ Requires-Dist: pydantic
30
+ Requires-Dist: PyYAML
31
+ Requires-Dist: questionary
32
+ Requires-Dist: rich
33
+ Dynamic: license-file
34
+
35
+ # SSHMirror
36
+
37
+ Sync a working directory with a remote server over SSH, inspect diffs before applying changes, and keep a lightweight local history for rollback-oriented workflows.
38
+
39
+ SSHMirror is both:
40
+
41
+ - a Python library you can import;
42
+ - a CLI you can run inside a project folder;
43
+ - a sync workflow that keeps local and remote changes inspectable.
44
+
45
+ It can also be used as a lightweight sync workflow for a shared project: multiple developers can make changes to the same remote-backed codebase and inspect differences before pulling or pushing updates.
46
+
47
+ ## Why It Stands Out
48
+
49
+ - Preview first. Inspect current file changes and version-to-version diffs before syncing. 🔍
50
+ - Built for real SSH workflows. Passwords, SSH keys, passphrases, and ssh-agent fallback are supported. 🔐
51
+ - Keeps local state. SSHMirror stores version and migration metadata under `.sshmirror/`. 🗂️
52
+ - Works as a library or a command-line tool. 🐍
53
+ - Useful for team workflows. Several developers can work on one project and sync changes through the same remote environment. 🤝
54
+ - Optional remote container restart after sync. 🐳
55
+
56
+ ## Install 🚀
57
+
58
+ ```bash
59
+ pip install sshmirror
60
+ ```
61
+
62
+ For local development:
63
+
64
+ ```bash
65
+ pip install -e .
66
+ ```
67
+
68
+ ## Quick Start ⚡
69
+
70
+ 1. Create a config file:
71
+
72
+ ```bash
73
+ sshmirror
74
+ ```
75
+
76
+ On first interactive launch, SSHMirror can create `sshmirror.config.yml` for you.
77
+
78
+ 2. Start from this minimal config:
79
+
80
+ ```yaml
81
+ host: '192.168.12.22'
82
+ port: '50022'
83
+ username: 'root'
84
+ localdir: '.'
85
+ remotedir: '/app'
86
+ author: your-name
87
+ ```
88
+
89
+ 3. Check status or connect-test before syncing:
90
+
91
+ ```bash
92
+ sshmirror --status
93
+ sshmirror --test-connection
94
+ ```
95
+
96
+ ## Example Configuration ⚙️
97
+
98
+ The full example lives in [sshmirror.config.example.yml](sshmirror.config.example.yml).
99
+
100
+ Supported auth patterns:
101
+
102
+ - password auth;
103
+ - private key auth;
104
+ - private key with passphrase;
105
+ - default SSH keys or ssh-agent when no key and no password are provided.
106
+
107
+ Example with optional container restart:
108
+
109
+ ```yaml
110
+ host: '192.168.12.22'
111
+ port: '50022'
112
+ username: 'root'
113
+ localdir: '.'
114
+ remotedir: '/app'
115
+ author: your-name
116
+
117
+ restart_container:
118
+ # Optional. If omitted, host/port/user are reused from the main SSH config.
119
+ # host: '192.168.12.22'
120
+ # port: '23322'
121
+ # user: user
122
+ sudo: true
123
+ container_name: testcontainer
124
+ ```
125
+
126
+ `restart_container` connects to the Docker host where the container is running. If `host`, `port`, or `user` are not specified there, SSHMirror uses the main connection values.
127
+
128
+ ## CLI Commands 🧰
129
+
130
+ ```bash
131
+ sshmirror --help
132
+ ```
133
+
134
+ Main non-interactive flags:
135
+
136
+ - `--status` show local and remote sync status;
137
+ - `--current-diff` inspect current local versus remote differences;
138
+ - `--version-diff` inspect changes between remote versions;
139
+ - `--pull` only pull from remote;
140
+ - `--stash-changes` stash local changes before syncing;
141
+ - `--restore-stash` restore previously stashed changes;
142
+ - `--force-pull` overwrite local files from remote;
143
+ - `--discard` discard all local changes;
144
+ - `--discard-files <paths...>` discard only selected files;
145
+ - `--downgrade` downgrade remote version;
146
+ - `--test-connection` validate SSH access to the remote host and configured Docker host.
147
+
148
+ ## Library Usage 📦
149
+
150
+ ```python
151
+ from sshmirror import SSHMirror, SSHMirrorConfig
152
+
153
+ mirror = SSHMirror(
154
+ config=SSHMirrorConfig(
155
+ host='127.0.0.1',
156
+ port=22,
157
+ username='root',
158
+ localdir='.',
159
+ remotedir='/app',
160
+ )
161
+ )
162
+ ```
163
+
164
+ The public API is exported from [sshmirror/__init__.py](sshmirror/__init__.py).
165
+
166
+ ## Project Layout
167
+
168
+ ```text
169
+ sshmirror/
170
+ sshmirror/ # importable package
171
+ tests/ # smoke tests
172
+ pyproject.toml # packaging metadata
173
+ sshmirror.config.example.yml
174
+ ```
175
+
176
+ ## Development 🛠️
177
+
178
+ Run tests:
179
+
180
+ ```bash
181
+ python -m unittest discover -s tests -p "test_*.py"
182
+ ```
183
+
184
+ Build locally:
185
+
186
+ ```bash
187
+ python -m build
188
+ ```
189
+
190
+ ## Status
191
+
192
+ This repository is structured as a Python package with a CLI entry point. If you plan to publish to PyPI, keep package metadata, README, and license in sync with actual behavior.
@@ -0,0 +1,158 @@
1
+ # SSHMirror
2
+
3
+ Sync a working directory with a remote server over SSH, inspect diffs before applying changes, and keep a lightweight local history for rollback-oriented workflows.
4
+
5
+ SSHMirror is both:
6
+
7
+ - a Python library you can import;
8
+ - a CLI you can run inside a project folder;
9
+ - a sync workflow that keeps local and remote changes inspectable.
10
+
11
+ It can also be used as a lightweight sync workflow for a shared project: multiple developers can make changes to the same remote-backed codebase and inspect differences before pulling or pushing updates.
12
+
13
+ ## Why It Stands Out
14
+
15
+ - Preview first. Inspect current file changes and version-to-version diffs before syncing. 🔍
16
+ - Built for real SSH workflows. Passwords, SSH keys, passphrases, and ssh-agent fallback are supported. 🔐
17
+ - Keeps local state. SSHMirror stores version and migration metadata under `.sshmirror/`. 🗂️
18
+ - Works as a library or a command-line tool. 🐍
19
+ - Useful for team workflows. Several developers can work on one project and sync changes through the same remote environment. 🤝
20
+ - Optional remote container restart after sync. 🐳
21
+
22
+ ## Install 🚀
23
+
24
+ ```bash
25
+ pip install sshmirror
26
+ ```
27
+
28
+ For local development:
29
+
30
+ ```bash
31
+ pip install -e .
32
+ ```
33
+
34
+ ## Quick Start ⚡
35
+
36
+ 1. Create a config file:
37
+
38
+ ```bash
39
+ sshmirror
40
+ ```
41
+
42
+ On first interactive launch, SSHMirror can create `sshmirror.config.yml` for you.
43
+
44
+ 2. Start from this minimal config:
45
+
46
+ ```yaml
47
+ host: '192.168.12.22'
48
+ port: '50022'
49
+ username: 'root'
50
+ localdir: '.'
51
+ remotedir: '/app'
52
+ author: your-name
53
+ ```
54
+
55
+ 3. Check status or connect-test before syncing:
56
+
57
+ ```bash
58
+ sshmirror --status
59
+ sshmirror --test-connection
60
+ ```
61
+
62
+ ## Example Configuration ⚙️
63
+
64
+ The full example lives in [sshmirror.config.example.yml](sshmirror.config.example.yml).
65
+
66
+ Supported auth patterns:
67
+
68
+ - password auth;
69
+ - private key auth;
70
+ - private key with passphrase;
71
+ - default SSH keys or ssh-agent when no key and no password are provided.
72
+
73
+ Example with optional container restart:
74
+
75
+ ```yaml
76
+ host: '192.168.12.22'
77
+ port: '50022'
78
+ username: 'root'
79
+ localdir: '.'
80
+ remotedir: '/app'
81
+ author: your-name
82
+
83
+ restart_container:
84
+ # Optional. If omitted, host/port/user are reused from the main SSH config.
85
+ # host: '192.168.12.22'
86
+ # port: '23322'
87
+ # user: user
88
+ sudo: true
89
+ container_name: testcontainer
90
+ ```
91
+
92
+ `restart_container` connects to the Docker host where the container is running. If `host`, `port`, or `user` are not specified there, SSHMirror uses the main connection values.
93
+
94
+ ## CLI Commands 🧰
95
+
96
+ ```bash
97
+ sshmirror --help
98
+ ```
99
+
100
+ Main non-interactive flags:
101
+
102
+ - `--status` show local and remote sync status;
103
+ - `--current-diff` inspect current local versus remote differences;
104
+ - `--version-diff` inspect changes between remote versions;
105
+ - `--pull` only pull from remote;
106
+ - `--stash-changes` stash local changes before syncing;
107
+ - `--restore-stash` restore previously stashed changes;
108
+ - `--force-pull` overwrite local files from remote;
109
+ - `--discard` discard all local changes;
110
+ - `--discard-files <paths...>` discard only selected files;
111
+ - `--downgrade` downgrade remote version;
112
+ - `--test-connection` validate SSH access to the remote host and configured Docker host.
113
+
114
+ ## Library Usage 📦
115
+
116
+ ```python
117
+ from sshmirror import SSHMirror, SSHMirrorConfig
118
+
119
+ mirror = SSHMirror(
120
+ config=SSHMirrorConfig(
121
+ host='127.0.0.1',
122
+ port=22,
123
+ username='root',
124
+ localdir='.',
125
+ remotedir='/app',
126
+ )
127
+ )
128
+ ```
129
+
130
+ The public API is exported from [sshmirror/__init__.py](sshmirror/__init__.py).
131
+
132
+ ## Project Layout
133
+
134
+ ```text
135
+ sshmirror/
136
+ sshmirror/ # importable package
137
+ tests/ # smoke tests
138
+ pyproject.toml # packaging metadata
139
+ sshmirror.config.example.yml
140
+ ```
141
+
142
+ ## Development 🛠️
143
+
144
+ Run tests:
145
+
146
+ ```bash
147
+ python -m unittest discover -s tests -p "test_*.py"
148
+ ```
149
+
150
+ Build locally:
151
+
152
+ ```bash
153
+ python -m build
154
+ ```
155
+
156
+ ## Status
157
+
158
+ This repository is structured as a Python package with a CLI entry point. If you plan to publish to PyPI, keep package metadata, README, and license in sync with actual behavior.
@@ -0,0 +1,52 @@
1
+ [build-system]
2
+ requires = ['setuptools>=68', 'wheel']
3
+ build-backend = 'setuptools.build_meta'
4
+
5
+ [project]
6
+ name = 'sshmirror'
7
+ version = '0.1.0'
8
+ description = 'SSH directory synchronization library and CLI'
9
+ readme = 'README.md'
10
+ requires-python = '>=3.11'
11
+ license = 'MIT'
12
+ authors = [
13
+ { name = 'FellowCode' },
14
+ ]
15
+ keywords = ['ssh', 'sync', 'deployment', 'cli', 'remote-files', 'project-management']
16
+ classifiers = [
17
+ 'Development Status :: 3 - Alpha',
18
+ 'Intended Audience :: Developers',
19
+ 'Operating System :: OS Independent',
20
+ 'Programming Language :: Python :: 3',
21
+ 'Programming Language :: Python :: 3.11',
22
+ 'Programming Language :: Python :: 3.12',
23
+ 'Programming Language :: Python :: 3.13',
24
+ 'Programming Language :: Python :: 3.14',
25
+ 'Topic :: Software Development :: Version Control',
26
+ 'Topic :: System :: Networking',
27
+ 'Topic :: Utilities',
28
+ ]
29
+ dependencies = [
30
+ 'aiofiles',
31
+ 'aioshutil',
32
+ 'asyncssh',
33
+ 'beartype',
34
+ 'pydantic',
35
+ 'PyYAML',
36
+ 'questionary',
37
+ 'rich',
38
+ ]
39
+
40
+ [project.urls]
41
+ Homepage = 'https://github.com/FellowCode/sshmirror'
42
+ Repository = 'https://github.com/FellowCode/sshmirror'
43
+ Issues = 'https://github.com/FellowCode/sshmirror/issues'
44
+
45
+ [project.scripts]
46
+ sshmirror = 'sshmirror.cli:main'
47
+
48
+ [tool.setuptools]
49
+ include-package-data = true
50
+
51
+ [tool.setuptools.packages.find]
52
+ include = ['sshmirror', 'sshmirror.*']
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,14 @@
1
+ from .config import SSHMirrorCallbacks, SSHMirrorConfig
2
+ from .core.exceptions import ErrorLocalVersion, UserAbort, VersionAlreadyExists
3
+ from .sshmirror import SSHMirror
4
+
5
+ __all__ = [
6
+ 'ErrorLocalVersion',
7
+ 'SSHMirror',
8
+ 'SSHMirrorCallbacks',
9
+ 'SSHMirrorConfig',
10
+ 'UserAbort',
11
+ 'VersionAlreadyExists',
12
+ ]
13
+
14
+ __version__ = '0.1.0'
@@ -0,0 +1,4 @@
1
+ from .cli import main
2
+
3
+
4
+ raise SystemExit(main())