From 8d45881c7ef3b77591e39cc94c650a474cbe0e73 Mon Sep 17 00:00:00 2001 From: Justin Bollinger Date: Fri, 13 Feb 2026 21:58:17 -0500 Subject: [PATCH] feat: auto-derive version from git tags using setuptools-scm Replace hardcoded version with setuptools-scm so the version updates automatically from git tags. The ASCII banner strips the dirty date suffix but preserves the git node hash. Co-Authored-By: Claude Opus 4.6 --- .gitignore | 1 + hate_crack/__init__.py | 3 +++ hate_crack/main.py | 10 +++++++--- pyproject.toml | 7 +++++-- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index d5d994e..b2c3dac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ config.json hashcat.pot hate_crack/__init__.pyc +hate_crack/_version.py __pycache__/ hate_crack/__pycache__/ tests/__pycache__/ diff --git a/hate_crack/__init__.py b/hate_crack/__init__.py index cb37f13..e822b6d 100644 --- a/hate_crack/__init__.py +++ b/hate_crack/__init__.py @@ -1 +1,4 @@ # hate_crack package +from hate_crack._version import __version__, __version_tuple__ + +__all__ = ["__version__", "__version_tuple__"] diff --git a/hate_crack/main.py b/hate_crack/main.py index 569f564..f17b1b1 100755 --- a/hate_crack/main.py +++ b/hate_crack/main.py @@ -773,15 +773,19 @@ def usage(): def ascii_art(): + import re + from hate_crack import __version__ + + version = re.sub(r"\.d\d{8}$", "", __version__) print(r""" - ___ ___ __ _________ __ + ___ ___ __ _________ __ / | \_____ _/ |_ ____ \_ ___ \____________ ____ | | __ / ~ \__ \\ __\/ __ \ / \ \/\_ __ \__ \ _/ ___\| |/ / -\ Y // __ \| | \ ___/ \ \____| | \// __ \\ \___| < +\ Y // __ \| | \ ___/ \ \____| | \// __ \\ \___| < \___|_ /(____ /__| \___ >____\______ /|__| (____ /\___ >__|_ \ \/ \/ \/_____/ \/ \/ \/ \/ - Version 2.0 + Version """ + version + """ """) diff --git a/pyproject.toml b/pyproject.toml index fe707bf..89e2ecf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["setuptools>=69"] +requires = ["setuptools>=69", "setuptools-scm>=8"] build-backend = "setuptools.build_meta" [project] name = "hate_crack" -version = "2.0" +dynamic = ["version"] description = "Menu driven Python wrapper for hashcat" readme = "README.md" requires-python = ">=3.13" @@ -37,6 +37,9 @@ hate_crack = [ "princeprocessor/**", ] +[tool.setuptools_scm] +version_file = "hate_crack/_version.py" + [tool.ruff] exclude = [ "build",