aws-bootstrap-g4dn 0.6.0__tar.gz → 0.7.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 (49) hide show
  1. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/.pre-commit-config.yaml +2 -2
  2. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/CLAUDE.md +18 -0
  3. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/PKG-INFO +27 -1
  4. aws_bootstrap_g4dn-0.6.0/aws_bootstrap_g4dn.egg-info/PKG-INFO → aws_bootstrap_g4dn-0.7.0/README.md +24 -19
  5. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/cli.py +348 -96
  6. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/ec2.py +9 -8
  7. aws_bootstrap_g4dn-0.7.0/aws_bootstrap/output.py +106 -0
  8. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/ssh.py +21 -20
  9. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/tests/test_cli.py +280 -0
  10. aws_bootstrap_g4dn-0.7.0/aws_bootstrap/tests/test_output.py +192 -0
  11. aws_bootstrap_g4dn-0.6.0/README.md → aws_bootstrap_g4dn-0.7.0/aws_bootstrap_g4dn.egg-info/PKG-INFO +45 -0
  12. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap_g4dn.egg-info/SOURCES.txt +2 -0
  13. aws_bootstrap_g4dn-0.7.0/aws_bootstrap_g4dn.egg-info/requires.txt +4 -0
  14. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/pyproject.toml +5 -1
  15. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/uv.lock +101 -21
  16. aws_bootstrap_g4dn-0.6.0/aws_bootstrap_g4dn.egg-info/requires.txt +0 -2
  17. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  18. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  19. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/.github/workflows/ci.yml +0 -0
  20. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/.github/workflows/publish-to-pypi.yml +0 -0
  21. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/.gitignore +0 -0
  22. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/CODE_OF_CONDUCT.md +0 -0
  23. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/CONTRIBUTING.md +0 -0
  24. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/LICENSE +0 -0
  25. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/SECURITY.md +0 -0
  26. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/__init__.py +0 -0
  27. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/config.py +0 -0
  28. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/gpu.py +0 -0
  29. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/resources/__init__.py +0 -0
  30. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/resources/gpu_benchmark.py +0 -0
  31. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/resources/gpu_smoke_test.ipynb +0 -0
  32. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/resources/launch.json +0 -0
  33. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/resources/remote_setup.sh +0 -0
  34. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/resources/requirements.txt +0 -0
  35. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/resources/saxpy.cu +0 -0
  36. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/resources/tasks.json +0 -0
  37. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/tests/__init__.py +0 -0
  38. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/tests/test_config.py +0 -0
  39. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/tests/test_ebs.py +0 -0
  40. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/tests/test_ec2.py +0 -0
  41. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/tests/test_gpu.py +0 -0
  42. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/tests/test_ssh_config.py +0 -0
  43. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/tests/test_ssh_ebs.py +0 -0
  44. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap/tests/test_ssh_gpu.py +0 -0
  45. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap_g4dn.egg-info/dependency_links.txt +0 -0
  46. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap_g4dn.egg-info/entry_points.txt +0 -0
  47. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/aws_bootstrap_g4dn.egg-info/top_level.txt +0 -0
  48. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/docs/nsight-remote-profiling.md +0 -0
  49. {aws_bootstrap_g4dn-0.6.0 → aws_bootstrap_g4dn-0.7.0}/setup.cfg +0 -0
@@ -17,7 +17,7 @@ repos:
17
17
  - id: end-of-file-fixer
18
18
  - id: trailing-whitespace
19
19
  - repo: https://github.com/astral-sh/ruff-pre-commit
20
- rev: v0.14.7
20
+ rev: v0.15.0
21
21
  hooks:
22
22
  # Run the linter.
23
23
  - id: ruff-check
@@ -28,7 +28,7 @@ repos:
28
28
  rev: v1.19.0
29
29
  hooks:
30
30
  - id: mypy
31
- additional_dependencies: [types-pyyaml>=6.0.12]
31
+ additional_dependencies: [types-pyyaml>=6.0.12, types-tabulate>=0.9]
32
32
  - repo: local
33
33
  hooks:
34
34
  - id: pytest
@@ -13,6 +13,8 @@ Target workflows: Jupyter server-client, VSCode Remote SSH, and NVIDIA Nsight re
13
13
  - **Python 3.12+** with **uv** package manager (astral-sh/uv) — used for venv creation, dependency management, and running the project
14
14
  - **boto3** — AWS SDK for EC2 provisioning (AMI lookup, security groups, instance launch, waiters)
15
15
  - **click** — CLI framework with built-in color support (`click.secho`, `click.style`)
16
+ - **pyyaml** — YAML serialization for `--output yaml`
17
+ - **tabulate** — Table formatting for `--output table`
16
18
  - **setuptools + setuptools-scm** — build backend with git-tag-based versioning (configured in pyproject.toml)
