-
Notifications
You must be signed in to change notification settings - Fork 245
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
[Python] Issue when importing nested submodules. #3408
Comments
I am thinking it may be because of this import? It seems to be complaining that the
|
You can repo this locally by running: Note: the generated .projenrc.py is synthesized with an incorrect module_name due to a bug in projen: projen/projen#1851. Workaround: manually rename the import in .projenrc.py from aws-prototyping-sdk -> aws_prototyping_sdk |
Nested submodules were not registered in the `__all__` list of their parent, and so were not visible to import statement such as `from fully.qualified.submodule.path import Name`. This changes how submodules get loaded so that they are always declared and loaded with the context of their immediate parent sub•module, which guarantees they are present in the relevant `__all__` list. Fixes #3408
Nested submodules were not registered in the `__all__` list of their parent, and so were not visible to import statement such as `from fully.qualified.submodule.path import Name`. This changes how submodules get loaded so that they are always declared and loaded with the context of their immediate parent sub•module, which guarantees they are present in the relevant `__all__` list. Fixes #3408
Nested submodules were not registered in the `__all__` list of their parent, and so were not visible to import statement such as `from fully.qualified.submodule.path import Name`. This changes how submodules get loaded so that they are always declared and loaded with the context of their immediate parent sub•module, which guarantees they are present in the relevant `__all__` list. Fixes #3408 --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
|
🐛 Bug Report
Affected Languages
TypeScript
orJavascript
Python
Java
C#
,F#
, ...)Go
General Information
What is the problem?
I am extending TypescriptProject from Projen within my own package. When I run pacmak it successfully generates the python distributable, however at runtime when I import my module I am experiencing the following error:
module 'projen.github' has no attribute 'workflows'
I did some digging and this is likely due to a bug in how nested packages in python are imported.
Looking at how it is being imported in the generated dist:
import projen.github.workflows
vs how it should be imported:
If I look at the generated imports for the TypeScriptProject, they are correctly importing using aliases, just not sure why my code is not (perhaps because it is a different assembly?).
I manually edited my imports to use aliases as above and it resolves the issue.
Here is a link to the generated artifact that you can reference: https://pypi.org/project/aws-prototyping-sdk/
Linked projen issue: projen/projen#1653
The text was updated successfully, but these errors were encountered: