MCPcopy Create free account
hub / github.com/commitizen-tools/commitizen / get_default_version_provider

Function get_default_version_provider

commitizen/project_info.py:25–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23
24
25def get_default_version_provider() -> Literal[
26 "commitizen", "cargo", "composer", "npm", "pep621", "poetry", "uv"
27]:
28 pyproject_path = Path("pyproject.toml")
29 if pyproject_path.is_file():
30 # TOML files are UTF-8 by specification, whatever the locale encoding
31 if "[tool.poetry]" in pyproject_path.read_text(encoding="utf-8"):
32 return "poetry"
33 if Path("uv.lock").is_file():
34 return "uv"
35 return "pep621"
36
37 if Path("setup.py").is_file():
38 return "pep621"
39
40 if Path("Cargo.toml").is_file():
41 return "cargo"
42
43 if Path("package.json").is_file():
44 return "npm"
45
46 if Path("composer.json").is_file():
47 return "composer"
48
49 return "commitizen"
50
51
52def get_default_config_filename() -> Literal["pyproject.toml", ".cz.toml"]:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected