esim-tool-manager 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.
Files changed (27) hide show
  1. esim_tool_manager-0.1.0/PKG-INFO +599 -0
  2. esim_tool_manager-0.1.0/README.md +580 -0
  3. esim_tool_manager-0.1.0/pyproject.toml +47 -0
  4. esim_tool_manager-0.1.0/setup.cfg +4 -0
  5. esim_tool_manager-0.1.0/src/esim_manager/__init__.py +0 -0
  6. esim_tool_manager-0.1.0/src/esim_manager/cli.py +558 -0
  7. esim_tool_manager-0.1.0/src/esim_manager/config.py +20 -0
  8. esim_tool_manager-0.1.0/src/esim_manager/dependency.py +286 -0
  9. esim_tool_manager-0.1.0/src/esim_manager/detector.py +32 -0
  10. esim_tool_manager-0.1.0/src/esim_manager/installer.py +299 -0
  11. esim_tool_manager-0.1.0/src/esim_manager/locator.py +39 -0
  12. esim_tool_manager-0.1.0/src/esim_manager/logger.py +63 -0
  13. esim_tool_manager-0.1.0/src/esim_manager/main.py +5 -0
  14. esim_tool_manager-0.1.0/src/esim_manager/path_manager.py +80 -0
  15. esim_tool_manager-0.1.0/src/esim_manager/tools.json +43 -0
  16. esim_tool_manager-0.1.0/src/esim_manager/version.py +32 -0
  17. esim_tool_manager-0.1.0/src/esim_tool_manager.egg-info/PKG-INFO +599 -0
  18. esim_tool_manager-0.1.0/src/esim_tool_manager.egg-info/SOURCES.txt +25 -0
  19. esim_tool_manager-0.1.0/src/esim_tool_manager.egg-info/dependency_links.txt +1 -0
  20. esim_tool_manager-0.1.0/src/esim_tool_manager.egg-info/entry_points.txt +2 -0
  21. esim_tool_manager-0.1.0/src/esim_tool_manager.egg-info/requires.txt +3 -0
  22. esim_tool_manager-0.1.0/src/esim_tool_manager.egg-info/top_level.txt +1 -0
  23. esim_tool_manager-0.1.0/tests/test_config.py +38 -0
  24. esim_tool_manager-0.1.0/tests/test_detector.py +27 -0
  25. esim_tool_manager-0.1.0/tests/test_locator.py +17 -0
  26. esim_tool_manager-0.1.0/tests/test_path_manager.py +36 -0
  27. esim_tool_manager-0.1.0/tests/test_version.py +32 -0
