Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module name clashes #1911

Closed
meyer1994 opened this issue Feb 5, 2021 · 2 comments
Closed

Module name clashes #1911

meyer1994 opened this issue Feb 5, 2021 · 2 comments

Comments

@meyer1994
Copy link

meyer1994 commented Feb 5, 2021

Description:

When using this library, or any library that uses it, there are name clashes
with common names used in projects. Like utils. This is the result of a
random sys.path.insert at samtranslator/feature_toggle/feature_toggle.py.

This was not breaking before, I do not know on which version it started. This
breaks CI with unpinned versions. Or, for example, it breaks when any
dependency uses this module. For example moto:

moto > cfn-lint > aws-sam-translator

Either way, modules should not modify sys.path willy-nilly.

Steps to reproduce:

  1. Create an utils.py
  2. Create a main.py file that first imports something that reaches
    feature_toggle.py
  3. Try importing something from your utils.py

Example

# utils.py
something = 'nice'

# main.py
from samtranslator.translator.translator import Translator
from utils import something  # ImportError

Observed result:

ImportError is thrown when trying to import things from my utils.py.

Expected result:

No ImportError.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Any
  2. If using SAM CLI, sam --version:
  3. AWS region: Does not matter

Add --debug flag to any SAM CLI commands you are running

@meyer1994 meyer1994 changed the title Change modules' names to avoid clashes Module name clashes Feb 5, 2021
@wyattanderson
Copy link

Also running into this. Looks like it was introduced in #1737.

@jfuss
Copy link
Contributor

jfuss commented Jun 16, 2022

This was patched in v1.46.0. Closing

@jfuss jfuss closed this as completed Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants