-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
Description
Description
With the release of 1.60.0, it is not possible anymore to import from samtranslator.plugins.application.serverless_app_plugin
due to a cyclic import introduced with be58556.
Steps to reproduce
I used the following script to verify my tests (and to identify the commit which introduced the issue using it as a run script for git bisect
):
#!/bin/bash
set -eo pipefail
rm -rf .venv
python -m venv .venv
source .venv/bin/activate
pip install -e .
python -c "from samtranslator.plugins.application.serverless_app_plugin import ServerlessAppPlugin"
Observed result
This script mentioned above fails on the v1.60.0
tag, as well as on the latest commit on develop
, with the following error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/localstack/Repos/serverless-application-model/samtranslator/plugins/application/serverless_app_plugin.py", line 11, in <module>
from samtranslator.intrinsics.actions import FindInMapAction
File "/home/localstack/Repos/serverless-application-model/samtranslator/intrinsics/actions.py", line 5, in <module>
from samtranslator.model.exceptions import InvalidDocumentException, InvalidTemplateException
File "/home/localstack/Repos/serverless-application-model/samtranslator/model/__init__.py", line 7, in <module>
from samtranslator.intrinsics.resolver import IntrinsicsResolver
File "/home/localstack/Repos/serverless-application-model/samtranslator/intrinsics/resolver.py", line 4, in <module>
from samtranslator.intrinsics.actions import Action, GetAttAction, RefAction, SubAction
ImportError: cannot import name 'Action' from partially initialized module 'samtranslator.intrinsics.actions' (most likely due to a circular import) (/home/localstack/Repos/serverless-application-model/samtranslator/intrinsics/actions.py)
Expected result
With b3b6c79, the import does not fail (which I would expect).
Additional environment details
- OS: Ubuntu 22.04, Python 3.10
- If using the SAM CLI,
sam --version
: - - AWS region: -
joe4dev and aahung