From f3ac1970b791778b43de4704dfe3d9f4aba01bf4 Mon Sep 17 00:00:00 2001 From: Dmitrii Kharitonov Date: Sun, 29 Jun 2025 14:38:16 +0200 Subject: [PATCH 1/2] Add clean command to dev.sh script for removing build artifacts --- scripts/dev.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/dev.sh b/scripts/dev.sh index e06ff82..ee92702 100755 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -13,6 +13,7 @@ function usage() { echo " check-all - Run all checks" echo " tests - Run tests" echo " hooks - Run all pre-commit hooks on all files" + echo " clean - Clean up build artifacts (dist/, build/, *.egg-info/)" echo "" exit 1 } @@ -56,6 +57,11 @@ case "$1" in echo "๐Ÿช Running all pre-commit hooks on all files..." uv run pre-commit run --all-files ;; + clean) + echo "๐Ÿงน Cleaning up build artifacts..." + rm -rf dist/ build/ *.egg-info/ + echo "โœ… Cleanup completed!" + ;; *) usage ;; From adeade746b28b8d877012eee1e2cdd979c4c0c67 Mon Sep 17 00:00:00 2001 From: Dmitrii Kharitonov Date: Sun, 29 Jun 2025 14:59:36 +0200 Subject: [PATCH 2/2] Improve version management: remove _version.py and use importlib.metadata --- pyproject.toml | 1 - src/speech_prep/__init__.py | 10 +++++++++- src/speech_prep/_version.py | 4 ---- 3 files changed, 9 insertions(+), 6 deletions(-) delete mode 100644 src/speech_prep/_version.py diff --git a/pyproject.toml b/pyproject.toml index 8fedff0..2e39f60 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,6 @@ build-backend = "hatchling.build" [tool.hatch.version] source = "vcs" -path = "src/speech_prep/_version.py" [tool.ruff] target-version = "py39" diff --git a/src/speech_prep/__init__.py b/src/speech_prep/__init__.py index 8aab3ac..f26c598 100644 --- a/src/speech_prep/__init__.py +++ b/src/speech_prep/__init__.py @@ -5,7 +5,6 @@ including silence detection and removal, speed adjustment, and format conversion. """ -from ._version import __version__ from .core import SoundFile from .exceptions import ( AudioPropertiesError, @@ -15,6 +14,15 @@ SpeechPrepError, ) +# Import version from hatch-vcs +try: + from importlib.metadata import version as get_metadata_version + + __version__ = get_metadata_version("speech-prep") +except ImportError: + # Development or not installed + __version__ = "0.0.0" + __all__ = [ "SoundFile", "SpeechPrepError", diff --git a/src/speech_prep/_version.py b/src/speech_prep/_version.py deleted file mode 100644 index d48ec81..0000000 --- a/src/speech_prep/_version.py +++ /dev/null @@ -1,4 +0,0 @@ -"""Version information.""" - -# This file is automatically generated by hatch-vcs -__version__ = "0.0.0" # This will be replaced during build