aws-bootstrap-g4dn 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.
- aws_bootstrap_g4dn-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- aws_bootstrap_g4dn-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- aws_bootstrap_g4dn-0.1.0/.github/workflows/ci.yml +48 -0
- aws_bootstrap_g4dn-0.1.0/.github/workflows/publish-to-pypi.yml +108 -0
- aws_bootstrap_g4dn-0.1.0/.gitignore +172 -0
- aws_bootstrap_g4dn-0.1.0/.pre-commit-config.yaml +38 -0
- aws_bootstrap_g4dn-0.1.0/CLAUDE.md +134 -0
- aws_bootstrap_g4dn-0.1.0/CODE_OF_CONDUCT.md +128 -0
- aws_bootstrap_g4dn-0.1.0/CONTRIBUTING.md +135 -0
- aws_bootstrap_g4dn-0.1.0/LICENSE +21 -0
- aws_bootstrap_g4dn-0.1.0/PKG-INFO +308 -0
- aws_bootstrap_g4dn-0.1.0/README.md +292 -0
- aws_bootstrap_g4dn-0.1.0/SECURITY.md +14 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/__init__.py +1 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/cli.py +438 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/config.py +24 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/ec2.py +341 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/resources/__init__.py +0 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/resources/gpu_benchmark.py +839 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/resources/gpu_smoke_test.ipynb +340 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/resources/remote_setup.sh +188 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/resources/requirements.txt +8 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/ssh.py +513 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/tests/__init__.py +0 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/tests/test_cli.py +528 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/tests/test_config.py +35 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/tests/test_ec2.py +313 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/tests/test_ssh_config.py +297 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap/tests/test_ssh_gpu.py +138 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap_g4dn.egg-info/PKG-INFO +308 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap_g4dn.egg-info/SOURCES.txt +36 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap_g4dn.egg-info/dependency_links.txt +1 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap_g4dn.egg-info/entry_points.txt +2 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap_g4dn.egg-info/requires.txt +2 -0
- aws_bootstrap_g4dn-0.1.0/aws_bootstrap_g4dn.egg-info/top_level.txt +1 -0
- aws_bootstrap_g4dn-0.1.0/pyproject.toml +77 -0
- aws_bootstrap_g4dn-0.1.0/setup.cfg +4 -0
- aws_bootstrap_g4dn-0.1.0/uv.lock +287 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior:
|
|
15
|
+
1. Go to '...'
|
|
16
|
+
2. Click on '....'
|
|
17
|
+
3. Scroll down to '....'
|
|
18
|
+
4. See error
|
|
19
|
+
|
|
20
|
+
**Expected behavior**
|
|
21
|
+
A clear and concise description of what you expected to happen.
|
|
22
|
+
|
|
23
|
+
**Screenshots**
|
|
24
|
+
If applicable, add screenshots to help explain your problem.
|
|
25
|
+
|
|
26
|
+
**Desktop (please complete the following information):**
|
|
27
|
+
- OS: [e.g. iOS]
|
|
28
|
+
- Browser [e.g. chrome, safari]
|
|
29
|
+
- Version [e.g. 22]
|
|
30
|
+
|
|
31
|
+
**Smartphone (please complete the following information):**
|
|
32
|
+
- Device: [e.g. iPhone6]
|
|
33
|
+
- OS: [e.g. iOS8.1]
|
|
34
|
+
- Browser [e.g. stock browser, safari]
|
|
35
|
+
- Version [e.g. 22]
|
|
36
|
+
|
|
37
|
+
**Additional context**
|
|
38
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
|
3
|
+
|
|
4
|
+
name: CI
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
pull-requests: write
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
branches: [ "main" ]
|
|
13
|
+
pull_request:
|
|
14
|
+
branches: [ "main" ]
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
build:
|
|
18
|
+
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
strategy:
|
|
21
|
+
fail-fast: false
|
|
22
|
+
matrix:
|
|
23
|
+
python-version: ["3.14"]
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
with:
|
|
28
|
+
fetch-depth: 0
|
|
29
|
+
- name: Install uv and set the python version
|
|
30
|
+
uses: astral-sh/setup-uv@v5
|
|
31
|
+
with:
|
|
32
|
+
python-version: ${{ matrix.python-version }}
|
|
33
|
+
version: "latest"
|
|
34
|
+
- name: Install the project
|
|
35
|
+
run: uv sync --all-extras --dev
|
|
36
|
+
- name: Install ruff
|
|
37
|
+
uses: astral-sh/ruff-action@v3
|
|
38
|
+
with:
|
|
39
|
+
version: "latest"
|
|
40
|
+
src: "./aws_bootstrap"
|
|
41
|
+
- name: Run formatting checks (lint runs as part of ruff-action above)
|
|
42
|
+
run: |
|
|
43
|
+
uv run ruff check aws_bootstrap
|
|
44
|
+
uv run ruff format aws_bootstrap
|
|
45
|
+
- name: Run mypy
|
|
46
|
+
run: uv run mypy aws_bootstrap
|
|
47
|
+
- name: Run tests
|
|
48
|
+
run: uv run pytest
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
build:
|
|
8
|
+
name: Build distribution
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
with:
|
|
14
|
+
fetch-depth: 0
|
|
15
|
+
- name: Set up Python
|
|
16
|
+
uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.x"
|
|
19
|
+
- name: Install pypa/build
|
|
20
|
+
run: python3 -m pip install build --user
|
|
21
|
+
- name: Build a binary wheel and a source tarball
|
|
22
|
+
run: python3 -m build
|
|
23
|
+
- name: Store the distribution packages
|
|
24
|
+
uses: actions/upload-artifact@v4
|
|
25
|
+
with:
|
|
26
|
+
name: python-package-distributions
|
|
27
|
+
path: dist/
|
|
28
|
+
|
|
29
|
+
publish-to-pypi:
|
|
30
|
+
name: Publish to PyPI
|
|
31
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
32
|
+
needs:
|
|
33
|
+
- build
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
environment:
|
|
36
|
+
name: pypi
|
|
37
|
+
url: https://pypi.org/p/aws-bootstrap-g4dn
|
|
38
|
+
permissions:
|
|
39
|
+
id-token: write
|
|
40
|
+
|
|
41
|
+
steps:
|
|
42
|
+
- name: Download all the dists
|
|
43
|
+
uses: actions/download-artifact@v4
|
|
44
|
+
with:
|
|
45
|
+
name: python-package-distributions
|
|
46
|
+
path: dist/
|
|
47
|
+
- name: Publish distribution to PyPI
|
|
48
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
49
|
+
|
|
50
|
+
publish-to-testpypi:
|
|
51
|
+
name: Publish to TestPyPI
|
|
52
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
53
|
+
needs:
|
|
54
|
+
- build
|
|
55
|
+
runs-on: ubuntu-latest
|
|
56
|
+
environment:
|
|
57
|
+
name: testpypi
|
|
58
|
+
url: https://test.pypi.org/p/aws-bootstrap-g4dn
|
|
59
|
+
permissions:
|
|
60
|
+
id-token: write
|
|
61
|
+
|
|
62
|
+
steps:
|
|
63
|
+
- name: Download all the dists
|
|
64
|
+
uses: actions/download-artifact@v4
|
|
65
|
+
with:
|
|
66
|
+
name: python-package-distributions
|
|
67
|
+
path: dist/
|
|
68
|
+
- name: Publish distribution to TestPyPI
|
|
69
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
70
|
+
with:
|
|
71
|
+
repository-url: https://test.pypi.org/legacy/
|
|
72
|
+
|
|
73
|
+
github-release:
|
|
74
|
+
name: Create GitHub Release
|
|
75
|
+
needs:
|
|
76
|
+
- publish-to-pypi
|
|
77
|
+
runs-on: ubuntu-latest
|
|
78
|
+
permissions:
|
|
79
|
+
contents: write
|
|
80
|
+
id-token: write
|
|
81
|
+
|
|
82
|
+
steps:
|
|
83
|
+
- name: Download all the dists
|
|
84
|
+
uses: actions/download-artifact@v4
|
|
85
|
+
with:
|
|
86
|
+
name: python-package-distributions
|
|
87
|
+
path: dist/
|
|
88
|
+
- name: Sign the dists with Sigstore
|
|
89
|
+
uses: sigstore/gh-action-sigstore-python@v3.0.0
|
|
90
|
+
with:
|
|
91
|
+
inputs: >-
|
|
92
|
+
./dist/*.tar.gz
|
|
93
|
+
./dist/*.whl
|
|
94
|
+
- name: Create GitHub Release
|
|
95
|
+
env:
|
|
96
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
97
|
+
run: >-
|
|
98
|
+
gh release create
|
|
99
|
+
"$GITHUB_REF_NAME"
|
|
100
|
+
--repo "$GITHUB_REPOSITORY"
|
|
101
|
+
--notes ""
|
|
102
|
+
- name: Upload artifact signatures to GitHub Release
|
|
103
|
+
env:
|
|
104
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
105
|
+
run: >-
|
|
106
|
+
gh release upload
|
|
107
|
+
"$GITHUB_REF_NAME" dist/**
|
|
108
|
+
--repo "$GITHUB_REPOSITORY"
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# MacOS
|
|
2
|
+
.DS_Store
|
|
3
|
+
|
|
4
|
+
# Byte-compiled / optimized / DLL files
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.py[cod]
|
|
7
|
+
*$py.class
|
|
8
|
+
|
|
9
|
+
# C extensions
|
|
10
|
+
*.so
|
|
11
|
+
|
|
12
|
+
# Distribution / packaging
|
|
13
|
+
.Python
|
|
14
|
+
build/
|
|
15
|
+
develop-eggs/
|
|
16
|
+
dist/
|
|
17
|
+
downloads/
|
|
18
|
+
eggs/
|
|
19
|
+
.eggs/
|
|
20
|
+
lib/
|
|
21
|
+
lib64/
|
|
22
|
+
parts/
|
|
23
|
+
sdist/
|
|
24
|
+
var/
|
|
25
|
+
wheels/
|
|
26
|
+
share/python-wheels/
|
|
27
|
+
*.egg-info/
|
|
28
|
+
.installed.cfg
|
|
29
|
+
*.egg
|
|
30
|
+
MANIFEST
|
|
31
|
+
|
|
32
|
+
# PyInstaller
|
|
33
|
+
# Usually these files are written by a python script from a template
|
|
34
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
35
|
+
*.manifest
|
|
36
|
+
*.spec
|
|
37
|
+
|
|
38
|
+
# Installer logs
|
|
39
|
+
pip-log.txt
|
|
40
|
+
pip-delete-this-directory.txt
|
|
41
|
+
|
|
42
|
+
# Unit test / coverage reports
|
|
43
|
+
htmlcov/
|
|
44
|
+
.tox/
|
|
45
|
+
.nox/
|
|
46
|
+
.coverage
|
|
47
|
+
.coverage.*
|
|
48
|
+
.cache
|
|
49
|
+
nosetests.xml
|
|
50
|
+
coverage.xml
|
|
51
|
+
*.cover
|
|
52
|
+
*.py,cover
|
|
53
|
+
.hypothesis/
|
|
54
|
+
.pytest_cache/
|
|
55
|
+
cover/
|
|
56
|
+
|
|
57
|
+
# Translations
|
|
58
|
+
*.mo
|
|
59
|
+
*.pot
|
|
60
|
+
|
|
61
|
+
# Django stuff:
|
|
62
|
+
*.log
|
|
63
|
+
local_settings.py
|
|
64
|
+
db.sqlite3
|
|
65
|
+
db.sqlite3-journal
|
|
66
|
+
|
|
67
|
+
# Flask stuff:
|
|
68
|
+
instance/
|
|
69
|
+
.webassets-cache
|
|
70
|
+
|
|
71
|
+
# Scrapy stuff:
|
|
72
|
+
.scrapy
|
|
73
|
+
|
|
74
|
+
# Sphinx documentation
|
|
75
|
+
docs/_build/
|
|
76
|
+
|
|
77
|
+
# Do not check in README.md under docs/ - it gets copied there by build-docs CI workflow.
|
|
78
|
+
docs/README.md
|
|
79
|
+
|
|
80
|
+
# PyBuilder
|
|
81
|
+
.pybuilder/
|
|
82
|
+
target/
|
|
83
|
+
|
|
84
|
+
# Jupyter Notebook
|
|
85
|
+
.ipynb_checkpoints
|
|
86
|
+
|
|
87
|
+
# IPython
|
|
88
|
+
profile_default/
|
|
89
|
+
ipython_config.py
|
|
90
|
+
|
|
91
|
+
# pyenv
|
|
92
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
93
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
94
|
+
# .python-version
|
|
95
|
+
|
|
96
|
+
# pipenv
|
|
97
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
98
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
99
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
100
|
+
# install all needed dependencies.
|
|
101
|
+
#Pipfile.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
|
|
110
|
+
# pdm
|
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
112
|
+
#pdm.lock
|
|
113
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
114
|
+
# in version control.
|
|
115
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
116
|
+
.pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
121
|
+
__pypackages__/
|
|
122
|
+
|
|
123
|
+
# Celery stuff
|
|
124
|
+
celerybeat-schedule
|
|
125
|
+
celerybeat.pid
|
|
126
|
+
|
|
127
|
+
# SageMath parsed files
|
|
128
|
+
*.sage.py
|
|
129
|
+
|
|
130
|
+
# direnv
|
|
131
|
+
.envrc
|
|
132
|
+
|
|
133
|
+
# Environments
|
|
134
|
+
.python-version
|
|
135
|
+
.env
|
|
136
|
+
.venv
|
|
137
|
+
env/
|
|
138
|
+
venv/
|
|
139
|
+
ENV/
|
|
140
|
+
env.bak/
|
|
141
|
+
venv.bak/
|
|
142
|
+
|
|
143
|
+
# Spyder project settings
|
|
144
|
+
.spyderproject
|
|
145
|
+
.spyproject
|
|
146
|
+
|
|
147
|
+
# Rope project settings
|
|
148
|
+
.ropeproject
|
|
149
|
+
|
|
150
|
+
# mkdocs documentation
|
|
151
|
+
/site
|
|
152
|
+
|
|
153
|
+
# mypy
|
|
154
|
+
.mypy_cache/
|
|
155
|
+
.dmypy.json
|
|
156
|
+
dmypy.json
|
|
157
|
+
|
|
158
|
+
# Pyre type checker
|
|
159
|
+
.pyre/
|
|
160
|
+
|
|
161
|
+
# pytype static type analyzer
|
|
162
|
+
.pytype/
|
|
163
|
+
|
|
164
|
+
# Cython debug symbols
|
|
165
|
+
cython_debug/
|
|
166
|
+
|
|
167
|
+
# PyCharm
|
|
168
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
169
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
170
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
171
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
172
|
+
#.idea/
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
fail_fast: true
|
|
2
|
+
repos:
|
|
3
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
4
|
+
rev: v6.0.0
|
|
5
|
+
hooks:
|
|
6
|
+
- id: check-added-large-files
|
|
7
|
+
args: [ --maxkb=8192 ]
|
|
8
|
+
- id: fix-byte-order-marker
|
|
9
|
+
- id: check-case-conflict
|
|
10
|
+
- id: check-json
|
|
11
|
+
- id: check-yaml
|
|
12
|
+
args: [ --unsafe ]
|
|
13
|
+
- id: detect-aws-credentials
|
|
14
|
+
args: [ --allow-missing-credentials ]
|
|
15
|
+
- id: detect-private-key
|
|
16
|
+
- id: end-of-file-fixer
|
|
17
|
+
- id: trailing-whitespace
|
|
18
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
19
|
+
rev: v0.14.7
|
|
20
|
+
hooks:
|
|
21
|
+
# Run the linter.
|
|
22
|
+
- id: ruff-check
|
|
23
|
+
args: [ --fix ]
|
|
24
|
+
# Run the formatter.
|
|
25
|
+
- id: ruff-format
|
|
26
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
27
|
+
rev: v1.19.0
|
|
28
|
+
hooks:
|
|
29
|
+
- id: mypy
|
|
30
|
+
additional_dependencies: [types-pyyaml>=6.0.12]
|
|
31
|
+
- repo: local
|
|
32
|
+
hooks:
|
|
33
|
+
- id: pytest
|
|
34
|
+
name: pytest [with coverage, without slow]
|
|
35
|
+
entry: bash -ec "uv run python -m pytest . -m 'not slow'"
|
|
36
|
+
language: system
|
|
37
|
+
types: [python]
|
|
38
|
+
pass_filenames: false
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
aws-bootstrap-g4dn is a Python CLI tool (`aws-bootstrap`) that bootstraps AWS EC2 GPU instances (g4dn.xlarge default) running Deep Learning AMIs for hybrid local-remote development. It provisions cost-effective Spot Instances via boto3 with SSH key import, security group setup, instance polling, and remote setup automation.
|
|
8
|
+
|
|
9
|
+
Target workflows: Jupyter server-client, VSCode Remote SSH, and NVIDIA Nsight remote debugging.
|
|
10
|
+
|
|
11
|
+
## Tech Stack & Requirements
|
|
12
|
+
|
|
13
|
+
- **Python 3.14+** with **uv** package manager (astral-sh/uv) — used for venv creation, dependency management, and running the project
|
|
14
|
+
- **boto3** — AWS SDK for EC2 provisioning (AMI lookup, security groups, instance launch, waiters)
|
|
15
|
+
- **click** — CLI framework with built-in color support (`click.secho`, `click.style`)
|
|
16
|
+
- **setuptools + setuptools-scm** — build backend with git-tag-based versioning (configured in pyproject.toml)
|
|
17
|
+
- **AWS CLI v2** with a configured AWS profile (`AWS_PROFILE` env var or `--profile` flag)
|
|
18
|
+
- **direnv** for automatic venv activation (`.envrc` sources `.venv/bin/activate`)
|
|
19
|
+
|
|
20
|
+
## Development Setup
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
uv venv .venv
|
|
24
|
+
uv sync
|
|
25
|
+
direnv allow # or manually: source .venv/bin/activate
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Project Structure
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
aws_bootstrap/
|
|
32
|
+
__init__.py # Package init
|
|
33
|
+
cli.py # Click CLI entry point (launch, status, terminate commands)
|
|
34
|
+
config.py # LaunchConfig dataclass with defaults
|
|
35
|
+
ec2.py # AMI lookup, security group, instance launch/find/terminate, polling, spot pricing
|
|
36
|
+
ssh.py # SSH key pair import, SSH readiness check, remote setup, ~/.ssh/config management
|
|
37
|
+
resources/ # Non-Python artifacts SCP'd to remote instances
|
|
38
|
+
__init__.py
|
|
39
|
+
gpu_benchmark.py # GPU throughput benchmark (CNN + Transformer), copied to ~/gpu_benchmark.py on instance
|
|
40
|
+
gpu_smoke_test.ipynb # Interactive Jupyter notebook for GPU verification, copied to ~/gpu_smoke_test.ipynb
|
|
41
|
+
remote_setup.sh # Uploaded & run on instance post-boot (GPU verify, Jupyter, etc.)
|
|
42
|
+
requirements.txt # Python dependencies installed on the remote instance
|
|
43
|
+
tests/ # Unit tests (pytest)
|
|
44
|
+
test_config.py
|
|
45
|
+
test_cli.py
|
|
46
|
+
test_ec2.py
|
|
47
|
+
test_ssh_config.py
|
|
48
|
+
test_ssh_gpu.py
|
|
49
|
+
docs/
|
|
50
|
+
spot-request-lifecycle.md # Research notes on spot request cleanup
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Entry point: `aws-bootstrap = "aws_bootstrap.cli:main"` (installed via `uv sync`)
|
|
54
|
+
|
|
55
|
+
## CLI Commands
|
|
56
|
+
|
|
57
|
+
- **`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`
|
|
58
|
+
- **`status`** — lists all non-terminated instances (including `shutting-down`) with type, IP, SSH alias, 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`)
|
|
59
|
+
- **`terminate`** — terminates instances by ID or all aws-bootstrap instances in the region; removes SSH config aliases
|
|
60
|
+
- **`list instance-types`** — lists EC2 instance types matching a family prefix (default: `g4dn`), showing vCPUs, memory, and GPU info
|
|
61
|
+
- **`list amis`** — lists available AMIs matching a name pattern (default: Deep Learning Base OSS Nvidia Driver GPU AMIs), sorted newest-first
|
|
62
|
+
|
|
63
|
+
## Coding Conventions
|
|
64
|
+
|
|
65
|
+
- **Linting**: `ruff check` — line length 120, rules: E, F, UP, B, SIM, I, PLC
|
|
66
|
+
- **Formatting**: `ruff format` — double quotes, isort via ruff
|
|
67
|
+
- **Type checking**: `mypy` with `ignore_missing_imports = true`
|
|
68
|
+
- **Testing**: `pytest`
|
|
69
|
+
- **All-in-one**: `pre-commit run --all` runs the full chain (ruff check, ruff format, mypy, pytest)
|
|
70
|
+
|
|
71
|
+
After making changes, run:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pre-commit run --all
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Or run tools individually:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
uv run ruff check aws_bootstrap/
|
|
81
|
+
uv run ruff format aws_bootstrap/
|
|
82
|
+
uv run mypy aws_bootstrap/
|
|
83
|
+
uv run pytest
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Use `uv add <package>` to add dependencies and `uv add --group dev <package>` for dev dependencies.
|
|
87
|
+
|
|
88
|
+
## CUDA-Aware PyTorch Installation
|
|
89
|
+
|
|
90
|
+
`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`.
|
|
91
|
+
|
|
92
|
+
The `KNOWN_CUDA_TAGS` array in `remote_setup.sh` lists the CUDA wheel tags published by PyTorch (e.g., `118 121 124 126 128 129 130`). When PyTorch adds support for a new CUDA version, add the corresponding tag to this array. Check available tags at: https://download.pytorch.org/whl/
|
|
93
|
+
|
|
94
|
+
`torch` and `torchvision` are **not** in `resources/requirements.txt` — they are installed separately by the CUDA detection logic in `remote_setup.sh`. All other Python dependencies remain in `requirements.txt`.
|
|
95
|
+
|
|
96
|
+
## Remote Setup Details
|
|
97
|
+
|
|
98
|
+
`remote_setup.sh` also:
|
|
99
|
+
- Creates `~/venv` and appends `source ~/venv/bin/activate` to `~/.bashrc` so the venv is auto-activated on SSH login
|
|
100
|
+
- Runs a quick CUDA smoke test (`torch.cuda.is_available()` + GPU matmul) after PyTorch installation to verify the GPU stack; prints a WARNING on failure but does not abort
|
|
101
|
+
- Copies `gpu_benchmark.py` to `~/gpu_benchmark.py` and `gpu_smoke_test.ipynb` to `~/gpu_smoke_test.ipynb`
|
|
102
|
+
|
|
103
|
+
## GPU Benchmark
|
|
104
|
+
|
|
105
|
+
`resources/gpu_benchmark.py` is uploaded to `~/gpu_benchmark.py` on the remote instance during setup. It benchmarks GPU throughput with two modes: CNN on MNIST and a GPT-style Transformer on synthetic data. It reports samples/sec, batch times, and peak GPU memory. Supports `--precision` (fp32/fp16/bf16/tf32), `--diagnose` for CUDA smoke tests, and separate `--transformer-batch-size` (default 32, T4-safe). Dependencies (`torch`, `torchvision`, `tqdm`) are already installed by the setup script.
|
|
106
|
+
|
|
107
|
+
## Versioning & Publishing
|
|
108
|
+
|
|
109
|
+
Version is derived automatically from git tags via **setuptools-scm** — no hardcoded version string in the codebase.
|
|
110
|
+
|
|
111
|
+
- **Tagged commits** (e.g. `0.1.0`) produce exact versions
|
|
112
|
+
- **Between tags**, setuptools-scm generates dev versions like `0.1.1.dev5+gabcdef` (valid PEP 440)
|
|
113
|
+
- `click.version_option(package_name="aws-bootstrap-g4dn")` in `cli.py` reads from package metadata — works automatically
|
|
114
|
+
|
|
115
|
+
### Release process
|
|
116
|
+
|
|
117
|
+
1. Create and push a git tag: `git tag X.Y.Z && git push origin X.Y.Z`
|
|
118
|
+
2. The `publish-to-pypi.yml` workflow triggers on tag push and:
|
|
119
|
+
- Builds wheel + sdist
|
|
120
|
+
- Publishes to PyPI and TestPyPI via OIDC trusted publishing
|
|
121
|
+
- Creates a GitHub Release with Sigstore-signed artifacts
|
|
122
|
+
|
|
123
|
+
### Required one-time setup (repo owner)
|
|
124
|
+
|
|
125
|
+
- **PyPI trusted publisher**: https://pypi.org/manage/account/publishing/ — add publisher for `aws-bootstrap-g4dn`, workflow `publish-to-pypi.yml`, environment `pypi`
|
|
126
|
+
- **TestPyPI trusted publisher**: same at https://test.pypi.org/manage/account/publishing/, environment `testpypi`
|
|
127
|
+
- **GitHub environments**: create `pypi` and `testpypi` environments at repo Settings > Environments
|
|
128
|
+
|
|
129
|
+
## Keeping Docs Updated
|
|
130
|
+
|
|
131
|
+
When making changes that affect project setup, CLI interface, dependencies, project structure, or development workflows, update **README.md** and **CLAUDE.md** accordingly:
|
|
132
|
+
|
|
133
|
+
- **README.md** — user-facing: installation, usage examples, CLI options, AWS setup/quota instructions
|
|
134
|
+
- **CLAUDE.md** — agent-facing: project overview, tech stack, project structure, coding conventions
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
aws-bootstrap-g4dn at gmail dot com.
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series
|
|
86
|
+
of actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
|
93
|
+
permanent ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
113
|
+
the community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.0, available at
|
|
119
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
122
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
123
|
+
|
|
124
|
+
[homepage]: https://www.contributor-covenant.org
|
|
125
|
+
|
|
126
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
127
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
|
128
|
+
https://www.contributor-covenant.org/translations.
|