Read the package version string from pyproject.toml.
(pyproject_path: Path | None = None)
| 10 | |
| 11 | |
| 12 | def read_package_version(pyproject_path: Path | None = None) -> str: |
| 13 | """Read the package version string from pyproject.toml.""" |
| 14 | text = (pyproject_path or ROOT / "pyproject.toml").read_text(encoding="utf-8") |
| 15 | match = re.search(r'^version\s*=\s*"([^"]+)"', text, re.MULTILINE) |
| 16 | if not match: |
| 17 | raise ValueError("Could not find version in pyproject.toml") |
| 18 | return match.group(1) |
| 19 | |
| 20 | |
| 21 | def sync_manifests(version: str | None = None, root: Path | None = None) -> list[Path]: |
no outgoing calls