aws-annoying 0.7.0__tar.gz → 0.8.1__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 (131) hide show
  1. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.devcontainer/devcontainer.json +1 -3
  2. aws_annoying-0.8.1/.devcontainer/onCreateCommand.sh +3 -0
  3. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.github/workflows/ci.yaml +4 -4
  4. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.github/workflows/release.yaml +5 -4
  5. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.vscode/extensions.json +0 -5
  6. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.vscode/settings.json +0 -8
  7. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/Makefile +2 -2
  8. aws_annoying-0.8.1/PKG-INFO +91 -0
  9. aws_annoying-0.8.1/README.md +73 -0
  10. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/app.py +30 -1
  11. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/ecs/task_definition_lifecycle.py +0 -3
  12. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/logging_handler.py +3 -3
  13. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/mfa/configure.py +13 -8
  14. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/session_manager/install.py +6 -2
  15. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/session_manager/port_forward.py +21 -11
  16. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/session_manager/start.py +5 -1
  17. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/session_manager/stop.py +9 -3
  18. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/pyproject.toml +8 -5
  19. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/_helpers/string_.py +8 -1
  20. {aws_annoying-0.7.0/tests/cli/ecs/snapshots/test_task_definition_lifecycle/test_dry_run → aws_annoying-0.8.1/tests/cli/ecs/snapshots/test_task_definition_lifecycle/test_delete}/stdout.txt +0 -1
  21. aws_annoying-0.8.1/tests/cli/ecs/snapshots/test_task_definition_lifecycle/test_dry_run/stdout.txt +20 -0
  22. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/ecs/test_task_definition_lifecycle.py +60 -21
  23. aws_annoying-0.8.1/tests/cli/mfa/snapshots/test_configure/test_basic/persist/stdout.txt +3 -0
  24. aws_annoying-0.8.1/tests/cli/mfa/snapshots/test_configure/test_basic/skip_persist/stdout.txt +3 -0
  25. aws_annoying-0.8.1/tests/cli/mfa/snapshots/test_configure/test_dry_run/stdout.txt +4 -0
  26. aws_annoying-0.8.1/tests/cli/mfa/snapshots/test_configure/test_load_existing_config/stdout.txt +4 -0
  27. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/mfa/test_configure.py +50 -4
  28. aws_annoying-0.7.0/tests/session_manager/test_session_manager.py → aws_annoying-0.8.1/tests/cli/session_manager/test_install.py +3 -3
  29. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/snapshots/test_load_variables/test_basic/stdout.txt +4 -4
  30. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/snapshots/test_load_variables/test_env_prefix/stdout.txt +6 -6
  31. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/snapshots/test_load_variables/test_overwrite_env/stdout.txt +6 -6
  32. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/snapshots/test_load_variables/test_resource_not_found/ssm/stdout.txt +3 -3
  33. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/snapshots/test_load_variables/test_unsupported_resource/stdout.txt +3 -3
  34. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/test_load_variables.py +2 -1
  35. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/uv.lock +52 -47
  36. aws_annoying-0.7.0/.devcontainer/onCreateCommand.sh +0 -1
  37. aws_annoying-0.7.0/PKG-INFO +0 -86
  38. aws_annoying-0.7.0/README.md +0 -51
  39. aws_annoying-0.7.0/tests/cli/mfa/snapshots/test_configure/test_basic/persist/stdout.txt +0 -3
  40. aws_annoying-0.7.0/tests/cli/mfa/snapshots/test_configure/test_basic/skip_persist/stdout.txt +0 -3
  41. aws_annoying-0.7.0/tests/cli/mfa/snapshots/test_configure/test_load_existing_config/stdout.txt +0 -4
  42. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.devcontainer/.env.example +0 -0
  43. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.devcontainer/Dockerfile +0 -0
  44. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.devcontainer/docker-compose.devcontainer.yaml +0 -0
  45. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.devcontainer/postAttachCommand.sh +0 -0
  46. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.editorconfig +0 -0
  47. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.gitattributes +0 -0
  48. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.github/dependabot.yaml +0 -0
  49. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.gitignore +0 -0
  50. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.pre-commit-config.yaml +0 -0
  51. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.python-version +0 -0
  52. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/.vscode/launch.json +0 -0
  53. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/LICENSE +0 -0
  54. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/__init__.py +0 -0
  55. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/__init__.py +0 -0
  56. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/ecs/__init__.py +0 -0
  57. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/ecs/_app.py +0 -0
  58. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/ecs/wait_for_deployment.py +0 -0
  59. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/load_variables.py +0 -0
  60. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/main.py +0 -0
  61. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/mfa/__init__.py +0 -0
  62. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/mfa/_app.py +0 -0
  63. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/session_manager/__init__.py +0 -0
  64. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/session_manager/_app.py +0 -0
  65. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/cli/session_manager/_common.py +0 -0
  66. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/ecs/__init__.py +0 -0
  67. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/ecs/check.py +0 -0
  68. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/ecs/common.py +0 -0
  69. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/ecs/errors.py +0 -0
  70. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/ecs/wait_for.py +0 -0
  71. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/mfa_config.py +0 -0
  72. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/session_manager/__init__.py +0 -0
  73. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/session_manager/errors.py +0 -0
  74. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/session_manager/session_manager.py +0 -0
  75. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/session_manager/shortcuts.py +0 -0
  76. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/utils/__init__.py +0 -0
  77. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/utils/debugger.py +0 -0
  78. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/utils/downloader.py +0 -0
  79. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/utils/ec2.py +0 -0
  80. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/utils/platform.py +0 -0
  81. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/utils/timeout.py +0 -0
  82. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/aws_annoying/variable_loader.py +0 -0
  83. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/console/ecs-exec/README.md +0 -0
  84. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/console/ecs-exec/ecs-console.png +0 -0
  85. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/console/ecs-exec/ecs-exec.user.js +0 -0
  86. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/console/ecs-exec/session-manager.png +0 -0
  87. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/examples/dbeaver/README.md +0 -0
  88. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/examples/dbeaver/after-disconnect.png +0 -0
  89. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/examples/dbeaver/before-connect.png +0 -0
  90. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/examples/dbeaver/new-connection.png +0 -0
  91. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/examples/dbeaver/test-connection.png +0 -0
  92. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/__init__.py +0 -0
  93. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/_helpers.py +0 -0
  94. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/__init__.py +0 -0
  95. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/_helpers/__init__.py +0 -0
  96. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/_helpers/boto3.py +0 -0
  97. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/_helpers/command_builder.py +0 -0
  98. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/_helpers/invoke.py +0 -0
  99. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/_helpers/scripts/printenv.py +0 -0
  100. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/ecs/__init__.py +0 -0
  101. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/ecs/snapshots/test_task_definition_lifecycle/test_basic/stdout.txt +0 -0
  102. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/ecs/test_wait_for_deployment.py +0 -0
  103. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/mfa/__init__.py +0 -0
  104. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/mfa/snapshots/test_configure/test_basic/persist/aws_config.ini +0 -0
  105. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/mfa/snapshots/test_configure/test_load_existing_config/aws_config.ini +0 -0
  106. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/session_manager/__init__.py +0 -0
  107. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/session_manager/test_port_forward.py +0 -0
  108. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/session_manager/test_start.py +0 -0
  109. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/session_manager/test_stop.py +0 -0
  110. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/snapshots/test_load_variables/test_nothing/stdout.txt +0 -0
  111. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/snapshots/test_load_variables/test_replace_quiet/stdout.txt +0 -0
  112. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/test_app.py +0 -0
  113. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/test_logging_handler.py +0 -0
  114. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/cli/test_main.py +0 -0
  115. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/conftest.py +0 -0
  116. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/ecs/__init__.py +0 -0
  117. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/ecs/test_check.py +0 -0
  118. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/ecs/test_common.py +0 -0
  119. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/ecs/test_errors.py +0 -0
  120. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/ecs/test_wait_for.py +0 -0
  121. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/session_manager/__init__.py +0 -0
  122. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/session_manager/test_errors.py +0 -0
  123. /aws_annoying-0.7.0/tests/cli/session_manager/test_install.py → /aws_annoying-0.8.1/tests/session_manager/test_session_manager.py +0 -0
  124. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/session_manager/test_shortcuts.py +0 -0
  125. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/test_mfa_config.py +0 -0
  126. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/test_variable_loader.py +0 -0
  127. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/utils/__init__.py +0 -0
  128. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/utils/test_downloader.py +0 -0
  129. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/utils/test_ec2.py +0 -0
  130. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/utils/test_platform.py +0 -0
  131. {aws_annoying-0.7.0 → aws_annoying-0.8.1}/tests/utils/test_timeout.py +0 -0
