""" Version information for MarkiTect. This module provides version information using setuptools-scm. Version is automatically derived from git tags. """ try: from ._version import version as __version__ except ImportError: # Fallback when _version.py is not available (e.g., during development without setuptools-scm) __version__ = "unknown" def get_version(): """Get the current version string.""" return __version__ def get_version_info(): """Get comprehensive version information.""" try: from ._version import version_tuple, commit_id except ImportError: version_tuple = ("unknown",) commit_id = "unknown" return { 'full_version': __version__, 'short_version': __version__.split('.dev')[0] if '.dev' in __version__ else __version__, 'version_tuple': version_tuple, 'commit_id': commit_id, 'is_dev': '.dev' in __version__ } def get_release_info(): """Get release information for the project.""" import os import subprocess from datetime import datetime version_info = get_version_info() # Try to get git information if available try: git_branch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'], cwd=os.path.dirname(__file__), stderr=subprocess.DEVNULL).decode().strip() except: git_branch = "unknown" try: git_commit = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=os.path.dirname(__file__), stderr=subprocess.DEVNULL).decode().strip() except: git_commit = version_info.get('commit_id', 'unknown') return { 'name': 'MarkiTect', 'version': version_info['full_version'], 'short_version': version_info['short_version'], 'is_development': version_info['is_dev'], 'git_branch': git_branch, 'git_commit': git_commit, 'build_date': datetime.now().isoformat(), 'python_version': f"{__import__('sys').version_info.major}.{__import__('sys').version_info.minor}.{__import__('sys').version_info.micro}" }