apx-aws-lambda 0.2.0__tar.gz → 0.3.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 (30) hide show
  1. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/PKG-INFO +5 -3
  2. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/README.md +1 -1
  3. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/lambda_.py +9 -4
  4. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/_lang/python/lambda_handler.py +2 -1
  5. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/plugin.py +2 -2
  6. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/shell.py +20 -5
  7. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda.egg-info/PKG-INFO +5 -3
  8. apx_aws_lambda-0.3.0/apx_aws_lambda.egg-info/requires.txt +8 -0
  9. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/pyproject.toml +2 -2
  10. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/tests/test_targets.py +4 -2
  11. apx_aws_lambda-0.2.0/apx_aws_lambda.egg-info/requires.txt +0 -6
  12. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/LICENSE +0 -0
  13. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/__init__.py +0 -0
  14. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/cli.py +0 -0
  15. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/overlays/cloud/aws/lambda/cookiecutter.json +0 -0
  16. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/overlays/cloud/aws/lambda/hooks/post_gen_project.py +0 -0
  17. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/.github/workflows/deploy.yml +0 -0
  18. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/DEPLOY.md +0 -0
  19. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/_lang/python/Makefile +0 -0
  20. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/policy.json +0 -0
  21. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/trust.json +0 -0
  22. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/samconfig.toml +0 -0
  23. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/template.yaml +0 -0
  24. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/overlays/index.json +0 -0
  25. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda/tools.py +0 -0
  26. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda.egg-info/SOURCES.txt +0 -0
  27. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda.egg-info/dependency_links.txt +0 -0
  28. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda.egg-info/entry_points.txt +0 -0
  29. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/apx_aws_lambda.egg-info/top_level.txt +0 -0
  30. {apx_aws_lambda-0.2.0 → apx_aws_lambda-0.3.0}/setup.cfg +0 -0
@@ -1,13 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apx-aws-lambda
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: AWS Lambda for Action Platform: the aws/lambda deploy target (SAM) with its overlay, and tools to read stacks and functions.
5
5
  Author-email: Action Platform <cloud@actionplatform.io>
6
6
  License-Expression: Apache-2.0
7
7
  Requires-Python: >=3.11
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
- Requires-Dist: action-platform>=0.16
10
+ Requires-Dist: action-platform>=0.17
11
+ Requires-Dist: awscli>=1.34
12
+ Requires-Dist: aws-sam-cli>=1.120
11
13
  Provides-Extra: dev
12
14
  Requires-Dist: pytest>=8; extra == "dev"
13
15
  Requires-Dist: ruff>=0.6; extra == "dev"
@@ -79,7 +81,7 @@ Then a role per app (or per project) whose trust policy names the platform and t
79
81
 
80
82
  Tools (`action-platform mcp`): `aws_lambda_stacks`, `aws_lambda_functions`. Commands: `action-platform aws-lambda stacks|functions`. Deploying itself goes through the core's `deploy` / `rollback` / `diagnose`, which drive the target.
81
83
 
82
- Needs: AWS CLI v2 (`aws`), SAM CLI (`sam`), `AWS_REGION` (or `region` under `[deploy]`), and either `role_arn` (OIDC, no keys) or the AWS CLI's own credentials. Talks to `*.amazonaws.com` only.
84
+ Needs: `aws` and `sam` — on PATH when present, otherwise the `awscli` and `aws-sam-cli` packages the plugin depends on run as `python -m`, which is how the hosted platform deploys without the CLIs in its image; `AWS_REGION` (or `region` under `[deploy]`), and either `role_arn` (OIDC, no keys) or the AWS CLI's own credentials. Talks to `*.amazonaws.com` only.
83
85
 
84
86
  ## Development
85
87
 
@@ -63,7 +63,7 @@ Then a role per app (or per project) whose trust policy names the platform and t
63
63
 
64
64
  Tools (`action-platform mcp`): `aws_lambda_stacks`, `aws_lambda_functions`. Commands: `action-platform aws-lambda stacks|functions`. Deploying itself goes through the core's `deploy` / `rollback` / `diagnose`, which drive the target.
65
65
 
66
- Needs: AWS CLI v2 (`aws`), SAM CLI (`sam`), `AWS_REGION` (or `region` under `[deploy]`), and either `role_arn` (OIDC, no keys) or the AWS CLI's own credentials. Talks to `*.amazonaws.com` only.
66
+ Needs: `aws` and `sam` — on PATH when present, otherwise the `awscli` and `aws-sam-cli` packages the plugin depends on run as `python -m`, which is how the hosted platform deploys without the CLIs in its image; `AWS_REGION` (or `region` under `[deploy]`), and either `role_arn` (OIDC, no keys) or the AWS CLI's own credentials. Talks to `*.amazonaws.com` only.
67
67
 
