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

(aws_cdk): Allow Python Path objects into functions that need paths #4717

Open
2 tasks
InvincibleRMC opened this issue Nov 20, 2024 · 4 comments
Open
2 tasks
Labels
effort/medium Medium work item – a couple days of effort feature-request A feature should be added or improved. p2

Comments

@InvincibleRMC
Copy link

Describe the feature

Allow using Path object in python for when a path to something is needed.

Use Case

For example to use a Code.from_asset() function I need to turn my Path object into str. It would be nice to not have to do this cast.

Code.from_asset(str(Path().cwd() / 'aws_infrastructure' / 'lambda_functions')),

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.154.1 (build febce9d)

Environment details (OS name and version, etc.)

Ubuntu 24.04

@InvincibleRMC InvincibleRMC added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Nov 20, 2024
@ashishdhingra ashishdhingra self-assigned this Nov 22, 2024
@ashishdhingra ashishdhingra added p2 investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Nov 22, 2024
@ashishdhingra
Copy link
Contributor

ashishdhingra commented Nov 22, 2024

@InvincibleRMC Good afternoon. If I understand your use case properly, you want to support for overloaded version of Code.from_asset() where it accepts Python's Path() object, instead of requiring to convert into str (string). I'm not sure if it could be supported. The reasoning is that Python CDK library is generated from JSII bindings (it is a specialized process) and supporting language specific class might not be feasible since there might not be overlap across different supported CDK languages. I could review this with team.

Thanks,
Ashish

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Nov 22, 2024
@InvincibleRMC
Copy link
Author

That correctly summarizes my use case. If it is not possible I understand, it would just be more convenient.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Nov 23, 2024
@ashishdhingra
Copy link
Contributor

This could be JSII-related. Reaching out to core team for further inputs here.

@ashishdhingra ashishdhingra added the effort/medium Medium work item – a couple days of effort label Nov 25, 2024
@ashishdhingra ashishdhingra removed their assignment Nov 25, 2024
@rix0rrr
Copy link
Contributor

rix0rrr commented Nov 27, 2024

It's exactly as you said @ashishdhingra.

We have to be multi-language compatible, and not all languages have a Path type. I understand why this would be nice, but it's unlikely to happen soon.

We could do the language-specific conversion in the Python runtime over in the jsii repository: https://github.com/aws/jsii. This issue makes for a good feature request over there.

But again, unlikely to be done by us soon. I would accept someone submitting it if they can demonstrate a high degree of confidence that they understand how jsii works and why this change will not cause any unexpected problems.

@rix0rrr rix0rrr transferred this issue from aws/aws-cdk Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/medium Medium work item – a couple days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

3 participants