@@ -0,0 +1,599 @@
1
+ Metadata-Version: 2.4
2
+ Name: esim-tool-manager
3
+ Version: 0.1.0
4
+ Summary: Automated external tool manager for eSim
5
+ Author: Sachin Kharote
6
+ Keywords: esim,tool-manager,kicad,ngspice,electronics,automation
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Environment :: Console
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Operating System :: Microsoft :: Windows
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
+ Requires-Python: >=3.11
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: typer
17
+ Requires-Dist: rich
18
+ Requires-Dist: packaging
19
+
20
+ # eSim Tool Manager
21
+
22
+ <p align="center">
23
+ <img src="https://img.shields.io/badge/platform-Windows-0078D6?style=flat-square&logo=windows" alt="platform" />
24
+ <img src="https://img.shields.io/badge/python-3.10%2B-3776AB?style=flat-square&logo=python&logoColor=white" alt="python" />
25
+ <img src="https://img.shields.io/badge/tests-17%20passed-brightgreen?style=flat-square&logo=pytest&logoColor=white" alt="tests" />
26
+ <img src="https://img.shields.io/badge/status-functional%20prototype-yellow?style=flat-square" alt="status" />
27
+ <img src="https://img.shields.io/badge/license-unspecified-lightgrey?style=flat-square" alt="license" />
28
+ </p>
29
+
30
+ <p align="center">
31
+ Automated external tool manager for <strong>eSim</strong> on Windows โ€” detect, install, configure, and verify the tools an eSim development environment needs, from one CLI.
32
+ </p>
33
+
34
+ ---
35
+
36
+ ## Table of Contents
37
+
38
+ - [Overview](#overview)
39
+ - [Features](#features)
40
+ - [Supported Tools](#supported-tools)
41
+ - [Requirements](#requirements)
42
+ - [Installation](#installation)
43
+ - [Command-Line Interface](#command-line-interface)
44
+ - [Status](#check-tool-status)
45
+ - [Install](#install-tools)
46
+ - [Configure](#configure-kicad)
47
+ - [Dependencies](#check-dependencies)
48
+ - [Update](#update-checking)
49
+ - [Configuration](#configuration)
50
+ - [Architecture](#architecture)
51
+ - [Project Structure](#project-structure)
52
+ - [Testing](#testing)
53
+ - [Logging](#logging)
54
+ - [Error Handling](#error-handling)
55
+ - [Design Approach](#design-approach)
56
+ - [Current Limitations](#current-limitations)
57
+ - [Future Improvements](#future-improvements)
58
+ - [Development](#development)
59
+ - [Example Verified Environment](#example-verified-environment)
60
+ - [License](#license)
61
+ - [Project Status](#project-status)
62
+
63
+ ---
64
+
65
+ ## Overview
66
+
67
+ eSim relies on a handful of external tools โ€” KiCad, Ngspice, Python, Git โ€” that each need to be detected, version-checked, installed, and (in KiCad's case) wired into the system `PATH` before eSim can use them. **eSim Tool Manager** wraps all of that into a single configuration-driven CLI so a new eSim setup goes from "nothing installed" to "verified and ready" in a few commands.
68
+
69
+ ```mermaid
70
+ flowchart LR
71
+ A["New Windows machine"] --> B["esim-tool-manager status"]
72
+ B --> C{"Tools missing or\noutdated?"}
73
+ C -- Yes --> D["esim-tool-manager install <tool>"]
74
+ D --> E["esim-tool-manager configure kicad"]
75
+ E --> F["esim-tool-manager check-dependencies"]
76
+ C -- No --> F
77
+ F --> G["Ready for eSim development"]
78
+ ```
79
+
80
+ ---
81
+
82
+ ## Features
83
+
84
+ | Category | Capability |
85
+ |---|---|
86
+ | ๐Ÿ” Detection | Detect installed external tools and report their versions |
87
+ | โœ… Compatibility | Check installed versions against configured minimums |
88
+ | ๐Ÿ“ฆ Installation | Install supported tools automatically (`winget`, direct download) |
89
+ | ๐Ÿงฉ KiCad | Install via Windows Package Manager, locate `kicad-cli.exe`, configure PATH |
90
+ | โšก Ngspice | Install via a configured direct-download archive using 7-Zip |
91
+ | ๐Ÿ”— Dependencies | Check required system dependencies (WinGet, 7-Zip, Python, Git) |
92
+ | ๐Ÿ”„ Updates | Check for available tool updates |
93
+ | ๐Ÿ—’๏ธ Logging | Maintain application logs for diagnostics |
94
+ | โš™๏ธ Configuration | Tool definitions driven entirely by `config/tools.json` |
95
+ | ๐Ÿงช Testing | Automated test suite using `pytest` |
96
+
97
+ ---
98
+
99
+ ## Supported Tools
100
+
101
+ | Tool | Detection | Installation | Version Check | Configuration | Min. Version |
102
+ |------|:---------:|:-------------|:--------------:|:--------------:|:-------------:|
103
+ | **Ngspice** | โœ… | Direct download | โœ… | โœ… | `47` |
104
+ | **KiCad** | โœ… | `winget` | โœ… | โœ… | `8` |
105
+ | **Python** | โœ… | `winget` | โœ… | โ€” | `3.10` |
106
+ | **Git** | โœ… | `winget` | โœ… | โ€” | `2.0` |
107
+
108
+ ---
109
+
110
+ ## Requirements
111
+
112
+ ### System Requirements
113
+
114
+ - Windows 10/11
115
+ - Python 3.10 or newer
116
+ - Git
117
+ - Windows Package Manager (`winget`)
118
+ - 7-Zip for Ngspice installation
119
+
120
+ Python dependencies are defined in `requirements.txt`.
121
+
122
+ ---
123
+
124
+ ## Installation
125
+
126
+ ```mermaid
127
+ flowchart TD
128
+ A["git clone repository-url"] --> B["python -m venv .venv"]
129
+ B --> C[".\\.venv\\Scripts\\Activate.ps1"]
130
+ C --> D["pip install -r requirements.txt"]
131
+ D --> E["pip install -e ."]
132
+ E --> F["esim-tool-manager --help"]
133
+ ```
134
+
135
+ ### 1. Clone the repository
136
+
137
+ ```powershell
138
+ git clone <repository-url>
139
+ cd esim-tool-manager
140
+ ```
141
+
142
+ ### 2. Create a virtual environment
143
+
144
+ ```powershell
145
+ python -m venv .venv
146
+ ```
147
+
148
+ ### 3. Activate the virtual environment
149
+
150
+ ```powershell
151
+ .\.venv\Scripts\Activate.ps1
152
+ ```
153
+
154
+ If PowerShell blocks script execution, run:
155
+
156
+ ```powershell
157
+ Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned
158
+ ```
159
+
160
+ Then activate the environment again:
161
+
162
+ ```powershell
163
+ .\.venv\Scripts\Activate.ps1
164
+ ```
165
+
166
+ ### 4. Install Python dependencies
167
+
168
+ ```powershell
169
+ pip install -r requirements.txt
170
+ ```
171
+
172
+ ### 5. Install the project
173
+
174
+ ```powershell
175
+ pip install -e .
176
+ ```
177
+
178
+ ### 6. Verify the CLI
179
+
180
+ ```powershell
181
+ esim-tool-manager --help
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Command-Line Interface
187
+
188
+ | Command | Purpose |
189
+ |---|---|
190
+ | `status` | Report installed tools, versions, and compatibility |
191
+ | `install` | Install a configured tool automatically |
192
+ | `configure` | Locate and configure a tool (e.g., KiCad CLI on PATH) |
193
+ | `update` | Check configured tools for available updates |
194
+ | `check-dependencies` | Verify system and development dependencies |
195
+
196
+ ```powershell
197
+ esim-tool-manager --help
198
+ ```
199
+
200
+ ### Check Tool Status
201
+
202
+ ```powershell
203
+ esim-tool-manager status
204
+ ```
205
+
206
+ ```text
207
+ eSim Tool Manager
208
+ =================
209
+
210
+ โœ“ Ngspice: Installed
211
+
212
+ โœ“ KiCad: Installed
213
+ Version: 10.0.5
214
+ Required: >= 8
215
+ Compatibility: โœ“ Compatible
216
+
217
+ โœ“ Python: Installed
218
+ Version: 3.11.0
219
+ Required: >= 3.10
220
+ Compatibility: โœ“ Compatible
221
+
222
+ โœ“ Git: Installed
223
+ Version: 2.55.0
224
+ Required: >= 2.0
225
+ Compatibility: โœ“ Compatible
226
+ ```
227
+
228
+ ### Install Tools
229
+
230
+ ```powershell
231
+ esim-tool-manager install <tool_name>
232
+ ```
233
+
234
+ ```powershell
235
+ esim-tool-manager install kicad
236
+ esim-tool-manager install ngspice
237
+ ```
238
+
239
+ The installation method is determined by the tool configuration.
240
+
241
+ #### KiCad
242
+
243
+ Installed through Windows Package Manager using the configured package ID `KiCad.KiCad`.
244
+
245
+ #### Ngspice
246
+
247
+ ```mermaid
248
+ flowchart TD
249
+ A["Check 7-Zip availability"] --> B["Create installation directory"]
250
+ B --> C["Download configured Ngspice archive"]
251
+ C --> D["Extract archive with 7-Zip"]
252
+ D --> E["Search for ngspice executable"]
253
+ E --> F["Report discovered executable"]
254
+ ```
255
+
256
+ ### Configure KiCad
257
+
258
+ ```powershell
259
+ esim-tool-manager configure kicad
260
+ ```
261
+
262
+ ```mermaid
263
+ flowchart TD
264
+ A["Start configure kicad"] --> B{"kicad-cli.exe\non system PATH?"}
265
+ B -- Yes --> E["Already configured"]
266
+ B -- No --> C["Search %LOCALAPPDATA%\\Programs\\KiCad"]
267
+ C --> D{"Found?"}
268
+ D -- Yes --> F["Add containing directory to user PATH"]
269
+ D -- No --> G["Report not found"]
270
+ ```
271
+
272
+ ```text
273
+ eSim Tool Manager - Configuration
274
+ =================================
275
+
276
+ Searching for KiCad...
277
+
278
+ โœ“ Found: C:\Users\<user>\AppData\Local\Programs\KiCad\10.0\bin\kicad-cli.exe
279
+
280
+ Configuring PATH...
281
+
282
+ โœ“ PATH configured successfully.
283
+ ```
284
+
285
+ ### Check Dependencies
286
+
287
+ ```powershell
288
+ esim-tool-manager check-dependencies
289
+ ```
290
+
291
+ ```text
292
+ Dependency Check
293
+ ================
294
+
295
+ System Dependencies
296
+ -------------------
297
+ โœ“ WinGet: Available
298
+ โœ“ 7-Zip: Available
299
+
300
+ Development Tools
301
+ -----------------
302
+ โœ“ Python: Python 3.11.0
303
+ โœ“ Git: git version 2.55.0.windows.3
304
+
305
+ eSim External Tools
306
+ -------------------
307
+ โœ“ KiCad: 10.0.5
308
+ โœ“ Ngspice: Available
309
+
310
+ ========================
311
+ โœ“ All required dependencies are available.
312
+ ```
313
+
314
+ ### Update Checking
315
+
316
+ ```powershell
317
+ esim-tool-manager update
318
+ esim-tool-manager update kicad
319
+ ```
320
+
321
+ ```text
322
+ eSim Tool Manager - Update
323
+ ==========================
324
+
325
+ Checking updates for KiCad...
326
+
327
+ No available upgrade found.
328
+ No newer package versions are available from the configured sources.
329
+ ```
330
+
331
+ ---
332
+
333
+ ## Configuration
334
+
335
+ Tool definitions live in `config/tools.json`, keeping tool-specific information separate from application logic.
336
+
337
+ Each tool can define:
338
+
339
+ | Field | Description |
340
+ |---|---|
341
+ | `name` | Internal tool identifier |
342
+ | `display_name` | Human-readable name |
343
+ | `command` | Executable command |
344
+ | `version_command` | Command used to query the installed version |
345
+ | `required_version` | Minimum compatible version |
346
+ | `install_method` | e.g. `winget`, direct download |
347
+ | `package_id` | Package identifier for the install method |
348
+ | download info | Direct-download source details |
349
+ | install dependencies | Prerequisites needed before install |
350
+
351
+ Example KiCad configuration:
352
+
353
+ ```json
354
+ {
355
+ "name": "kicad",
356
+ "display_name": "KiCad",
357
+ "command": "kicad-cli",
358
+ "version_command": [
359
+ "kicad-cli",
360
+ "--version"
361
+ ],
362
+ "required_version": "8",
363
+ "install_method": "winget",
364
+ "package_id": "KiCad.KiCad"
365
+ }
366
+ ```
367
+
368
+ ---
369
+
370
+ ## Architecture
371
+
372
+ ```mermaid
373
+ flowchart TD
374
+ CLI["CLI โ€” cli.py"]
375
+
376
+ CLI --> Detector["Detector โ€” detector.py"]
377
+ CLI --> Installer["Installer โ€” installer.py"]
378
+ CLI --> Dependency["Dependency โ€” dependency.py"]
379
+
380
+ Detector --> Version["Version โ€” version.py"]
381
+ Installer --> Locator["Locator โ€” locator.py"]
382
+ Dependency --> PathMgr["PATH Manager โ€” path_manager.py"]
383
+
384
+ CLI --> Config["Config โ€” config.py"]
385
+ CLI --> Logger["Logger โ€” logger.py"]
386
+
387
+ style CLI fill:#4C6EF5,color:#fff
388
+ style Config fill:#495057,color:#fff
389
+ style Logger fill:#495057,color:#fff
390
+ ```
391
+
392
+ | Module | File | Responsibility |
393
+ |---|---|---|
394
+ | CLI | `cli.py` | User-facing commands: `status`, `install`, `configure`, `update`, `check-dependencies` |
395
+ | Configuration | `config.py` | Loads tool definitions from `config/tools.json` |
396
+ | Detection | `detector.py` | Determines whether external commands are available and retrieves reported versions |
397
+ | Version Management | `version.py` | Extracts version numbers and checks against configured minimums |
398
+ | Installation | `installer.py` | Handles `winget` and direct-archive installation |
399
+ | KiCad Locator | `locator.py` | Locates `kicad-cli.exe`, including the standard per-user install directory |
400
+ | PATH Management | `path_manager.py` | Adds tool directories to the current user's Windows PATH |
401
+ | Dependency Checking | `dependency.py` | Checks system and development dependencies |
402
+ | Logging | `logger.py` | Application logging for operations and diagnostics |
403
+
404
+ ---
405
+
406
+ ## Project Structure
407
+
408
+ ```text
409
+ esim-tool-manager/
410
+ โ”‚
411
+ โ”œโ”€โ”€ config/
412
+ โ”‚ โ””โ”€โ”€ tools.json
413
+ โ”‚
414
+ โ”œโ”€โ”€ docs/
415
+ โ”‚
416
+ โ”œโ”€โ”€ logs/
417
+ โ”‚
418
+ โ”œโ”€โ”€ src/
419
+ โ”‚ โ””โ”€โ”€ esim_manager/
420
+ โ”‚ โ”œโ”€โ”€ __init__.py
421
+ โ”‚ โ”œโ”€โ”€ cli.py
422
+ โ”‚ โ”œโ”€โ”€ config.py
423
+ โ”‚ โ”œโ”€โ”€ dependency.py
424
+ โ”‚ โ”œโ”€โ”€ detector.py
425
+ โ”‚ โ”œโ”€โ”€ installer.py
426
+ โ”‚ โ”œโ”€โ”€ locator.py
427
+ โ”‚ โ”œโ”€โ”€ logger.py
428
+ โ”‚ โ”œโ”€โ”€ main.py
429
+ โ”‚ โ”œโ”€โ”€ path_manager.py
430
+ โ”‚ โ””โ”€โ”€ version.py
431
+ โ”‚
432
+ โ”œโ”€โ”€ tests/
433
+ โ”‚ โ”œโ”€โ”€ test_config.py
434
+ โ”‚ โ”œโ”€โ”€ test_detector.py
435
+ โ”‚ โ”œโ”€โ”€ test_locator.py
436
+ โ”‚ โ”œโ”€โ”€ test_path_manager.py
437
+ โ”‚ โ””โ”€โ”€ test_version.py
438
+ โ”‚
439
+ โ”œโ”€โ”€ .gitignore
440
+ โ”œโ”€โ”€ pyproject.toml
441
+ โ”œโ”€โ”€ README.md
442
+ โ””โ”€โ”€ requirements.txt
443
+ ```
444
+
445
+ ---
446
+
447
+ ## Testing
448
+
449
+ ```powershell
450
+ python -m pytest
451
+ ```
452
+
453
+ | Area covered | Status |
454
+ |---|:---:|
455
+ | Configuration loading | โœ… |
456
+ | Tool detection | โœ… |
457
+ | Installed tool checks | โœ… |
458
+ | Version extraction | โœ… |
459
+ | Version compatibility | โœ… |
460
+ | PATH management | โœ… |
461
+ | KiCad executable location | โœ… |
462
+
463
+ ```text
464
+ collected 17 items
465
+
466
+ 17 passed
467
+ ```
468
+
469
+ ---
470
+
471
+ ## Logging
472
+
473
+ Application logs are stored in `logs/`, with the main log file at `logs/esim_manager.log`. Logging records important operations such as status checks and dependency checks. Log files are excluded from Git via `.gitignore`.
474
+
475
+ ---
476
+
477
+ ## Error Handling
478
+
479
+ The application handles common failures such as:
480
+
481
+ - Tool not installed
482
+ - Unknown tool name
483
+ - Missing package configuration
484
+ - Missing WinGet
485
+ - Missing 7-Zip
486
+ - Failed downloads
487
+ - Failed archive extraction
488
+ - Missing executables after installation
489
+ - PATH configuration failures
490
+ - Unsupported installation methods
491
+ - Unsupported operating systems
492
+
493
+ The CLI returns a non-zero exit code when an operation fails.
494
+
495
+ ---
496
+
497
+ ## Design Approach
498
+
499
+ The project follows a modular, configuration-driven design: instead of hard-coding every tool into the CLI, tool information lives in `tools.json`. This gives:
500
+
501
+ - Easier addition of new tools
502
+ - Centralized version requirements
503
+ - Centralized installation configuration
504
+ - Separation between configuration and application logic
505
+ - Easier testing and maintenance
506
+
507
+ Detection, installation, version handling, PATH management, dependency checking, and logging are each isolated into individual modules.
508
+
509
+ ---
510
+
511
+ ## Current Limitations
512
+
513
+ - Installation methods are tool-specific.
514
+ - Linux and macOS support are not currently implemented.
515
+ - Some update mechanisms depend on the capabilities of the configured package source.
516
+ - PATH changes may require a new terminal/process before all applications recognize them.
517
+ - The current test suite focuses primarily on deterministic modules rather than performing real software installations.
518
+
519
+ ---
520
+
521
+ ## Future Improvements
522
+
523
+ | Priority area | Improvement |
524
+ |---|---|
525
+ | Platform support | Linux support, macOS support |
526
+ | Installation | Additional package-manager backends, more installation methods, installation rollback support |
527
+ | Reliability | Better recovery from failed installations, automatic PATH refresh across existing processes |
528
+ | Updates | Improved update support for direct-download tools |
529
+ | Testing | More comprehensive integration testing, continuous integration testing |
530
+ | Reporting | More detailed installation reports |
531
+ | Tooling | Additional eSim-specific external tools |
532
+ | Usability | GUI interface for users who do not want to use the CLI |
533
+
534
+ ---
535
+
536
+ ## Development
537
+
538
+ ```powershell
539
+ python -m venv .venv
540
+ .\.venv\Scripts\Activate.ps1
541
+ pip install -r requirements.txt
542
+ pip install -e .
543
+ esim-tool-manager --help
544
+ esim-tool-manager status
545
+ esim-tool-manager check-dependencies
546
+ python -m pytest
547
+ ```
548
+
549
+ ---
550
+
551
+ ## Example Verified Environment
552
+
553
+ | Component | Version |
554
+ |---|---|
555
+ | Operating System | Windows |
556
+ | Python | 3.11.0 |
557
+ | Git | 2.55.0 |
558
+ | KiCad | 10.0.5 |
559
+ | Ngspice | 47 |
560
+ | Pytest | 9.1.1 |
561
+ | Automated Tests | 17 passed |
562
+
563
+ ```text
564
+ โœ“ WinGet: Available
565
+ โœ“ 7-Zip: Available
566
+ โœ“ Python: Available
567
+ โœ“ Git: Available
568
+ โœ“ KiCad: Available
569
+ โœ“ Ngspice: Available
570
+
571
+ โœ“ All required dependencies are available.
572
+ ```
573
+
574
+ ---
575
+
576
+ ## License
577
+
578
+ This project currently does not specify a separate open-source license.
579
+
580
+ ---
581
+
582
+ ## Project Status
583
+
584
+ **Current status: Functional prototype**
585
+
586
+ ```mermaid
587
+ pie showData
588
+ title Feature Coverage
589
+ "Implemented" : 13
590
+ "Planned / Future" : 8
591
+ ```
592
+
593
+ The core implementation currently provides tool detection, version checking, version compatibility checking, KiCad installation through WinGet, Ngspice direct installation, KiCad CLI discovery, PATH configuration, dependency checking, update checking, logging, configuration-driven tool definitions, a command-line interface, and automated testing.
594
+
595
+ ```text
596
+ 17 passed
597
+ ```
598
+
599
+ The project is ready for further refinement, documentation, integration testing, and expansion of supported installation methods.