@@ -7,10 +7,8 @@
7
7
  "overrideCommand": true,
8
8
  "workspaceFolder": "/workspaces/aws-annoying",
9
9
  "features": {
10
- "ghcr.io/devcontainers-contrib/features/pre-commit:2": {},
11
10
  "ghcr.io/devcontainers/features/docker-in-docker:2": {},
12
- "ghcr.io/devcontainers/features/aws-cli:1": {},
13
- "ghcr.io/lasuillard/devcontainer-features/aws-ssm-session-manager-plugin:0.1": {}
11
+ "ghcr.io/devcontainers/features/aws-cli:1": {}
14
12
  },
15
13
  "onCreateCommand": "./.devcontainer/onCreateCommand.sh",
16
14
  "postAttachCommand": "./.devcontainer/postAttachCommand.sh",
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ pipx install pre-commit
@@ -17,7 +17,7 @@ jobs:
17
17
  runs-on: ubuntu-latest
18
18
  steps:
19
19
  - name: Checkout
20
- uses: actions/checkout@v4
20
+ uses: actions/checkout@v5
21
21
 
22
22
  - name: Set up uv
23
23
  uses: astral-sh/setup-uv@v6
@@ -26,7 +26,7 @@ jobs:
26
26
  enable-cache: true
27
27
 
