The version string.
(cls)
| 137 | |
| 138 | @classmethod |
| 139 | def string(cls) -> str: |
| 140 | """The version string.""" |
| 141 | if cls.__string_attr is None: |
| 142 | # If set, BUILD_VERSION should override any local version |
| 143 | # information. CI will use this to manage, e.g., release vs. nightly |
| 144 | # versions. |
| 145 | version = os.getenv("BUILD_VERSION", "").strip() |
| 146 | if not version: |
| 147 | # Otherwise, read the version from a local file and add the git |
| 148 | # commit if available. |
| 149 | version = ( |
| 150 | open(os.path.join(cls._root_dir(), "version.txt")).read().strip() |
| 151 | ) |
| 152 | if cls.git_hash(): |
| 153 | version += "+" + cls.git_hash()[:7] # type: ignore[index] |
| 154 | cls.__string_attr = version |
| 155 | return cls.__string_attr |
| 156 | |
| 157 | @classmethod |
| 158 | def write_to_python_file(cls, path: str) -> None: |
no test coverage detected