Skip to content

Update init.py #1380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions commitizen/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class ProjectInfo:
def has_pyproject(self) -> bool:
return os.path.isfile("pyproject.toml")

@property
def has_uv(self) -> bool:
return os.path.isfile("uv.toml")

@property
def has_setup(self) -> bool:
return os.path.isfile("setup.py")
Expand Down Expand Up @@ -229,6 +233,7 @@ def _ask_version_provider(self) -> str:
"pep621": "pep621: Get and set version from pyproject.toml:project.version field",
"poetry": "poetry: Get and set version from pyproject.toml:tool.poetry.version field",
"scm": "scm: Fetch the version from git and does not need to set it back",
"uv": "uv: Get and set version from pyproject.toml:project.version field and uv.lock:package.version field where package.name matches pyproject.toml:project.name"
}

default_val = "commitizen"
Expand All @@ -243,6 +248,8 @@ def _ask_version_provider(self) -> str:
default_val = "npm"
elif self.project_info.is_php_composer:
default_val = "composer"
elif self.project_info.is_uv:
default_val = "uv"

choices = [
questionary.Choice(title=title, value=value)
Expand Down
Loading