68
68
  ## Development
69
69
 
@@ -100,7 +100,7 @@ class LambdaTarget(DeployTarget):
100
100
  "sts", "get-caller-identity", region=self._region(ctx), env=self.env(ctx)
101
101
  )
102
102
  shell.run(
103
- [shell.require("sam", ""), "validate", "--lint"],
103
+ [*shell.require("sam", ""), "validate", "--lint"],
104
104
  cwd=ctx.repo_root,
105
105
  env=self.env(ctx),
106
106
  )
@@ -108,8 +108,13 @@ class LambdaTarget(DeployTarget):
108
108
  def deploy(self, ctx: Context) -> DeployResult:
109
109
  sam = shell.require("sam", "pip install aws-sam-cli")
110
110
  stage = self._stage(ctx)
111
- shell.run([sam, "build"], cwd=ctx.repo_root, env=self.env(ctx))
112
- args = [sam, "deploy", "--no-confirm-changeset", "--no-fail-on-empty-changeset"]
111
+ shell.run([*sam, "build"], cwd=ctx.repo_root, env=self.env(ctx))
112
+ args = [
113
+ *sam,
114
+ "deploy",
115
+ "--no-confirm-changeset",
116
+ "--no-fail-on-empty-changeset",
117
+ ]
113
118
 
114
119
  if stage != "default":
115
120
  args += ["--config-env", stage]
@@ -177,7 +182,7 @@ class LambdaTarget(DeployTarget):
177
182
 
178
183
  def delete(self, ctx: Context) -> None:
179
184
  sam = shell.require("sam", "pip install aws-sam-cli")
180
- args = [sam, "delete", "--no-prompts", "--stack-name", self._stack(ctx)]
185
+ args = [*sam, "delete", "--no-prompts", "--stack-name", self._stack(ctx)]
181
186
  region = self._region(ctx)
182
187
 
183
188
  if region:
@@ -7,9 +7,10 @@ milliseconds. Stateless transports are the app's own concern (see create_app).
7
7
 
8
8
  import os
9
9
 
10
- from app import create_app
11
10
  from mangum import Mangum
12
11
 
12
+ from app import create_app
13
+
13
14
 
14
15
  def lambda_handler(event, context):
