def update_pyproject_version(package_path: Path, new_version: str) -> None:
    """Update the version in a pyproject.toml file."""
    pyproject_path = package_path / "pyproject.toml"

    # Read the file content
    with open(pyproject_path, "r") as f:
        content = f.read()

    pattern = r'(\[project\][^\[]*?version\s*=\s*["\'])([^"\']+)(["\'])'
    new_content = re.sub(pattern, rf"\g<1>{new_version}\g<3>", content, flags=re.DOTALL)

    # Write the updated content back
    with open(pyproject_path, "w") as f:
        f.write(new_content)
Update the version in a pyproject.toml file.
llama-dev/llama_dev/pkg/bump.py