clonebox 0.1.14__tar.gz → 0.1.16__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.
Files changed (26) hide show
  1. {clonebox-0.1.14 → clonebox-0.1.16}/PKG-INFO +114 -14
  2. clonebox-0.1.14/src/clonebox.egg-info/PKG-INFO → clonebox-0.1.16/README.md +107 -52
  3. {clonebox-0.1.14 → clonebox-0.1.16}/pyproject.toml +36 -1
  4. {clonebox-0.1.14 → clonebox-0.1.16}/src/clonebox/cli.py +629 -215
  5. {clonebox-0.1.14 → clonebox-0.1.16}/src/clonebox/cloner.py +21 -24
  6. clonebox-0.1.16/src/clonebox/container.py +190 -0
  7. clonebox-0.1.16/src/clonebox/models.py +197 -0
  8. clonebox-0.1.14/README.md → clonebox-0.1.16/src/clonebox.egg-info/PKG-INFO +152 -13
  9. {clonebox-0.1.14 → clonebox-0.1.16}/src/clonebox.egg-info/SOURCES.txt +5 -1
  10. {clonebox-0.1.14 → clonebox-0.1.16}/src/clonebox.egg-info/requires.txt +7 -0
  11. clonebox-0.1.16/tests/test_cli.py +405 -0
  12. {clonebox-0.1.14 → clonebox-0.1.16}/tests/test_cloner.py +23 -32
  13. {clonebox-0.1.14 → clonebox-0.1.16}/tests/test_detector.py +48 -28
  14. clonebox-0.1.16/tests/test_models.py +297 -0
  15. clonebox-0.1.16/tests/test_validator.py +286 -0
  16. clonebox-0.1.14/tests/test_cli.py +0 -207
  17. {clonebox-0.1.14 → clonebox-0.1.16}/LICENSE +0 -0
  18. {clonebox-0.1.14 → clonebox-0.1.16}/setup.cfg +0 -0
  19. {clonebox-0.1.14 → clonebox-0.1.16}/src/clonebox/__init__.py +0 -0
  20. {clonebox-0.1.14 → clonebox-0.1.16}/src/clonebox/__main__.py +0 -0
  21. {clonebox-0.1.14 → clonebox-0.1.16}/src/clonebox/detector.py +0 -0
  22. {clonebox-0.1.14 → clonebox-0.1.16}/src/clonebox/validator.py +0 -0
  23. {clonebox-0.1.14 → clonebox-0.1.16}/src/clonebox.egg-info/dependency_links.txt +0 -0
  24. {clonebox-0.1.14 → clonebox-0.1.16}/src/clonebox.egg-info/entry_points.txt +0 -0
  25. {clonebox-0.1.14 → clonebox-0.1.16}/src/clonebox.egg-info/top_level.txt +0 -0
  26. {clonebox-0.1.14 → clonebox-0.1.16}/tests/test_network.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: clonebox
3
- Version: 0.1.14
3
+ Version: 0.1.16
4
4
  Summary: Clone your workstation environment to an isolated VM with selective apps, paths and services
5
5
  Author: CloneBox Team
6
6
  License: Apache-2.0
@@ -30,14 +30,26 @@ Requires-Dist: rich>=13.0.0
30
30
  Requires-Dist: questionary>=2.0.0
31
31
  Requires-Dist: psutil>=5.9.0
32
32
  Requires-Dist: pyyaml>=6.0
33
+ Requires-Dist: pydantic>=2.0.0
33
34
  Provides-Extra: dev
34
35
  Requires-Dist: pytest>=7.0.0; extra == "dev"
35
36
  Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
36
37
  Requires-Dist: black>=23.0.0; extra == "dev"
37
38
  Requires-Dist: ruff>=0.1.0; extra == "dev"
