Is there a way to use relative imports in Python P...
# python
Is there a way to use relative imports in Python Pulumi programs? I know we can import other modules using an absolute reference: But that's misleading: • When reading import, are how we supposed to determine what's internal to the pulumi program vs. what's external? • Tools like isort believe those imports are 3rd party, so we cannot group the program's internal import together when using it Did somebody found a workaround I missed?
The same issue also hurts when using pylint: • It complains if there is no
• It complains when the source code is not in a well named python package (using snake case) IMO those are signs that Pulumi should conform to the Python ecosystem common practices.
For those who face the same issue: my workaround is to split the actual implementation from the pulumi program. So I end up with: • A "library" package that contains the actual implementation (I can manage this part as an actual Python package) • A pulumi program, that use that library package (it only import the library's entry point, so I no longer have the import issue)