_version.py 557 B

12345678910111213141516171819
  1. """
  2. handle the current version info of traitlets.
  3. """
  4. from __future__ import annotations
  5. import re
  6. from typing import List
  7. # Version string must appear intact for hatch versioning
  8. __version__ = "5.14.3"
  9. # Build up version_info tuple for backwards compatibility
  10. pattern = r"(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)"
  11. match = re.match(pattern, __version__)
  12. assert match is not None
  13. parts: List[object] = [int(match[part]) for part in ["major", "minor", "patch"]]
  14. if match["rest"]:
  15. parts.append(match["rest"])
  16. version_info = tuple(parts)