_version.py
python
sha256:2eaa5d95f9d9383498e76947410a26e5a3ba23d182f339910c424cf88fad412b
fix: try fetch/presign before fetch/mpack to avoid Cloudfla…
Sonnet 4.6
patch
8 days ago
| 1 | """Single source of truth for the Muse package version. |
| 2 | |
| 3 | All schema_version fields across the codebase read from here rather than |
| 4 | hardcoding a number. The version itself lives in ``pyproject.toml``. |
| 5 | |
| 6 | Editable installs read pyproject.toml directly so that bumping the version |
| 7 | is immediately reflected without reinstalling. Packaged installs (tarballs) |
| 8 | have no pyproject.toml alongside the source and fall through to |
| 9 | importlib.metadata, which reads the dist-info stamped at build time. |
| 10 | The two install modes never interfere with each other. |
| 11 | """ |
| 12 | |
| 13 | import pathlib as _pathlib |
| 14 | import re as _re |
| 15 | |
| 16 | |
| 17 | def _read_version() -> str: |
| 18 | _toml = _pathlib.Path(__file__).parent.parent / "pyproject.toml" |
| 19 | if _toml.is_file(): |
| 20 | _m = _re.search(r'^version\s*=\s*"([^"]+)"', _toml.read_text(), _re.MULTILINE) |
| 21 | if _m: |
| 22 | return _m.group(1) |
| 23 | from importlib.metadata import PackageNotFoundError, version as _meta_version |
| 24 | try: |
| 25 | return _meta_version("muse") |
| 26 | except PackageNotFoundError: |
| 27 | return "0.0.0+dev" |
| 28 | |
| 29 | |
| 30 | __version__: str = _read_version() |
File History
1 commit
sha256:2eaa5d95f9d9383498e76947410a26e5a3ba23d182f339910c424cf88fad412b
fix: try fetch/presign before fetch/mpack to avoid Cloudfla…
Sonnet 4.6
patch
8 days ago