MCPcopy Create free account
hub / github.com/crewAIInc/crewAI / update_pyproject_version

Function update_pyproject_version

lib/devtools/src/crewai_devtools/cli.py:304–327  ·  view source on GitHub ↗

Update the [project] version field in a pyproject.toml file. Args: file_path: Path to pyproject.toml file. new_version: New version string. Returns: True if version was updated, False otherwise.

(file_path: Path, new_version: str)

Source from the content-addressed store, hash-verified

302
303
304def update_pyproject_version(file_path: Path, new_version: str) -> bool:
305 """Update the [project] version field in a pyproject.toml file.
306
307 Args:
308 file_path: Path to pyproject.toml file.
309 new_version: New version string.
310
311 Returns:
312 True if version was updated, False otherwise.
313 """
314 if not file_path.exists():
315 return False
316
317 doc = tomlkit.parse(file_path.read_text())
318 project = doc.get("project")
319 if project is None:
320 return False
321 old_version = project.get("version")
322 if old_version is None or old_version == new_version:
323 return False
324
325 project["version"] = new_version
326 file_path.write_text(tomlkit.dumps(doc))
327 return True
328
329
330_DEFAULT_WORKSPACE_PACKAGES: Final[list[str]] = [

Calls 3

read_textMethod · 0.80
parseMethod · 0.45
getMethod · 0.45