Refactor shared constants and remove deprecated function#142
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR centralizes previously scattered “constants” into dedicated module-level constants.py files (storage/config/engines), updates imports/usages across the codebase (including tests), and removes deprecated configuration helpers to simplify the public config API.
Changes:
- Introduced new constants modules for storage, config, and engines; updated imports throughout.
- Standardized supported audio file extensions via
SUPERSET_AUDIO_EXTENSIONSand replaced hardcoded extension sets. - Removed deprecated
get_config_pathusage and tightened config file resolution behavior.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/storage/test_setup.py | Updates test import to new storage constants module. |
| tests/storage/test_models.py | Updates test imports to new storage constants module. |
| tests/engines/test_engine_manager.py | Updates comment to reflect AVAILABLE_TOOLS rename. |
| tests/config/test_app_config.py | Removes get_config_path usage and updates help_url expectation. |
| src/voxkit/storage/utils.py | Switches STORAGE_ROOT import to storage.constants. |
| src/voxkit/storage/models.py | Switches MODELS_ROOT import to storage.constants. |
| src/voxkit/storage/datasets.py | Uses SUPERSET_AUDIO_EXTENSIONS and updates storage constants imports. |
| src/voxkit/storage/constants.py | New module consolidating storage constants and audio extension set. |
| src/voxkit/storage/config.py | Removes legacy storage constants module. |
| src/voxkit/storage/alignments.py | Switches to storage.constants and reuses centralized audio extensions. |
| src/voxkit/gui/pages/pipeline/viewer_stacker.py | Reuses centralized audio extensions constant in GUI pipeline viewer. |
| src/voxkit/engines/constants.py | New module defining AVAILABLE_TOOLS Literal for engine tool typing. |
| src/voxkit/engines/init.py | Updates engine manager typing/docs and exports AVAILABLE_TOOLS. |
| src/voxkit/config/startup_config.py | Removes legacy HELP_URL constant and updates storage import. |
| src/voxkit/config/constants.py | New module defining DEFAULT_HELP_URL. |
| src/voxkit/config/app_config.py | Uses DEFAULT_HELP_URL, removes get_config_path, and removes legacy config-root lookup for config files. |
| src/voxkit/config/init.py | Exposes DEFAULT_HELP_URL and removes HELP_URL export. |
| src/voxkit/analyzers/default_analyzer.py | Reuses centralized audio extensions constant. |
| src/voxkit/analyzers/clip_duration_statistics.py | Reuses centralized audio extensions constant. |
| src/voxkit/analyzers/audio_format_profile.py | Reuses centralized audio extensions constant. |
| README.md | Refactors badge/link formatting and updates displayed badges/links. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+4
| from typing import Literal | ||
|
|
||
| # New engines can implement these tools or a subset of them | ||
| AVAILABLE_TOOLS = Literal["train", "align", "transcribe"] |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the handling of constants to a formal constants.py per module and migrates some constants as formal examples. Some legacy code is removed for clarity and maintainability. The most important changes are grouped below:
Centralization and Standardization of Constants:
src/voxkit/storage/constants.pyto hold all storage-related constants, includingSTORAGE_ROOT,MODELS_ROOT,DATASETS_ROOT,ALIGNMENTS_ROOT, andSUPERSET_AUDIO_EXTENSIONS. Updated all relevant imports to use this new module instead of the oldconfig.py. [1] [2] [3] [4] [5] [6] [7]SUPERSET_AUDIO_EXTENSIONSas the canonical set of supported audio file extensions and replaced hardcoded sets throughout the codebase with this constant. [1] [2] [3] [4] [5] [6] [7] [8]Configuration Module Improvements:
src/voxkit/config/constants.pyfor configuration-related constants, includingDEFAULT_HELP_URL, and updated references throughout the codebase. [1] [2] [3] [4] [5] [6] [7]get_config_pathfunction and its usages, simplifying the configuration API. [1] [2] [3]AppConfigdataclass to useDEFAULT_HELP_URLand allowhelp_urlto beNoneby default. [1] [2]Engine Tool Types and Typing Improvements:
src/voxkit/engines/constants.pywith theAVAILABLE_TOOLSLiteral type, replacing the previousToolType. Updated all usages and imports accordingly. [1] [2] [3] [4] [5] [6]Removal of Deprecated or Redundant Code:
src/voxkit/storage/config.pyfile, consolidating all storage constants intoconstants.py.HELP_URLinstartup_config.py. [1] [2]These changes improve maintainability, consistency, and clarity throughout the codebase.