You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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):
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).
Thanks for reporting. Looks like when we added type hints, it reveals that .models and .intrinsics are importing from each other. This should be avoided as .models.__init__ needs to focus on models not other behavior.
It isn't an issue if samtranslator.translator is directly imported. (as long as samtranslator.intrinsics.resolver is imported first it is not an issue).
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
):Observed result
This script mentioned above fails on the
v1.60.0
tag, as well as on the latest commit ondevelop
, with the following error:Expected result
With b3b6c79, the import does not fail (which I would expect).
Additional environment details
sam --version
: -The text was updated successfully, but these errors were encountered: