Is it possible to `uv init` a project starting from a template TOML?
I am in the process of creating a bunch of projects that all require the same index settings and constraint-dependencies. I was wondering it is possible to create a project with uv init and pass some kind of option to use a file as a template. I tried --config-file passing a uv.toml with the following content:
[[index]]
name = "some_index"
url = "some_url"
explicit = true
[sources]
some_dep = { index = "some_index" }
# see https://github.com/astral-sh/uv/issues/7703
constraint-dependencies = ["kaleido!=0.2.1.post1"]
but it did nothing. Note that using a workspace is not an option for me.
This isn't possible yet. Why isn't a workspace an option?
I see. I'm not using a workspace because I need all projects to be independent from each other and with their own venv folder.
Just some input on this for design purposes. Somewhat different use-case I suppose, happy to move if there's a better spot for it:
I find myself lately creating a lot of small projects; probably has something to do with AI tools like Cursor allowing creating a project to explore something instead of just using a free-standing script. Even though they're small I want uv (already indispensable) and Git, etc., since these "side projects" have a habit of growing beyond initial expectations.
When I create a new project, I find myself always copying ruff, pyright, and pytest settings into pyproject.toml from a prior project since I use mostly the same settings on most all my projects; line length, strict mode, which lints to use/exclude, etc.
So:
As a developer frequently using
uvto create a new project I would like to configurepyproject.tomlsettings to be added to each new project duringuv initSuch that hand-customization of a new project with routine details is minimized
I'm sure there are other settings that would be worthwhile to "templatize", but this is the aspect that I see drawing my attention most frequently in recent experience.
Yeah, this would be really useful. uv is great for managing many small projects, even when not using workspaces. Having some kind of pytemplate.toml in a parent directory and/or in the home config folder, which automatically gets picked up by uv init and adds the configuration from pytemplate.toml, can be useful.
Maybe not the ideal solution, but I have been using a cookiecutter template to have this functionality: https://github.com/tim-hilde/dotfiles/tree/main/cookiecutter/python_minimal
Bump. Just started using uv, immediately looked for this feature; sad it doesn't exist
I second this