15
16
  adapter = Mangum(
@@ -15,9 +15,9 @@ class AwsLambdaPlugin(Plugin):
15
15
  description = (
16
16
  "Deploy to AWS Lambda with SAM; read CloudFormation stacks and functions"
17
17
  )
18
- min_core = "0.16"
18
+ min_core = "0.17"
19
19
  needs = [
20
- "tool: aws (AWS CLI v2), sam (AWS SAM CLI)",
20
+ "tool: aws, sam (bundled as Python packages when not on PATH)",
21
21
  "env: AWS_REGION; credentials from role_arn (OIDC, no keys) or the AWS CLI chain (SSO, profile, instance role)",
22
22
  "net: *.amazonaws.com",
23
23
  ]
@@ -2,22 +2,32 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import importlib.util
5
6
  import json
6
7
  import shutil
7
8
  import subprocess
9
+ import sys
8
10
  from pathlib import Path
9
11
  from typing import Any
10
12
 
11
13
  from action_platform.core.exception import DeployError
12
14
 
15
+ MODULES = {"aws": "awscli", "sam": "samcli"}
13
16
 
14
- def require(tool: str, hint: str) -> str:
17
+
18
+ def require(tool: str, hint: str) -> list[str]:
19
+ """How to run `tool`: the binary on PATH, else the Python module the plugin depends on (`python -m awscli` / `python -m samcli`) — what makes the hosted platform work without the CLIs in its image."""
15
20
  path = shutil.which(tool)
16
21
 
17
- if not path:
18
- raise DeployError(f"{tool} is not installed: {hint}")
22
+ if path:
23
+ return [path]
24
+
25
+ module = MODULES.get(tool)
26
+
27
+ if module and importlib.util.find_spec(module) is not None:
28
+ return [sys.executable, "-m", module]
19
29
 
20
- return path
30
+ raise DeployError(f"{tool} is not installed: {hint}")
21
31
 
22
32
 
23
33
  def run(
@@ -41,7 +51,12 @@ def aws(
41
51
  cwd: Path | None = None,
42
52
  env: dict[str, str] | None = None,
43
53
  ) -> Any:
44
- command = [require("aws", "https://aws.amazon.com/cli/"), *args, "--output", "json"]
54
+ command = [
55
+ *require("aws", "https://aws.amazon.com/cli/"),
56
+ *args,
57
+ "--output",
58
+ "json",
59
+ ]
45
60
 
46
61
  if region:
47
62
  command += ["--region", region]
@@ -1,13 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apx-aws-lambda
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: AWS Lambda for Action Platform: the aws/lambda deploy target (SAM) with its overlay, and tools to read stacks and functions.
5
5
  Author-email: Action Platform <cloud@actionplatform.io>
6
6
  License-Expression: Apache-2.0
7
7
  Requires-Python: >=3.11
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
- Requires-Dist: action-platform>=0.16
10
+ Requires-Dist: action-platform>=0.17
11
+ Requires-Dist: awscli>=1.34
12
+ Requires-Dist: aws-sam-cli>=1.120
11
13
  Provides-Extra: dev
12
14
  Requires-Dist: pytest>=8; extra == "dev"
13
15
  Requires-Dist: ruff>=0.6; extra == "dev"
@@ -79,7 +81,7 @@ Then a role per app (or per project) whose trust policy names the platform and t
79
81
 
80
82
  Tools (`action-platform mcp`): `aws_lambda_stacks`, `aws_lambda_functions`. Commands: `action-platform aws-lambda stacks|functions`. Deploying itself goes through the core's `deploy` / `rollback` / `diagnose`, which drive the target.
81
83
 
82
- Needs: AWS CLI v2 (`aws`), SAM CLI (`sam`), `AWS_REGION` (or `region` under `[deploy]`), and either `role_arn` (OIDC, no keys) or the AWS CLI's own credentials. Talks to `*.amazonaws.com` only.
84
+ Needs: `aws` and `sam` — on PATH when present, otherwise the `awscli` and `aws-sam-cli` packages the plugin depends on run as `python -m`, which is how the hosted platform deploys without the CLIs in its image; `AWS_REGION` (or `region` under `[deploy]`), and either `role_arn` (OIDC, no keys) or the AWS CLI's own credentials. Talks to `*.amazonaws.com` only.
83
85
 
84
86
  ## Development
85
87
 
@@ -0,0 +1,8 @@
1
+ action-platform>=0.17
2
+ awscli>=1.34
3
+ aws-sam-cli>=1.120
4
+
5
+ [dev]
6
+ pytest>=8
7
+ ruff>=0.6
8
+ action-platform[mcp]
@@ -1,12 +1,12 @@
1
1
  [project]
2
2
  name = "apx-aws-lambda"
3
- version = "0.2.0"
3
+ version = "0.3.0"
4
4
  description = "AWS Lambda for Action Platform: the aws/lambda deploy target (SAM) with its overlay, and tools to read stacks and functions."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
7
7
  requires-python = ">=3.11"
8
8
  authors = [{ name = "Action Platform", email = "cloud@actionplatform.io" }]
9
- dependencies = ["action-platform>=0.16"]
9
+ dependencies = ["action-platform>=0.17", "awscli>=1.34", "aws-sam-cli>=1.120"]
10
10
 
11
11
  [project.optional-dependencies]
12
12
  dev = ["pytest>=8", "ruff>=0.6", "action-platform[mcp]"]
@@ -43,7 +43,7 @@ class LambdaTargetTest(unittest.TestCase):
43
43
  return json.dumps(answers.get(key, {}))
44
44
 
45
45
  return mock.patch.multiple(
46
- shell, run=run, require=lambda tool, hint: f"/usr/bin/{tool}"
46
+ shell, run=run, require=lambda tool, hint: [f"/usr/bin/{tool}"]
47
47
  )
48
48
 
49
49
  def ctx(self, stage="dev"):
@@ -165,7 +165,9 @@ class AssumeRoleTest(unittest.TestCase):
165
165
 
166
166
  ctx = Context(repo_root=Path("."), identity=lambda aud: f"jwt-for-{aud}")
167
167
 
168
- with mock.patch.multiple(shell, run=run, require=lambda t, h: f"/usr/bin/{t}"):
168
+ with mock.patch.multiple(
169
+ shell, run=run, require=lambda t, h: [f"/usr/bin/{t}"]
170
+ ):
169
171
  env = LambdaTarget(
170
172
  role_arn="arn:aws:iam::1:role/deploy", region="us-east-1"
171
173
  ).env(ctx)
@@ -1,6 +0,0 @@
1
- action-platform>=0.16
2
-
3
- [dev]
4
- pytest>=8
5
- ruff>=0.6
6
- action-platform[mcp]
File without changes
File without changes