28
28
  - name: Install deps
29
- run: uv sync --all-extras
29
+ run: uv sync
30
30
 
31
31
  - uses: pre-commit/action@v3.0.1
32
32
  env:
@@ -49,7 +49,7 @@ jobs:
49
49
 
50
50
  steps:
51
51
  - name: Checkout
52
- uses: actions/checkout@v4
52
+ uses: actions/checkout@v5
53
53
 
54
54
  - name: Set up uv
55
55
  uses: astral-sh/setup-uv@v6
@@ -61,7 +61,7 @@ jobs:
61
61
  run: uv python pin "${{ matrix.python-version }}"
62
62
 
63
63
  - name: Install deps
64
- run: uv sync --all-extras
64
+ run: uv sync
65
65
 
66
66
  - name: Run tests (Ubuntu)
67
67
  if: ${{ matrix.os == 'ubuntu-latest' }}
@@ -4,7 +4,8 @@ on:
4
4
  push:
5
5
  tags: [v*]
6
6
 
7
- permissions: read-all
7
+ env:
8
+ UV_FROZEN: 1
8
9
 
9
10
  jobs:
10
11
  release:
@@ -14,7 +15,7 @@ jobs:
14
15
  contents: write
15
16
  steps:
16
17
  - name: Checkout
17
- uses: actions/checkout@v4
18
+ uses: actions/checkout@v5
18
19
 
19
20
  - name: Set up uv
20
21
  uses: astral-sh/setup-uv@v6
@@ -23,7 +24,7 @@ jobs:
23
24
  enable-cache: true
24
25
 
25
26
  - name: Install deps
26
- run: uv sync --frozen --all-extras
27
+ run: uv sync
27
28
 
28
29
  - name: Build package
29
30
  run: uv build
@@ -50,7 +51,7 @@ jobs:
50
51
  environment: pypi
51
52
  steps:
52
53
  - name: Retrieve release distributions
53
- uses: actions/download-artifact@v4
54
+ uses: actions/download-artifact@v5
54
55
  with:
55
56
  name: release-dists
56
57
  path: dist/
@@ -2,16 +2,11 @@
2
2
  "recommendations": [
3
3
  "ms-python.python",
4
4
  "ms-python.vscode-pylance",
5
- "ldez.ignore-files",
6
- "gruntfuggly.todo-tree",
7
- "redhat.vscode-yaml",
8
- "tamasfe.even-better-toml",
9
5
  "streetsidesoftware.code-spell-checker",
10
6
  "editorconfig.editorconfig",
11
7
  "visualstudioexptteam.vscodeintellicode",
12
8
  "charliermarsh.ruff",
13
9
  "ms-python.mypy-type-checker",
14
- "njpwerner.autodocstring",
15
10
  "ms-python.debugpy"
16
11
  ]
17
12
  }
@@ -6,7 +6,6 @@
6
6
  "editor.defaultFormatter": "charliermarsh.ruff",
7
7
  "editor.formatOnSave": true
8
8
  },
9
- "autoDocstring.docstringFormat": "google-notypes",
10
9
  "cSpell.words": [
11
10
  "Deregistering",
12
11
  "localstack",
@@ -17,13 +16,6 @@
17
16
  ],
18
17
  "editor.formatOnSave": true,
19
18
  "files.eol": "\n",
20
- "files.exclude": {
21
- ".mypy_cache": true,
22
- ".pytest_cache": true,
23
- ".ruff_cache": true,
24
- ".venv": true,
25
- "**/__pycache__": true
26
- },
27
19
  "files.insertFinalNewline": true,
