apx-aws-lambda 0.3.1__tar.gz → 0.3.2__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 (31) hide show
  1. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/PKG-INFO +1 -1
  2. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/shell.py +23 -1
  3. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda.egg-info/PKG-INFO +1 -1
  4. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/pyproject.toml +1 -1
  5. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/tests/test_targets.py +13 -0
  6. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/LICENSE +0 -0
  7. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/README.md +0 -0
  8. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/__init__.py +0 -0
  9. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/cli.py +0 -0
  10. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/lambda_.py +0 -0
  11. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/overlays/cloud/aws/lambda/cookiecutter.json +0 -0
  12. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/overlays/cloud/aws/lambda/hooks/post_gen_project.py +0 -0
  13. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/.github/workflows/deploy.yml +0 -0
  14. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/DEPLOY.md +0 -0
  15. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/_lang/python/Makefile +0 -0
  16. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/_lang/python/lambda_handler.py +0 -0
  17. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/policy.json +0 -0
  18. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/trust.json +0 -0
  19. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/samconfig.toml +0 -0
  20. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/template.yaml +0 -0
  21. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/overlays/index.json +0 -0
  22. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/plugin.py +0 -0
  23. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/proxy.py +0 -0
  24. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda/tools.py +0 -0
  25. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda.egg-info/SOURCES.txt +0 -0
  26. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda.egg-info/dependency_links.txt +0 -0
  27. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda.egg-info/entry_points.txt +0 -0
  28. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda.egg-info/requires.txt +0 -0
  29. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/apx_aws_lambda.egg-info/top_level.txt +0 -0
  30. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/setup.cfg +0 -0
  31. {apx_aws_lambda-0.3.1 → apx_aws_lambda-0.3.2}/tests/test_proxy.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apx-aws-lambda
3
- Version: 0.3.1
3
+ Version: 0.3.2
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
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  import importlib.util
6
6
  import json
7
+ import os
7
8
  import shutil
8
9
  import subprocess
9
10
  import sys
@@ -11,6 +12,7 @@ from pathlib import Path
11
12
  from typing import Any
12
13
 
13
14
  from action_platform.core.exception import DeployError
15
+ from action_platform.settings import settings
14
16
 
15
17
  MODULES = {"aws": "awscli", "sam": "samcli"}
16
18
 
@@ -30,11 +32,31 @@ def require(tool: str, hint: str) -> list[str]:
30
32
  raise DeployError(f"{tool} is not installed: {hint}")
31
33
 
32
34
 
35
+ def module_env(args: list[str], env: dict[str, str] | None) -> dict[str, str] | None:
36
+ """`python -m awscli` in a child process must see the plugins volume the parent added with `site.addsitedir`; PYTHONPATH carries it over."""
37
+ if args[:1] != [sys.executable] or settings.PLUGINS_DIR is None:
38
+ return env
39
+
40
+ merged = dict(env if env is not None else os.environ)
41
+ current = merged.get("PYTHONPATH", "")
42
+ plugins = str(settings.PLUGINS_DIR)
43
+
44
+ if plugins not in current.split(os.pathsep):
45
+ merged["PYTHONPATH"] = os.pathsep.join(p for p in (plugins, current) if p)
46
+
47
+ return merged
48
+
49
+
33
50
  def run(
34
51
  args: list[str], cwd: Path | None = None, env: dict[str, str] | None = None
35
52
  ) -> str:
36
53
  result = subprocess.run(
37
- args, cwd=cwd, env=env, capture_output=True, text=True, check=False
54
+ args,
55
+ cwd=cwd,
56
+ env=module_env(args, env),
57
+ capture_output=True,
58
+ text=True,
59
+ check=False,
38
60
  )
39
61
 
40
62
  if result.returncode != 0:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apx-aws-lambda
3
- Version: 0.3.1
3
+ Version: 0.3.2
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "apx-aws-lambda"
3
- version = "0.3.1"
3
+ version = "0.3.2"
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"
@@ -1,6 +1,7 @@
1
1
  """The target drives `aws` and `sam`; here both are fakes, so what is asserted is the sequence and the answers."""
2
2
 
3
3
  import json
4
+ import sys
4
5
  import unittest
5
6
  from pathlib import Path
6
7
  from tempfile import TemporaryDirectory
@@ -10,6 +11,7 @@ from action_platform.core.context import Context
10
11
  from action_platform.core.exception import DeployError
11
12
  from action_platform.core.scaffold.templates import Matrix, with_plugin_clouds
12
13
  from action_platform.plugins import Loaded, Plugins, PluginState, registry
14
+ from action_platform.settings import settings
13
15
 
14
16
  from apx_aws_lambda import AwsLambdaPlugin, shell
15
17
  from apx_aws_lambda.lambda_ import LambdaTarget
@@ -191,3 +193,14 @@ class AssumeRoleTest(unittest.TestCase):
191
193
  )
192
194
 
193
195
  self.assertIn("log in", str(caught.exception))
196
+
197
+
198
+ class ModuleEnvTest(unittest.TestCase):
199
+ def test_the_plugins_volume_reaches_a_python_m_child(self):
200
+ with mock.patch.object(settings, "PLUGINS_DIR", Path("/data/plugins")):
201
+ env = shell.module_env([sys.executable, "-m", "awscli"], {"PATH": "/bin"})
202
+ same = shell.module_env(["/usr/bin/aws"], {"PATH": "/bin"})
203
+
204
+ self.assertEqual(env["PYTHONPATH"], "/data/plugins")
205
+ self.assertEqual(env["PATH"], "/bin")
206
+ self.assertEqual(same, {"PATH": "/bin"})
File without changes
File without changes
File without changes