17
19
  - **AWS CLI v2** with a configured AWS profile (`AWS_PROFILE` env var or `--profile` flag)
18
20
  - **direnv** for automatic venv activation (`.envrc` sources `.venv/bin/activate`)
@@ -34,6 +36,7 @@ aws_bootstrap/
34
36
  config.py # LaunchConfig dataclass with defaults
35
37
  ec2.py # AMI lookup, security group, instance launch/find/terminate, polling, spot pricing, EBS volume ops
36
38
  gpu.py # GPU architecture mapping and GpuInfo dataclass
39
+ output.py # Output formatting: OutputFormat enum, emit(), echo/secho wrappers for structured output
37
40
  ssh.py # SSH key pair import, SSH readiness check, remote setup, ~/.ssh/config management, GPU queries, EBS mount
38
41
  resources/ # Non-Python artifacts SCP'd to remote instances
39
42
  __init__.py
@@ -48,6 +51,7 @@ aws_bootstrap/
48
51
  test_config.py
49
52
  test_cli.py
50
53
  test_ec2.py
54
+ test_output.py
51
55
  test_gpu.py
52
56
  test_ssh_config.py
53
57
  test_ssh_gpu.py
@@ -62,6 +66,8 @@ Entry point: `aws-bootstrap = "aws_bootstrap.cli:main"` (installed via `uv sync`
62
66
 
63
67
  ## CLI Commands
64
68
 
69
+ **Global option:** `--output` / `-o` controls output format: `text` (default, human-readable with color), `json`, `yaml`, `table`. Structured formats (json/yaml/table) suppress all progress messages and emit machine-readable output. Commands requiring confirmation (`terminate`, `cleanup`) require `--yes` in structured modes.
70
+
65
71
  - **`launch`** — provisions an EC2 instance (spot by default, falls back to on-demand on capacity errors); adds SSH config alias (e.g. `aws-gpu1`) to `~/.ssh/config`; `--python-version` controls which Python `uv` installs in the remote venv; `--ssh-port` overrides the default SSH port (22) for security group ingress, connection checks, and SSH config; `--ebs-storage SIZE` creates and attaches a new gp3 EBS data volume (mounted at `/data`); `--ebs-volume-id ID` attaches an existing EBS volume (mutually exclusive with `--ebs-storage`)
66
72
  - **`status`** — lists all non-terminated instances (including `shutting-down`) with type, IP, SSH alias, EBS data volumes, pricing (spot price/hr or on-demand), uptime, and estimated cost for running spot instances; `--gpu` flag queries GPU info via SSH, reporting both CUDA toolkit version (from `nvcc`) and driver-supported max (from `nvidia-smi`); `--instructions` (default: on) prints connection commands (SSH, Jupyter tunnel, VSCode Remote SSH, GPU benchmark) for each running instance; suppress with `--no-instructions`
67
73
  - **`terminate`** — terminates instances by ID or SSH alias (e.g. `aws-gpu1`, resolved via `~/.ssh/config`), or all aws-bootstrap instances in the region if no arguments given; removes SSH config aliases; deletes associated EBS data volumes by default; `--keep-ebs` preserves volumes and prints reattach commands
@@ -94,6 +100,18 @@ uv run pytest
94
100
 
95
101
  Use `uv add <package>` to add dependencies and `uv add --group dev <package>` for dev dependencies.
96
102
 
103
+ ## Structured Output Architecture
104
+
105
+ The `--output` option uses a context-aware suppression pattern via `aws_bootstrap/output.py`:
106
+
107
+ - **`output.echo()` / `output.secho()`** — wrap `click.echo`/`click.secho`; silent in non-text modes. Used in `ec2.py` and `ssh.py` for progress messages.
108
+ - **`is_text(ctx)`** — checks if the current output format is text. Used in `cli.py` to guard text-only blocks.
109
+ - **`emit(data, headers=..., ctx=...)`** — dispatches structured data to JSON/YAML/table renderers. No-op in text mode.
110
+ - **CLI helper guards** — `step()`, `info()`, `val()`, `success()`, `warn()` in `cli.py` check `is_text()` and return early in structured modes.
111
+ - Each CLI command builds a result dict alongside existing logic, emits it via `emit()` for non-text formats, and falls through to text output for text mode.
112
+ - **Confirmation prompts** (`terminate`, `cleanup`) require `--yes` in structured modes to avoid corrupting output.
113
+ - The spot-fallback `click.confirm()` in `ec2.py` auto-confirms in structured modes.
114
+
97
115
  ## CUDA-Aware PyTorch Installation
98
116
 
99
117
  `remote_setup.sh` detects the CUDA toolkit version on the instance (via `nvcc`, falling back to `nvidia-smi`) and installs PyTorch from the matching CUDA wheel index (`https://download.pytorch.org/whl/cu{TAG}`). This ensures `torch.version.cuda` matches the system's CUDA toolkit, which is required for compiling custom CUDA extensions with `nvcc`.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aws-bootstrap-g4dn
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: Bootstrap AWS EC2 GPU instances for hybrid local-remote development
5
5
  Author: Adam Ever-Hadani
6
6
  License-Expression: MIT
@@ -15,6 +15,8 @@ Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
16
  Requires-Dist: boto3>=1.35
17
17
  Requires-Dist: click>=8.1
18
+ Requires-Dist: pyyaml>=6.0.3
19
+ Requires-Dist: tabulate>=0.9.0
18
20
  Dynamic: license-file
19
21
 
20
22
  # aws-bootstrap-g4dn
@@ -232,6 +234,30 @@ Then install the [Nsight VSCE extension](https://marketplace.visualstudio.com/it
232
234
 
233
235
  See [Nsight remote profiling guide](docs/nsight-remote-profiling.md) for more details on CUDA debugging and profiling workflows.
234
236
 
237
+ ### 📤 Structured Output
238
+
239
+ All commands support `--output` / `-o` for machine-readable output — useful for scripting, piping to `jq`, or LLM tool-use:
240
+
241
+ ```bash
242
+ # JSON output (pipe to jq)
243
+ aws-bootstrap -o json status
244
+ aws-bootstrap -o json status | jq '.instances[0].instance_id'
245
+
246
+ # YAML output
247
+ aws-bootstrap -o yaml status
248
+
249
+ # Table output
250
+ aws-bootstrap -o table status
251
+
252
+ # Works with all commands
253
+ aws-bootstrap -o json list instance-types | jq '.[].instance_type'
254
+ aws-bootstrap -o json launch --dry-run
255
+ aws-bootstrap -o json terminate --yes
256
+ aws-bootstrap -o json cleanup --dry-run
257
+ ```
258
+
259
+ Supported formats: `text` (default, human-readable with color), `json`, `yaml`, `table`. Commands that require confirmation (`terminate`, `cleanup`) require `--yes` in structured output modes.
260
+
235
261
  ### 📋 Listing Resources
236
262
 
237
263
  ```bash
@@ -1,22 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: aws-bootstrap-g4dn
3
- Version: 0.6.0
4
- Summary: Bootstrap AWS EC2 GPU instances for hybrid local-remote development
5
- Author: Adam Ever-Hadani
6
- License-Expression: MIT
7
- Project-URL: Homepage, https://github.com/promptromp/aws-bootstrap-g4dn
8
- Project-URL: Issues, https://github.com/promptromp/aws-bootstrap-g4dn/issues
9
- Keywords: aws,ec2,gpu,cuda,deep-learning,spot-instances,cli
10
- Classifier: Programming Language :: Python :: 3.12
11
- Classifier: Programming Language :: Python :: 3.13
12
- Classifier: Programming Language :: Python :: 3.14
13
- Requires-Python: >=3.12
14
- Description-Content-Type: text/markdown
15
- License-File: LICENSE
16
- Requires-Dist: boto3>=1.35
17
- Requires-Dist: click>=8.1
18
- Dynamic: license-file
19
-
20
1
  # aws-bootstrap-g4dn
21
2
 
22
3
  --------------------------------------------------------------------------------
@@ -232,6 +213,30 @@ Then install the [Nsight VSCE extension](https://marketplace.visualstudio.com/it
232
213
 
233
214
  See [Nsight remote profiling guide](docs/nsight-remote-profiling.md) for more details on CUDA debugging and profiling workflows.
234
215
 
216
+ ### 📤 Structured Output
217
+
218
+ All commands support `--output` / `-o` for machine-readable output — useful for scripting, piping to `jq`, or LLM tool-use:
219
+
220
+ ```bash
221
+ # JSON output (pipe to jq)
222
+ aws-bootstrap -o json status
223
+ aws-bootstrap -o json status | jq '.instances[0].instance_id'
224
+
225
+ # YAML output
226
+ aws-bootstrap -o yaml status
227
+
228
+ # Table output
229
+ aws-bootstrap -o table status
230
+
231
+ # Works with all commands
232
+ aws-bootstrap -o json list instance-types | jq '.[].instance_type'
233
+ aws-bootstrap -o json launch --dry-run
234
+ aws-bootstrap -o json terminate --yes
235
+ aws-bootstrap -o json cleanup --dry-run
236
+ ```
237
+
238
+ Supported formats: `text` (default, human-readable with color), `json`, `yaml`, `table`. Commands that require confirmation (`terminate`, `cleanup`) require `--yes` in structured output modes.
239
+
235
240
  ### 📋 Listing Resources
236
241
 
237
242
  ```bash