28
20
  "json.format.enable": true,
29
21
  "mypy-type-checker.path": [
@@ -19,12 +19,12 @@ help: Makefile ## Show help
19
19
  # =============================================================================
20
20
  install: ## Install the app locally
21
21
  uv python install
22
- uv sync --frozen --all-extras
22
+ uv sync --frozen
23
23
  pre-commit install --install-hooks
24
24
  .PHONY: install
25
25
 
26
26
  update: ## Update deps and tools
27
- uv sync --upgrade --all-extras
27
+ uv sync --upgrade
28
28
  pre-commit autoupdate
29
29
  .PHONY: update
30
30
 
@@ -0,0 +1,91 @@
1
+ Metadata-Version: 2.4
2
+ Name: aws-annoying
3
+ Version: 0.8.1
4
+ Summary: Utils to handle some annoying AWS tasks.
5
+ Project-URL: Homepage, https://github.com/lasuillard/aws-annoying
6
+ Project-URL: Repository, https://github.com/lasuillard/aws-annoying.git
7
+ Project-URL: Issues, https://github.com/lasuillard/aws-annoying/issues
8
+ Author-email: Yuchan Lee <lasuillard@gmail.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Requires-Python: <4.0,>=3.9
12
+ Requires-Dist: boto3<2,>=1
13
+ Requires-Dist: pydantic<3,>=2
14
+ Requires-Dist: requests<3,>=2
15
+ Requires-Dist: tqdm<5,>=4
16
+ Requires-Dist: typer<1,>=0
17
+ Description-Content-Type: text/markdown
18
+
19
+ # aws-annoying
20
+
21
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
22
+ [![CI](https://github.com/lasuillard/aws-annoying/actions/workflows/ci.yaml/badge.svg)](https://github.com/lasuillard/aws-annoying/actions/workflows/ci.yaml)
23
+ [![codecov](https://codecov.io/gh/lasuillard/aws-annoying/graph/badge.svg?token=gbcHMVVz2k)](https://codecov.io/gh/lasuillard/aws-annoying)
24
+ [![PyPI - Version](https://img.shields.io/pypi/v/aws-annoying)](https://pypi.org/project/aws-annoying/)
25
+
26
+ Utils to handle some annoying AWS tasks.
27
+
28
+ ## ❓ About
29
+
30
+ This project aims to provide a set of utilities and examples to help with some annoying tasks when working with AWS.
31
+
32
+ Major directories of the project:
33
+
34
+ - **aws_annoying** Python package containing CLI and utility functions.
35
+ - **console** Utilities to help working with AWS Console.
36
+ - **examples** Examples of how to use the package.
37
+
38
+ ## 🚀 Installation
39
+
40
+ It is recommended to use [pipx](https://pipx.pypa.io/stable/) to install `aws-annoying` CLI:
41
+
42
+ ```bash
43
+ $ pipx install aws-annoying
44
+ $ aws-annoying --help
45
+
46
+ Usage: aws-annoying [OPTIONS] COMMAND [ARGS]...
47
+
48
+ ...
49
+ ```
50
+
51
+ As the package also provides some utility functions, you can install `aws-annoying` via pip, if you are going to use those utils.
52
+
53
+ ## 💡 Usage
54
+
55
+ Below are brief explanation of available commands. For more detailed information about commands, please refer to the CLI help.
56
+
57
+ ### `ecs task-definition-lifecycle`
58
+
59
+ Expire and delete ECS task definitions based on criteria.
60
+
61
+ ### `ecs wait-for-deployment`
62
+
63
+ Wait for ECS deployment to start, complete or fail, and stabilize.
64
+
65
+ ### `load-variables`
66
+
67
+ Wrapper command to run command with variables from various AWS resources (SSM Parameter Store, Secrets Manager, etc.) injected as environment variables.
68
+
69
+ ### `mfa configure`
70
+
71
+ Configure AWS profile or refresh session for MFA.
72
+
73
+ ### `session-manager install`
74
+
75
+ Install AWS Session Manager plugin.
76
+
77
+ ### `session-manager port-forward`
78
+
79
+ Start a port forwarding session using AWS Session Manager.
80
+
81
+ ### `session-manager start`
82
+
83
+ Start new session via Session Manager.
84
+
85
+ ### `session-manager stop`
86
+
87
+ Stop running port forwarding session for PID file.
88
+
89
+ ## 💖 Contributing
90
+
91
+ Any feedback, suggestions or contributions are welcome! Feel free to open an issue or a pull request.
@@ -0,0 +1,73 @@
1
+ # aws-annoying
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+ [![CI](https://github.com/lasuillard/aws-annoying/actions/workflows/ci.yaml/badge.svg)](https://github.com/lasuillard/aws-annoying/actions/workflows/ci.yaml)
5
+ [![codecov](https://codecov.io/gh/lasuillard/aws-annoying/graph/badge.svg?token=gbcHMVVz2k)](https://codecov.io/gh/lasuillard/aws-annoying)
6
+ [![PyPI - Version](https://img.shields.io/pypi/v/aws-annoying)](https://pypi.org/project/aws-annoying/)
7
+
8
+ Utils to handle some annoying AWS tasks.
9
+
10
+ ## ❓ About
11
+
12
+ This project aims to provide a set of utilities and examples to help with some annoying tasks when working with AWS.
13
+
14
+ Major directories of the project:
15
+
16
+ - **aws_annoying** Python package containing CLI and utility functions.
17
+ - **console** Utilities to help working with AWS Console.
18
+ - **examples** Examples of how to use the package.
19
+
20
+ ## 🚀 Installation
21
+
22
+ It is recommended to use [pipx](https://pipx.pypa.io/stable/) to install `aws-annoying` CLI:
23
+
24
+ ```bash
25
+ $ pipx install aws-annoying
26
+ $ aws-annoying --help
27
+
28
+ Usage: aws-annoying [OPTIONS] COMMAND [ARGS]...
29
+
30
+ ...
31
+ ```
32
+
33
+ As the package also provides some utility functions, you can install `aws-annoying` via pip, if you are going to use those utils.
34
+
35
+ ## 💡 Usage
36
+
37
+ Below are brief explanation of available commands. For more detailed information about commands, please refer to the CLI help.
38
+
39
+ ### `ecs task-definition-lifecycle`
40
+
41
+ Expire and delete ECS task definitions based on criteria.
42
+
43
+ ### `ecs wait-for-deployment`
44
+
45
+ Wait for ECS deployment to start, complete or fail, and stabilize.
46
+
47
+ ### `load-variables`
48
+
49
+ Wrapper command to run command with variables from various AWS resources (SSM Parameter Store, Secrets Manager, etc.) injected as environment variables.
50
+
51
+ ### `mfa configure`
52
+
53
+ Configure AWS profile or refresh session for MFA.
54
+
55
+ ### `session-manager install`
56
+
57
+ Install AWS Session Manager plugin.
58
+
59
+ ### `session-manager port-forward`
60
+
61
+ Start a port forwarding session using AWS Session Manager.
62
+
63
+ ### `session-manager start`
64
+
65
+ Start new session via Session Manager.
66
+
67
+ ### `session-manager stop`
68
+
69
+ Stop running port forwarding session for PID file.
70
+
71
+ ## 💖 Contributing
72
+
73
+ Any feedback, suggestions or contributions are welcome! Feel free to open an issue or a pull request.
@@ -8,6 +8,10 @@ from typing import Optional
8
8
  import typer
9
9
  from rich import print # noqa: A004
10
10
  from rich.console import Console
11
+ from rich.highlighter import ReprHighlighter
12
+ from rich.theme import Theme
13
+
14
+ logger = logging.getLogger(__name__)
11
15
 
12
16
  app = typer.Typer(
13
17
  pretty_exceptions_short=True,
@@ -51,7 +55,7 @@ def main( # noqa: D103
51
55
  ),
52
56
  ) -> None:
53
57
  log_level = logging.DEBUG if verbose else logging.INFO
54
- console = Console(soft_wrap=True, emoji=False)
58
+ console = _get_console()
55
59
  logging_config: logging.config._DictConfigArgs = {
56
60
  "version": 1,
57
61
  "disable_existing_loggers": False,
@@ -89,3 +93,28 @@ def main( # noqa: D103
89
93
 
90
94
  # Global flags
91
95
  ctx.meta["dry_run"] = dry_run
96
+ if dry_run:
97
+ logger.warning("Dry run mode enabled. Some operation may behave differently to avoid making changes.")
98
+
99
+
100
+ def _get_console() -> Console:
101
+ theme = Theme(
102
+ {
103
+ "repr.arn": "bold orange3",
104
+ "repr.constant": "bold blue",
105
+ },
106
+ )
107
+ return Console(soft_wrap=True, emoji=False, highlighter=CustomHighlighter(), theme=theme)
108
+
109
+
110
+ class CustomHighlighter(ReprHighlighter):
111
+ """Custom highlighter to handle additional patterns."""
112
+
113
+ highlights = [ # noqa: RUF012
114
+ *ReprHighlighter.highlights,
115
+ # AWS Resource Name; https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html
116
+ # NOTE: Quite simplified regex, may not cover all cases.
117
+ r"(?P<arn>\barn:[0-9a-zA-Z/+=,\.@_\-:]+\b)",
118
+ # Constants
119
+ r"(?P<constant>\b[A-Z_]+\b)",
120
+ ]
@@ -40,9 +40,6 @@ def task_definition_lifecycle(
40
40
  ) -> None:
41
41
  """Execute ECS task definition lifecycle."""
42
42
  dry_run = ctx.meta["dry_run"]
43
- if dry_run:
44
- logger.info("Dry run mode enabled. Will not perform any actual changes.")
45
-
46
43
  ecs = boto3.client("ecs")
47
44
 
48
45
  # Get all task definitions for the family
@@ -15,10 +15,10 @@ class RichLogHandler(logging.Handler):
15
15
 
16
16
  _level_emojis: Final[dict[str, str]] = {
17
17
  "DEBUG": "🔍",
18
- "INFO": "ℹ️", # noqa: RUF001
18
+ "INFO": "🔔",
19
19
  "WARNING": "⚠️",
20
- "ERROR": "",
21
- "CRITICAL": "🚨",
20
+ "ERROR": "🚨",
21
+ "CRITICAL": "🔥",
22
22
  }
23
23
 
24
24
  def __init__(self, console: Console, *args: Any, **kwargs: Any) -> None:
@@ -17,6 +17,7 @@ logger = logging.getLogger(__name__)
17
17
 
18
18
  @mfa_app.command()
19
19
  def configure( # noqa: PLR0913
20
+ ctx: typer.Context,
20
21
  *,
21
22
  mfa_profile: Optional[str] = typer.Option(
22
23
  None,
@@ -54,6 +55,8 @@ def configure( # noqa: PLR0913
54
55
  ),
55
56
  ) -> None:
56
57
  """Configure AWS profile for MFA."""
58
+ dry_run = ctx.meta["dry_run"]
59
+
57
60
  # Expand user home directory
58
61
  aws_credentials = aws_credentials.expanduser()
59
62
  aws_config = aws_config.expanduser()
@@ -102,13 +105,14 @@ def configure( # noqa: PLR0913
102
105
  mfa_profile,
103
106
  aws_credentials,
104
107
  )
105
- update_credentials(
106
- aws_credentials,
107
- mfa_profile, # type: ignore[arg-type]
108
- access_key=credentials["AccessKeyId"],
109
- secret_key=credentials["SecretAccessKey"],
110
- session_token=credentials["SessionToken"],
111
- )
108
+ if not dry_run:
109
+ update_credentials(
110
+ aws_credentials,
111
+ mfa_profile, # type: ignore[arg-type]
112
+ access_key=credentials["AccessKeyId"],
113
+ secret_key=credentials["SecretAccessKey"],
114
+ session_token=credentials["SessionToken"],
115
+ )
112
116
 
113
117
  # Persist MFA configuration
114
118
  if persist:
@@ -120,6 +124,7 @@ def configure( # noqa: PLR0913
120
124
  mfa_config.mfa_profile = mfa_profile
121
125
  mfa_config.mfa_source_profile = mfa_source_profile
122
126
  mfa_config.mfa_serial_number = mfa_serial_number
123
- mfa_config.save_ini_file(aws_config, aws_config_section)
127
+ if not dry_run:
128
+ mfa_config.save_ini_file(aws_config, aws_config_section)
124
129
  else:
125
130
  logger.warning("MFA configuration not persisted.")
@@ -15,12 +15,15 @@ logger = logging.getLogger(__name__)
15
15
  # https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html
16
16
  @session_manager_app.command()
17
17
  def install(
18
- yes: bool = typer.Option( # noqa: FBT001
18
+ ctx: typer.Context,
19
+ *,
20
+ yes: bool = typer.Option(
19
21
  False, # noqa: FBT003
20
22
  help="Do not ask confirmation for installation.",
21
23
  ),
22
24
  ) -> None:
23
25
  """Install AWS Session Manager plugin."""
26
+ dry_run = ctx.meta["dry_run"]
24
27
  session_manager = SessionManager()
25
28
 
26
29
  # Check session-manager-plugin already installed
@@ -31,7 +34,8 @@ def install(
31
34
 
32
35
  # Install session-manager-plugin
33
36
  logger.warning("Installing AWS Session Manager plugin. You could be prompted for admin privileges request.")
34
- session_manager.install(confirm=yes, downloader=TQDMDownloader())
37
+ if not dry_run:
38
+ session_manager.install(confirm=yes, downloader=TQDMDownloader())
35
39
 
36
40
  # Verify installation
37
41
  is_installed, binary_path, version = session_manager.verify_installation()
@@ -19,6 +19,8 @@ logger = logging.getLogger(__name__)
19
19
  # https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html
20
20
  @session_manager_app.command()
21
21
  def port_forward( # noqa: PLR0913
22
+ ctx: typer.Context,
23
+ *,
22
24
  # TODO(lasuillard): Add `--local-host` option, redirect the traffic to non-localhost bind (unsupported by AWS)
23
25
  local_port: int = typer.Option(
24
26
  ...,
@@ -48,7 +50,7 @@ def port_forward( # noqa: PLR0913
48
50
  "./session-manager-plugin.pid",
49
51
  help="The path to the PID file to store the process ID of the session manager plugin.",
50
52
  ),
51
- terminate_running_process: bool = typer.Option( # noqa: FBT001
53
+ terminate_running_process: bool = typer.Option(
52
54
  False, # noqa: FBT003
53
55
  help="Terminate the process in the PID file if it already exists.",
54
56
  ),
@@ -58,6 +60,7 @@ def port_forward( # noqa: PLR0913
58
60
  ),
59
61
  ) -> None:
60
62
  """Start a port forwarding session using AWS Session Manager."""
63
+ dry_run = ctx.meta["dry_run"]
61
64
  session_manager = SessionManager()
62
65
 
63
66
  # Check if the PID file already exists
@@ -86,7 +89,7 @@ def port_forward( # noqa: PLR0913
86
89
  logger.info("Instance ID resolved: [bold]%s[/bold]", instance_id)
87
90
  target = instance_id
88
91
  else:
89
- logger.info("Instance with name '%s' not found.", through)
92
+ logger.error("Instance with name '%s' not found.", through)
90
93
  raise typer.Exit(1)
91
94
 
92
95
  # Initiate the session
@@ -111,19 +114,26 @@ def port_forward( # noqa: PLR0913
111
114
  through,
112
115
  reason,
113
116
  )
114
- proc = subprocess.Popen( # noqa: S603
115
- command,
116
- stdout=stdout,
117
- stderr=subprocess.STDOUT,
118
- text=True,
119
- close_fds=False, # FD inherited from parent process
120
- )
117
+ if not dry_run:
118
+ proc = subprocess.Popen( # noqa: S603
119
+ command,
120
+ stdout=stdout,
121
+ stderr=subprocess.STDOUT,
122
+ text=True,
123
+ close_fds=False, # FD inherited from parent process
124
+ )
125
+ pid = proc.pid
126
+ else:
127
+ pid = -1
128
+
121
129
  logger.info(
122
130
  "Session Manager Plugin started with PID %d. Outputs will be logged to %s.",
123
- proc.pid,
131
+ pid,
124
132
  log_file.absolute(),
125
133
  )
126
134
 
127
135
  # Write the PID to the file
128
- pid_file.write_text(str(proc.pid))
136
+ if not dry_run:
137
+ pid_file.write_text(str(pid))
138
+
129
139
  logger.info("PID file written to %s.", pid_file.absolute())
@@ -18,6 +18,8 @@ logger = logging.getLogger(__name__)
18
18
 
19
19
  @session_manager_app.command()
20
20
  def start(
21
+ ctx: typer.Context,
22
+ *,
21
23
  target: str = typer.Option(
22
24
  ...,
23
25
  show_default=False,
@@ -29,6 +31,7 @@ def start(
29
31
  ),
30
32
  ) -> None:
31
33
  """Start new session."""
34
+ dry_run = ctx.meta["dry_run"]
32
35
  session_manager = SessionManager()
33
36
 
34
37
  # Resolve the instance name or ID
@@ -52,4 +55,5 @@ def start(
52
55
  parameters={},
53
56
  reason=reason,
54
57
  )
55
- os.execvp(command[0], command) # noqa: S606
58
+ if not dry_run:
59
+ os.execvp(command[0], command) # noqa: S606
@@ -14,16 +14,20 @@ logger = logging.getLogger(__name__)
14
14
 
15
15
  @session_manager_app.command()
16
16
  def stop(
17
+ ctx: typer.Context,
18
+ *,
17
19
  pid_file: Path = typer.Option( # noqa: B008
18
20
  "./session-manager-plugin.pid",
19
21
  help="The path to the PID file to store the process ID of the session manager plugin.",
20
22
  ),
21
- remove: bool = typer.Option( # noqa: FBT001
23
+ remove: bool = typer.Option(
22
24
  True, # noqa: FBT003
23
25
  help="Remove the PID file after stopping the session.",
24
26
  ),
25
27
  ) -> None:
26
28
  """Stop running session for PID file."""
29
+ dry_run = ctx.meta["dry_run"]
30
+
27
31
  # Check if PID file exists
28
32
  if not pid_file.is_file():
29
33
  logger.error("PID file not found: %s", pid_file)
@@ -40,13 +44,15 @@ def stop(
40
44
  # Send SIGTERM to the process
41
45
  try:
42
46
  logger.warning("Terminating running process with PID %d.", pid)
43
- os.kill(pid, signal.SIGTERM)
47
+ if not dry_run:
48
+ os.kill(pid, signal.SIGTERM)
44
49
  except ProcessLookupError:
45
50
  logger.warning("Tried to terminate process with PID %d but does not exist.", pid)
46
51
 
47
52
  # Remove the PID file
48
53
  if remove:
49
54
  logger.info("Removed the PID file %s.", pid_file)
50
- pid_file.unlink()
55
+ if not dry_run:
56
+ pid_file.unlink()
51
57
 
52
58
  logger.info("Terminated the session successfully.")
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "aws-annoying"
3
3
  description = "Utils to handle some annoying AWS tasks."
4
- version = "0.7.0"
4
+ version = "0.8.1"
5
5
  authors = [{ name = "Yuchan Lee", email = "lasuillard@gmail.com" }]
6
6
  readme = "README.md"
7
7
  license = "MIT"
@@ -17,7 +17,7 @@ dependencies = [
17
17
  [project.scripts]
18
18
  "aws-annoying" = "aws_annoying.cli.main:entrypoint"
19
19
 
20
- [project.optional-dependencies]
20
+ [dependency-groups]
21
21
  dev = [
22
22
  "boto3-stubs[ecs,secretsmanager,ssm,sts,ec2]>=1.37.1",
23
23
  "mypy>=1.15,<1.17",
@@ -26,12 +26,12 @@ dev = [
26
26
  ]
27
27
  test = [
28
28
  "coverage>=7.6,<7.9",
29
- "moto[secretsmanager,server,ssm,ecs]~=5.1.1",
30
- "pytest~=8.3.2",
29
+ "moto[secretsmanager,server,ssm,ecs]~=5.1.8",
30
+ "pytest>=8.3.2,<8.5.0",
31
31
  "pytest-cov>=6.0,<6.2",
32
32
  "pytest-env~=1.1.1",
33
33
  "pytest-snapshot>=0.9.0",
34
- "pytest-sugar~=1.0.0",
34
+ "pytest-sugar>=1.0,<1.2",
35
35
  "pytest-xdist>=3.6.1",
36
36
  "testcontainers[localstack]>=4.9.2",
37
37
  "toml>=0.10.2",
@@ -47,6 +47,9 @@ Issues = "https://github.com/lasuillard/aws-annoying/issues"
47
47
  requires = ["hatchling"]
48
48
  build-backend = "hatchling.build"
49
49
 
50
+ [tool.uv]
51
+ default-groups = ["dev", "test"]
52
+
50
53
  [tool.hatch.build.targets.wheel]
51
54
  packages = ["aws_annoying"]
52
55
 
@@ -1,7 +1,9 @@
1
+ from __future__ import annotations
2
+
1
3
  import re
2
4
 
3
5
 
4
- def normalize_console_output(output: str) -> str:
6
+ def normalize_console_output(output: str, *, replace: dict[str, str] | None = None) -> str:
5
7
  """Normalize the console output for easier comparison."""
6
8
  # Remove leading and trailing spaces
7
9
  output = output.strip()
@@ -9,6 +11,11 @@ def normalize_console_output(output: str) -> str:
9
11
  # Unwrap each line
10
12
  output = re.sub(r"[ ]+\n", " ", output)
11
13
 
14
+ # Extra replacements; e.g. temporary paths that may vary
15
+ if replace:
16
+ for old, new in replace.items():
17
+ output = output.replace(old, new)
18
+
12
19
  # Handle Windows path separator
13
20
  output = output.replace("\\", "/")
14
21
 
@@ -1,4 +1,3 @@
1
- ℹ️ Dry run mode enabled. Will not perform any actual changes.
2
1
  ⚠️ Deregistering 15 task definitions...
3
2
  ⚠️ Deregistered task definition 'my-task:1'
4
3
  ⚠️ Deregistered task definition 'my-task:2'