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

Can't import cdk-ecs-codedeploy #215

Open
hongsea opened this issue Jul 21, 2023 · 2 comments
Open

Can't import cdk-ecs-codedeploy #215

hongsea opened this issue Jul 21, 2023 · 2 comments

Comments

@hongsea
Copy link

hongsea commented Jul 21, 2023

Currently, I have installed pip install cdklabs.ecs-codedeploy and don't know how to use it. Can someone show me how to import cdk-ecs-codedeploy and use EcsDeployment.

@cplee
Copy link
Contributor

cplee commented Jul 21, 2023

Check out the examples in the docs. Do these help?

@mbeacom
Copy link

mbeacom commented Aug 3, 2023

@cplee No -- there isn't a single example of importing the python module in the auto-generated documentation.

The imports are non-standard, so:

>>> import cdklabs.ecs-codedeploy
  File "<stdin>", line 1
    import cdklabs.ecs-codedeploy
                      ^
SyntaxError: invalid syntax
>>> import cdklabs-ecs-codedeploy
  File "<stdin>", line 1
    import cdklabs-ecs-codedeploy
                  ^
SyntaxError: invalid syntax
>>> import cdklabs.ecs_codedeploy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cdklabs'
>>> import cdklabs_ecs_codedeploy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cdklabs_ecs_codedeploy'
>>> import ecs_codedeploy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'ecs_codedeploy'

pip freeze output:

❯ poetry run pip freeze
attrs==23.1.0
aws-cdk-lib==2.89.0
aws-cdk.asset-awscli-v1==2.2.200
aws-cdk.asset-kubectl-v20==2.1.2
aws-cdk.asset-node-proxy-agent-v5==2.0.166
aws-cdk.aws-synthetics-alpha==2.89.0a0
cattrs==23.1.2
cdklabs.ecs-codedeploy==0.0.207
constructs==10.2.69
importlib-resources==6.0.0
jsii==1.86.1
publication==0.0.3
python-dateutil==2.8.2
six==1.16.0
typeguard==2.13.3
typing_extensions==4.7.1

As you can see, cdklabs.ecs-codedeploy is installed, but inaccessible.

The auto-generated setup.py via jsii is:

"name": "cdklabs.ecs-codedeploy",

However, the package structure follows: src/cdk/ecs_codedeploy in the output wheel and source.

Resolution

Import as follows:

from cdk import ecs_codedeploy

This isn't documented anywhere, so I'll raise a PR to add it.

Hopefully this answers your question @hongsea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants