uv icon indicating copy to clipboard operation
uv copied to clipboard

Allow `uv init` to use `cookiecutter` and `copier` templates

Open baggiponte opened this issue 1 year ago • 3 comments

I have been using the package management uv features, albeit in preview. Amazing product, responsiveness and pace of development 🚀

PDM has a great feature: the pdm init command can take --cookiecutter or --copier optional argument to initialise a project (including scaffold) using a template ref. I don't know how to reproduce that in uv - I don't know what template engine there is in Rust, maybe Armin's minijinja? Would be a slick feature.

baggiponte avatar Jul 03 '24 07:07 baggiponte

https://rye.astral.sh/guide/commands/init/ ?

astrojuanlu avatar Jul 03 '24 13:07 astrojuanlu

Agreed. Scaffolding from community templates would be a nice (but not critical) next step. No comment on cookiecutter vs. copier vs. other.

pauleveritt avatar Aug 20 '24 21:08 pauleveritt

Some nice detailed context in https://github.com/astral-sh/uv/issues/9754

zanieb avatar Dec 10 '24 00:12 zanieb

Add perspective as an interested user, tracking this and #9754:

I think project template generation is a big win, and should be closely integrated with uv init to make it a natural part of the project. It could be argued that such a system already exists, it just has one trivial template. That's the UX experience, and the only thing beyond that I'm interested in as a user is the quality of the template library. (Aside: uv should take advantage of the best project template library it can find. The only one I could find is https://www.cookiecutter.io/)

That said, my developer mind keeps coming back to "tools", and the idea that every lifecycle stage (init, lint, build, test, publish) essentially has a specific tool associated with it (whether internal or external), and there are levels of mappings between those tools and build lifecycle:

  • global default (what uv does out of the box)
  • user defaults (in ~ somewhere)
  • project settings in pyproject.toml

Having a simple way to set those mappings (edit config files, or a uv sub-command like uv default build hatch where hatch is installed by uv tool) would go a long way to generic tool support.

philion avatar Feb 28 '25 18:02 philion