您可以用诗歌管理CDK项目吗?
第一次尝试CDK。虽然可以将诗歌用于功能依赖性,但我正在寻找一种使用诗歌来管理CDK项目本身的方法。
遵循本指南: https://docs.aws .amazon.com/cdk/v2/guide/with-with-with-cdk-python.html 设置项目的建议包含以下步骤:
cdk init app --language python
source .venv/bin/activate
python -m pip install -r requirements.txt
本质上,我希望能够诗歌运行CDK INIT APP-语言Python
而不是cdk init
需要一个空目录开始。
是否有最好的做法可以将CDK项目完全置于诗歌之下?否则,将TypeScript用于该项目,而Python进行功能是我的下一个最佳选择。
Trying CDK for the first time. While it is possible to use poetry for the function dependencies, I am looking for a way to also manage the CDK project itself using poetry.
Following this guide: https://docs.aws.amazon.com/cdk/v2/guide/work-with-cdk-python.html
the recommendation to set up a project contains these step:
cdk init app --language python
source .venv/bin/activate
python -m pip install -r requirements.txt
Essentially, I'd like to be able to poetry run cdk init app --language python
instead but cdk init
requires an empty directory to begin with.
Is there a best practice to put the cdk project entirely under poetry? Otherwise using Typescript for the project and Python for the functions would be my next best option.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,可以做到。我为我开发的每个Python CDK项目都这样做。正如@gshpychka所说,您可以自己创建项目。您也可以让
CDK INIT
执行此操作,然后删除unignts.txt
,然后用pyproject.toml
替换它。readme.md
文件也可能需要更新。这部分不是必需的,但是我也喜欢更新
cdk.json
,因此诗歌是自动为我执行的。替换:与:
每次运行
CDK合成器
,cdk部署
或任何其他命令时,它都会自动为您使用诗歌。最后,您可以使用 projen 用诗歌为您生成整个事物。这是非常意见的,但确实包含许多有用的功能,例如计划的GitHub操作以自动更新依赖项,合并等。
Yes, it can be done. I do it for every Python CDK project I develop. As @gshpychka said, you can create the project yourself. You can also let
cdk init
do its thing and then deleterequirements.txt
and replace it withpyproject.toml
. TheREADME.md
file might also need an update.This part is not required, but I like updating
cdk.json
as well so Poetry is executed automatically for me. Replace:With:
That way every time you run
cdk synth
,cdk deploy
or any other command, it will automatically use Poetry for you.Finally, you can use projen to generate the whole thing for you with Poetry. It is quite opiniated but does include a lot of useful features like scheduled GitHub Actions to update dependencies automatically, mergify, etc.