Skip to content

Commit 904173e

Browse files
Lee-Wwoile
authored andcommitted
feat(init): set uv to default value if both pyproject.toml and uv.lock present
1 parent 17021fa commit 904173e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

commitizen/commands/init.py

+10
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ class ProjectInfo:
2424
def has_pyproject(self) -> bool:
2525
return os.path.isfile("pyproject.toml")
2626

27+
@property
28+
def has_uv_lock(self) -> bool:
29+
return os.path.isfile("uv.lock")
30+
2731
@property
2832
def has_setup(self) -> bool:
2933
return os.path.isfile("setup.py")
@@ -32,6 +36,10 @@ def has_setup(self) -> bool:
3236
def has_pre_commit_config(self) -> bool:
3337
return os.path.isfile(".pre-commit-config.yaml")
3438

39+
@property
40+
def is_python_uv(self) -> bool:
41+
return self.has_pyproject and self.has_uv_lock
42+
3543
@property
3644
def is_python_poetry(self) -> bool:
3745
if not self.has_pyproject:
@@ -236,6 +244,8 @@ def _ask_version_provider(self) -> str:
236244
if self.project_info.is_python:
237245
if self.project_info.is_python_poetry:
238246
default_val = "poetry"
247+
elif self.project_info.is_python_uv:
248+
default_val = "uv"
239249
else:
240250
default_val = "pep621"
241251
elif self.project_info.is_rust_cargo:

0 commit comments

Comments
 (0)