aws-pdk icon indicating copy to clipboard operation
aws-pdk copied to clipboard

[FEATURE] Consider `uv` for Python projects

Open polothy opened this issue 11 months ago • 3 comments

Describe the feature

Just wanted to give you a heads up about a uv feature I recently tried: workspaces. Since PDK makes multiple projects in one, then uv workspaces would help manage the dependencies. For example, it can upgrade the root and all workspaces as well as install all deps from workspaces via uv sync --all-packages. This works well with IDEs because all the dependencies are in one virtualenv.

The uv docs also include how to bundle Lambdas. This works inside workspaces as well.

Use Case

Improve developer experience for monorepo Python projects.

Proposed Solution

uv workspaces as mentioned above.

Other Information

No response

Acknowledgements

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

PDK version used

unknown

What languages will this feature affect?

Python

Environment details (OS name and version, etc.)

macOS

polothy avatar Apr 08 '25 19:04 polothy

UV is awesome! We'd certainly be open to reviewing a PR if you'd be keen to contribute!

In the mean time, you may be interested to check out the Nx Plugin for AWS, which uses UV and a shared virtual environment for Python projects.

cogwirrel avatar Apr 23 '25 00:04 cogwirrel

@cogwirrel As a major author of both this project and NX one, what sort of decision tree would you use to pick one over the other? It seems like PDK might be more generative and updates over time, whereas NX version might be a generate once and now you own it? Perhaps the advantage of the NX is you choose what to generate and you could generate multiples (EG: like multiple lambda constructs or something).

polothy avatar Apr 28 '25 15:04 polothy

I'd say the main deciding factor is your preference for Projen! While some customers (myself included) love the abstractions it offers, others find the concept of projects-as-code too much, and so we sought to offer an alternative where users can freely own and modify their config files without going through the framework. Generally if using AI coding assistants like Amazon Q Developer, it's more likely to want to edit files directly and therefore the Nx Plugin for AWS is a little more GenAI friendly in that regard.

You're right in that using PDK/Projen means you can receive updates over time - with Nx you can do this with something called "migrations" but I think we'll generally keep those to only the necessary cases.

Hope that helps! At present our main focus is on the Nx Plugin, so it's unlikely that we'll be able to prioritise adding UV to PDK any time soon, but we're very much open to community contributions :)

cogwirrel avatar Apr 29 '25 06:04 cogwirrel