Skip to content

Refactor shared constants and remove deprecated function#142

Merged
BeckettFrey merged 10 commits into
developfrom
isolate-constants
May 21, 2026
Merged

Refactor shared constants and remove deprecated function#142
BeckettFrey merged 10 commits into
developfrom
isolate-constants

Conversation

@BeckettFrey
Copy link
Copy Markdown
Member

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:

  • Introduced src/voxkit/storage/constants.py to hold all storage-related constants, including STORAGE_ROOT, MODELS_ROOT, DATASETS_ROOT, ALIGNMENTS_ROOT, and SUPERSET_AUDIO_EXTENSIONS. Updated all relevant imports to use this new module instead of the old config.py. [1] [2] [3] [4] [5] [6] [7]
  • Added SUPERSET_AUDIO_EXTENSIONS as 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:

  • Created src/voxkit/config/constants.py for configuration-related constants, including DEFAULT_HELP_URL, and updated references throughout the codebase. [1] [2] [3] [4] [5] [6] [7]
  • Removed the legacy get_config_path function and its usages, simplifying the configuration API. [1] [2] [3]
  • Updated the AppConfig dataclass to use DEFAULT_HELP_URL and allow help_url to be None by default. [1] [2]

Engine Tool Types and Typing Improvements:

  • Introduced src/voxkit/engines/constants.py with the AVAILABLE_TOOLS Literal type, replacing the previous ToolType. Updated all usages and imports accordingly. [1] [2] [3] [4] [5] [6]

Removal of Deprecated or Redundant Code:

  • Removed the old src/voxkit/storage/config.py file, consolidating all storage constants into constants.py.
  • Cleaned up legacy or unused variables and references, such as HELP_URL in startup_config.py. [1] [2]

These changes improve maintainability, consistency, and clarity throughout the codebase.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_EXTENSIONS and replaced hardcoded extension sets.
  • Removed deprecated get_config_path usage 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 thread src/voxkit/storage/constants.py Outdated
Comment thread src/voxkit/config/app_config.py Outdated
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"]
BeckettFrey and others added 4 commits May 21, 2026 11:14
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>
@BeckettFrey BeckettFrey merged commit cb4af8e into develop May 21, 2026
@BeckettFrey BeckettFrey deleted the isolate-constants branch May 21, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants