Test whether the binary's version is at least the given one. Useful for gating features that are available in the latest data server builds from head, but not yet released to PyPI. For example, if v0.4.0 is the latest published version, you can check `at_least_versio
(self, required_version)
| 238 | return self._path |
| 239 | |
| 240 | def at_least_version(self, required_version): |
| 241 | """Test whether the binary's version is at least the given one. |
| 242 | |
| 243 | Useful for gating features that are available in the latest data |
| 244 | server builds from head, but not yet released to PyPI. For |
| 245 | example, if v0.4.0 is the latest published version, you can |
| 246 | check `at_least_version("0.5.0a0")` to include both prereleases |
| 247 | at head and the eventual final release of v0.5.0. |
| 248 | |
| 249 | If this binary's version was set to `None` at construction time, |
| 250 | this method always returns `True`. |
| 251 | |
| 252 | Args: |
| 253 | required_version: PEP 396-compliant version string. |
| 254 | |
| 255 | Returns: |
| 256 | Boolean. |
| 257 | """ |
| 258 | if self._version is None: |
| 259 | return True |
| 260 | return self._version >= packaging_version.parse(required_version) |
| 261 | |
| 262 | |
| 263 | def get_server_binary(): |