39
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
40
+ Provides-Extra: test
41
+ Requires-Dist: pytest>=7.0.0; extra == "test"
42
+ Requires-Dist: pytest-cov>=4.0.0; extra == "test"
43
+ Requires-Dist: pytest-timeout>=2.0.0; extra == "test"
38
44
  Dynamic: license-file
39
45
 
40
46
  # CloneBox 📦
47
+
48
+ [![CI](https://github.com/wronai/clonebox/workflows/CI/badge.svg)](https://github.com/wronai/clonebox/actions)
49
+ [![PyPI version](https://badge.fury.io/py/clonebox.svg)](https://pypi.org/project/clonebox/)
50
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
51
+ [![License](https://img.shields.io/badge/license-Apache%202.0-green.svg)](LICENSE)
52
+
41
53
  ![img.png](img.png)
42
54
 
43
55
  ```commandline
@@ -51,7 +63,8 @@ Dynamic: license-file
51
63
  ║ Clone your workstation to an isolated VM ║
52
64
  ╚═══════════════════════════════════════════════════════╝
53
65
  ```
54
- **Clone your workstation environment to an isolated VM with selective apps, paths and services.**
66
+
67
+ > **Clone your workstation environment to an isolated VM in 60 seconds using bind mounts instead of disk cloning.**
55
68
 
56
69
  CloneBox lets you create isolated virtual machines with only the applications, directories and services you need - using bind mounts instead of full disk cloning. Perfect for development, testing, or creating reproducible environments.
57
70
 
@@ -168,6 +181,61 @@ clonebox stop <name> # Zatrzymaj VM
168
181
  clonebox delete <name> # Usuń VM
169
182
  ```
170
183
 
184
+ ## Development and Testing
185
+
186
+ ### Running Tests
187
+
188
+ CloneBox has comprehensive test coverage with unit tests and end-to-end tests:
189
+
190
+ ```bash
191
+ # Run unit tests only (fast, no libvirt required)
192
+ make test
193
+
194
+ # Run fast unit tests (excludes slow tests)
195
+ make test-unit
196
+
197
+ # Run end-to-end tests (requires libvirt/KVM)
198
+ make test-e2e
199
+
200
+ # Run all tests including e2e
201
+ make test-all
202
+
203
+ # Run tests with coverage
204
+ make test-cov
205
+
206
+ # Run tests with verbose output
207
+ make test-verbose
208
+ ```
209
+
210
+ ### Test Categories
211
+
212
+ Tests are organized with pytest markers:
213
+
214
+ - **Unit tests**: Fast tests that mock libvirt/system calls (default)
215
+ - **E2E tests**: End-to-end tests requiring actual VM creation (marked with `@pytest.mark.e2e`)
216
+ - **Slow tests**: Tests that take longer to run (marked with `@pytest.mark.slow`)
217
+
218
+ E2E tests are automatically skipped when:
219
+ - libvirt is not installed
220
+ - `/dev/kvm` is not available
221
+ - Running in CI environment (`CI=true` or `GITHUB_ACTIONS=true`)
222
+
223
+ ### Manual Test Execution
224
+
225
+ ```bash
226
+ # Run only unit tests (exclude e2e)
227
+ pytest tests/ -m "not e2e"
228
+
229
+ # Run only e2e tests
230
+ pytest tests/e2e/ -m "e2e" -v
231
+
232
+ # Run specific test file
233
+ pytest tests/test_cloner.py -v
234
+
235
+ # Run with coverage
236
+ pytest tests/ -m "not e2e" --cov=clonebox --cov-report=html
237
+ ```
238
+
171
239
  ## Quick Start
172
240
 
173
241
  ### Interactive Mode (Recommended)
@@ -258,22 +326,53 @@ ls ~/.mozilla/firefox # Firefox profile
258
326
  ls ~/.config/JetBrains # PyCharm settings
259
327
  ```
260
328
 
261
- ### Testing VM Configuration
329
+ ### Testing and Validating VM Configuration
262
330
 
263
331
  ```bash
264
332
  # Quick test - basic checks
265
333
  clonebox test . --user --quick
266
334
 
267
- # Full test with verbose output
268
- clonebox test . --user --verbose
269
-
270
- # Test output shows:
271
- # ✅ VM is defined in libvirt
272
- # ✅ VM is running
273
- # ✅ VM has network access (IP: 192.168.122.89)
274
- # ✅ Cloud-init completed
275
- # ✅ All mount points accessible
276
- # ✅ Health check triggered
335
+ # Full validation - checks EVERYTHING against YAML config
336
+ clonebox test . --user --validate
337
+
338
+ # Validation checks:
339
+ # ✅ All mount points (paths + app_data_paths) are mounted and accessible
340
+ # ✅ All APT packages are installed
341
+ # ✅ All snap packages are installed
342
+ # ✅ All services are enabled and running
343
+ # ✅ Reports file counts for each mount
344
+ # ✅ Shows package versions
345
+ # ✅ Comprehensive summary table
346
+
347
+ # Example output:
348
+ # 💾 Validating Mount Points...
349
+ # ┌─────────────────────────┬─────────┬────────────┬────────┐
350
+ # │ Guest Path │ Mounted │ Accessible │ Files │
351
+ # ├─────────────────────────┼─────────┼────────────┼────────┤
352
+ # │ /home/ubuntu/Downloads │ ✅ │ ✅ │ 199 │
353
+ # │ ~/.config/JetBrains │ ✅ │ ✅ │ 45 │
354
+ # └─────────────────────────┴─────────┴────────────┴────────┘
355
+ # 12/14 mounts working
356
+ #
357
+ # 📦 Validating APT Packages...
358
+ # ┌─────────────────┬──────────────┬────────────┐
359
+ # │ Package │ Status │ Version │
360
+ # ├─────────────────┼──────────────┼────────────┤
361
+ # │ firefox │ ✅ Installed │ 122.0+b... │
362
+ # │ docker.io │ ✅ Installed │ 24.0.7-... │
363
+ # └─────────────────┴──────────────┴────────────┘
364
+ # 8/8 packages installed
365
+ #
366
+ # 📊 Validation Summary
367
+ # ┌────────────────┬────────┬────────┬───────┐
368
+ # │ Category │ Passed │ Failed │ Total │
369
+ # ├────────────────┼────────┼────────┼───────┤
370
+ # │ Mounts │ 12 │ 2 │ 14 │
371
+ # │ APT Packages │ 8 │ 0 │ 8 │
372
+ # │ Snap Packages │ 2 │ 0 │ 2 │
373
+ # │ Services │ 5 │ 1 │ 6 │
374
+ # │ TOTAL │ 27 │ 3 │ 30 │
375
+ # └────────────────┴────────┴────────┴───────┘
277
376
  ```
278
377
 
279
378
  ### VM Health Monitoring and Mount Validation
@@ -601,7 +700,8 @@ clonebox clone . --network auto
601
700
  | `clonebox detect --json` | Output as JSON |
602
701
  | `clonebox status . --user` | Check VM health, cloud-init, IP, and mount status |
603
702
  | `clonebox status . --user --health` | Check VM status and run full health check |
604
- | `clonebox test . --user` | Test VM configuration and validate all settings |
703
+ | `clonebox test . --user` | Test VM configuration (basic checks) |
704
+ | `clonebox test . --user --validate` | Full validation: mounts, packages, services vs YAML |
605
705
  | `clonebox export . --user` | Export VM for migration to another workstation |
606
706
  | `clonebox export . --user --include-data` | Export VM with browser profiles and configs |
607
707
  | `clonebox import archive.tar.gz --user` | Import VM from export archive |
@@ -1,43 +1,10 @@
1
- Metadata-Version: 2.4
2
- Name: clonebox
3
- Version: 0.1.14
4
- Summary: Clone your workstation environment to an isolated VM with selective apps, paths and services
5
- Author: CloneBox Team
6
- License: Apache-2.0
7
- Project-URL: Homepage, https://github.com/wronai/clonebox
8
- Project-URL: Repository, https://github.com/wronai/clonebox
9
- Project-URL: Issues, https://github.com/wronai/clonebox/issues
10
- Keywords: vm,virtualization,libvirt,clone,workstation,qemu,kvm
11
- Classifier: Development Status :: 4 - Beta
12
- Classifier: Environment :: Console
13
- Classifier: Intended Audience :: Developers
14
- Classifier: Intended Audience :: System Administrators
15
- Classifier: License :: OSI Approved :: Apache Software License
16
- Classifier: Operating System :: POSIX :: Linux
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.8
19
- Classifier: Programming Language :: Python :: 3.9
20
- Classifier: Programming Language :: Python :: 3.10
21
- Classifier: Programming Language :: Python :: 3.11
22
- Classifier: Programming Language :: Python :: 3.12
23
- Classifier: Topic :: System :: Systems Administration
24
- Classifier: Topic :: Utilities
25
- Requires-Python: >=3.8
26
- Description-Content-Type: text/markdown
27
- License-File: LICENSE
28
- Requires-Dist: libvirt-python>=9.0.0
29
- Requires-Dist: rich>=13.0.0
30
- Requires-Dist: questionary>=2.0.0
31
- Requires-Dist: psutil>=5.9.0
32
- Requires-Dist: pyyaml>=6.0
33
- Provides-Extra: dev
34
- Requires-Dist: pytest>=7.0.0; extra == "dev"
35
- Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
36
- Requires-Dist: black>=23.0.0; extra == "dev"
37
- Requires-Dist: ruff>=0.1.0; extra == "dev"
38
- Dynamic: license-file
39
-
40
1
  # CloneBox 📦
2
+
3
+ [![CI](https://github.com/wronai/clonebox/workflows/CI/badge.svg)](https://github.com/wronai/clonebox/actions)
4
+ [![PyPI version](https://badge.fury.io/py/clonebox.svg)](https://pypi.org/project/clonebox/)
5
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
6
+ [![License](https://img.shields.io/badge/license-Apache%202.0-green.svg)](LICENSE)
7
+
41
8
  ![img.png](img.png)
42
9
 
43
10
  ```commandline
@@ -51,7 +18,8 @@ Dynamic: license-file
51
18
  ║ Clone your workstation to an isolated VM ║
52
19
  ╚═══════════════════════════════════════════════════════╝
53
20
  ```
54
- **Clone your workstation environment to an isolated VM with selective apps, paths and services.**
21
+
22
+ > **Clone your workstation environment to an isolated VM in 60 seconds using bind mounts instead of disk cloning.**
55
23
 
56
24
  CloneBox lets you create isolated virtual machines with only the applications, directories and services you need - using bind mounts instead of full disk cloning. Perfect for development, testing, or creating reproducible environments.
57
25
 
@@ -168,6 +136,61 @@ clonebox stop <name> # Zatrzymaj VM
168
136
  clonebox delete <name> # Usuń VM
169
137
  ```
170
138
 
139
+ ## Development and Testing
140
+
141
+ ### Running Tests
142
+
143
+ CloneBox has comprehensive test coverage with unit tests and end-to-end tests:
144
+
145
+ ```bash
146
+ # Run unit tests only (fast, no libvirt required)
147
+ make test
148
+
149
+ # Run fast unit tests (excludes slow tests)
150
+ make test-unit
151
+
152
+ # Run end-to-end tests (requires libvirt/KVM)
153
+ make test-e2e
154
+
155
+ # Run all tests including e2e
156
+ make test-all
157
+
158
+ # Run tests with coverage
159
+ make test-cov
160
+
161
+ # Run tests with verbose output
162
+ make test-verbose
163
+ ```
164
+
165
+ ### Test Categories
166
+
167
+ Tests are organized with pytest markers:
168
+
169
+ - **Unit tests**: Fast tests that mock libvirt/system calls (default)
170
+ - **E2E tests**: End-to-end tests requiring actual VM creation (marked with `@pytest.mark.e2e`)
171
+ - **Slow tests**: Tests that take longer to run (marked with `@pytest.mark.slow`)
172
+
173
+ E2E tests are automatically skipped when:
174
+ - libvirt is not installed
175
+ - `/dev/kvm` is not available
176
+ - Running in CI environment (`CI=true` or `GITHUB_ACTIONS=true`)
177
+
178
+ ### Manual Test Execution
179
+
180
+ ```bash
181
+ # Run only unit tests (exclude e2e)
182
+ pytest tests/ -m "not e2e"
183
+
184
+ # Run only e2e tests
185
+ pytest tests/e2e/ -m "e2e" -v
186
+
187
+ # Run specific test file
188
+ pytest tests/test_cloner.py -v
189
+
190
+ # Run with coverage
191
+ pytest tests/ -m "not e2e" --cov=clonebox --cov-report=html
192
+ ```
193
+
171
194
  ## Quick Start
172
195
 
173
196
  ### Interactive Mode (Recommended)
@@ -258,22 +281,53 @@ ls ~/.mozilla/firefox # Firefox profile
258
281
  ls ~/.config/JetBrains # PyCharm settings
259
282
  ```
260
283
 
261
- ### Testing VM Configuration
284
+ ### Testing and Validating VM Configuration
262
285
 
263
286
  ```bash
264
287
  # Quick test - basic checks
265
288
  clonebox test . --user --quick
266
289
 
267
- # Full test with verbose output
268
- clonebox test . --user --verbose
269
-
270
- # Test output shows:
271
- # ✅ VM is defined in libvirt
272
- # ✅ VM is running
273
- # ✅ VM has network access (IP: 192.168.122.89)
274
- # ✅ Cloud-init completed
275
- # ✅ All mount points accessible
276
- # ✅ Health check triggered
290
+ # Full validation - checks EVERYTHING against YAML config
291
+ clonebox test . --user --validate
292
+
293
+ # Validation checks:
294
+ # ✅ All mount points (paths + app_data_paths) are mounted and accessible
295
+ # ✅ All APT packages are installed
296
+ # ✅ All snap packages are installed
297
+ # ✅ All services are enabled and running
298
+ # ✅ Reports file counts for each mount
299
+ # ✅ Shows package versions
300
+ # ✅ Comprehensive summary table
301
+
302
+ # Example output:
303
+ # 💾 Validating Mount Points...
304
+ # ┌─────────────────────────┬─────────┬────────────┬────────┐
305
+ # │ Guest Path │ Mounted │ Accessible │ Files │
306
+ # ├─────────────────────────┼─────────┼────────────┼────────┤
307
+ # │ /home/ubuntu/Downloads │ ✅ │ ✅ │ 199 │
308
+ # │ ~/.config/JetBrains │ ✅ │ ✅ │ 45 │
309
+ # └─────────────────────────┴─────────┴────────────┴────────┘
310
+ # 12/14 mounts working
311
+ #
312
+ # 📦 Validating APT Packages...
313
+ # ┌─────────────────┬──────────────┬────────────┐
314
+ # │ Package │ Status │ Version │
315
+ # ├─────────────────┼──────────────┼────────────┤
316
+ # │ firefox │ ✅ Installed │ 122.0+b... │
317
+ # │ docker.io │ ✅ Installed │ 24.0.7-... │
318
+ # └─────────────────┴──────────────┴────────────┘
319
+ # 8/8 packages installed
320
+ #
321
+ # 📊 Validation Summary
322
+ # ┌────────────────┬────────┬────────┬───────┐
323
+ # │ Category │ Passed │ Failed │ Total │
324
+ # ├────────────────┼────────┼────────┼───────┤
325
+ # │ Mounts │ 12 │ 2 │ 14 │
326
+ # │ APT Packages │ 8 │ 0 │ 8 │
327
+ # │ Snap Packages │ 2 │ 0 │ 2 │
328
+ # │ Services │ 5 │ 1 │ 6 │
329
+ # │ TOTAL │ 27 │ 3 │ 30 │
330
+ # └────────────────┴────────┴────────┴───────┘
277
331
  ```
278
332
 
279
333
  ### VM Health Monitoring and Mount Validation
@@ -601,7 +655,8 @@ clonebox clone . --network auto
601
655
  | `clonebox detect --json` | Output as JSON |
602
656
  | `clonebox status . --user` | Check VM health, cloud-init, IP, and mount status |
603
657
  | `clonebox status . --user --health` | Check VM status and run full health check |
604
- | `clonebox test . --user` | Test VM configuration and validate all settings |
658
+ | `clonebox test . --user` | Test VM configuration (basic checks) |
659
+ | `clonebox test . --user --validate` | Full validation: mounts, packages, services vs YAML |
605
660
  | `clonebox export . --user` | Export VM for migration to another workstation |
606
661
  | `clonebox export . --user --include-data` | Export VM with browser profiles and configs |
607
662
  | `clonebox import archive.tar.gz --user` | Import VM from export archive |
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "clonebox"
7
- version = "0.1.14"
7
+ version = "0.1.16"
8
8
  description = "Clone your workstation environment to an isolated VM with selective apps, paths and services"
9
9
  readme = "README.md"
10
10
  license = {text = "Apache-2.0"}
@@ -36,6 +36,7 @@ dependencies = [
36
36
  "questionary>=2.0.0",
37
37
  "psutil>=5.9.0",
38
38
  "pyyaml>=6.0",
39
+ "pydantic>=2.0.0",
39
40
  ]
40
41
 
41
42
  [project.optional-dependencies]
@@ -44,6 +45,12 @@ dev = [
44
45
  "pytest-cov>=4.0.0",
45
46
  "black>=23.0.0",
46
47
  "ruff>=0.1.0",
48
+ "mypy>=1.0.0",
49
+ ]
50
+ test = [
51
+ "pytest>=7.0.0",
52
+ "pytest-cov>=4.0.0",
53
+ "pytest-timeout>=2.0.0",
47
54
  ]
48
55
 
49
56
  [project.scripts]
@@ -64,3 +71,31 @@ target-version = ["py38", "py39", "py310", "py311", "py312"]
64
71
  [tool.ruff]
65
72
  line-length = 100
66
73
  select = ["E", "F", "W", "I", "N", "UP", "B", "C4"]
74
+
75
+ [tool.pytest.ini_options]
76
+ minversion = "7.0"
77
+ testpaths = ["tests"]
78
+ python_files = ["test_*.py"]
79
+ python_classes = ["Test*"]
80
+ python_functions = ["test_*"]
81
+ markers = [
82
+ "e2e: end-to-end tests requiring libvirt/KVM (deselect with '-m \"not e2e\"')",
83
+ "slow: slow tests (deselect with '-m \"not slow\"')",
84
+ "integration: integration tests",
85
+ "requires_kvm: tests requiring /dev/kvm access",
86
+ ]
87
+ addopts = [
88
+ "-ra",
89
+ "--strict-markers",
90
+ "--strict-config",
91
+ "--showlocals",
92
+ "--cov=src/clonebox",
93
+ "--cov-report=term-missing",
94
+ "--cov-fail-under=30",
95
+ ]
96
+ filterwarnings = [
97
+ "error",
98
+ "ignore::DeprecationWarning",
99
+ "ignore::PendingDeprecationWarning",
100
+ "ignore::UserWarning",
101
+ ]