summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxXJSONDeruloXx <danielhimebauch@gmail.com>2025-07-13 19:38:12 -0400
committerxXJSONDeruloXx <danielhimebauch@gmail.com>2025-07-13 19:38:12 -0400
commitc051c3a0404a8bf3039790d666e8f6911da44210 (patch)
treedafd7a7926a18eee84abd99983603c235c6c124e
parent9fd824270a2ea668b9cc264a7d0cee7dc93e2cb1 (diff)
downloaddecky-lsfg-vk-c051c3a0404a8bf3039790d666e8f6911da44210.tar.gz
decky-lsfg-vk-c051c3a0404a8bf3039790d666e8f6911da44210.zip
rm unused
-rw-r--r--REFACTORING.md174
-rw-r--r--main_new.py13
-rw-r--r--requirements-test.txt4
-rw-r--r--sync-py-modules.sh17
-rw-r--r--test_refactored.py79
5 files changed, 0 insertions, 287 deletions
diff --git a/REFACTORING.md b/REFACTORING.md
deleted file mode 100644
index e8509a0..0000000
--- a/REFACTORING.md
+++ /dev/null
@@ -1,174 +0,0 @@
-# Code Refactoring Summary
-
-This document summarizes the refactoring changes made to the lsfg-vk plugin based on the code review.
-
-## ๐Ÿ—๏ธ File Structure Changes
-
-### Before (Single File)
-```
-main.py (500+ lines)
-โ”œโ”€โ”€ InstallationService
-โ”œโ”€โ”€ DllDetectionService
-โ”œโ”€โ”€ ConfigurationService
-โ””โ”€โ”€ Plugin
-```
-
-### After (Modular Package)
-```
-lsfg_vk/
-โ”œโ”€โ”€ __init__.py # Package exports
-โ”œโ”€โ”€ constants.py # All constants and configuration
-โ”œโ”€โ”€ types.py # TypedDict definitions for responses
-โ”œโ”€โ”€ base_service.py # Common functionality for all services
-โ”œโ”€โ”€ installation.py # InstallationService
-โ”œโ”€โ”€ dll_detection.py # DllDetectionService
-โ”œโ”€โ”€ configuration.py # ConfigurationService
-โ””โ”€โ”€ plugin.py # Main Plugin class
-
-tests/
-โ”œโ”€โ”€ conftest.py # Test configuration and fixtures
-โ”œโ”€โ”€ test_installation.py # Tests for InstallationService
-โ”œโ”€โ”€ test_configuration.py # Tests for ConfigurationService
-โ””โ”€โ”€ test_dll_detection.py # Tests for DllDetectionService
-
-main.py # Simple import/export for Decky compatibility
-requirements-test.txt # Testing dependencies
-```
-
-## โœจ Key Improvements Implemented
-
-### 1. **Single Responsibility & Modularity**
-- Split monolithic file into focused modules
-- Each service handles one concern
-- Easier to navigate and maintain
-- Reduced merge conflicts
-
-### 2. **Constants Management**
-- All hardcoded paths moved to `constants.py`
-- Template-based script generation
-- Environment variable names centralized
-- Default values defined in one place
-
-### 3. **Path Handling with `pathlib.Path`**
-- Replaced `os.path.*` with `pathlib.Path`
-- More declarative and robust path operations
-- Built-in `.mkdir(parents=True, exist_ok=True)`
-- Cross-platform compatibility
-
-### 4. **Enhanced Error Handling**
-- Specific exception catching (`OSError`, `zipfile.BadZipFile`, `shutil.Error`)
-- Granular error reporting
-- Consistent error response structure
-- Better logging of specific failure points
-
-### 5. **Type Safety with TypedDict**
-- Defined response structures for all methods
-- Consistent API contracts
-- Better IDE support and documentation
-- Runtime compatibility with `Dict[str, Any]`
-
-### 6. **DRY Principle Implementation**
-- `_remove_if_exists()` helper for file removal
-- `_atomic_write()` for safe file writing
-- `_ensure_directories()` for directory creation
-- Unified file destination mapping
-
-### 7. **Atomic File Operations**
-- Safe script writing with temporary files
-- Prevents corruption during writes
-- Proper cleanup on failures
-- Consistent file permissions
-
-### 8. **Logger Injection**
-- Services accept optional logger parameter
-- Defaults to `decky.logger` when None
-- Enables unit testing with mock loggers
-- Better separation of concerns
-
-### 9. **Robust Configuration Parsing**
-- Regex-based parsing instead of string splitting
-- Handles edge cases (extra spaces, comments)
-- Template-based generation
-- Roundtrip consistency testing
-
-### 10. **Comprehensive Testing Framework**
-- Unit tests for each service
-- Mock filesystem with `pyfakefs`
-- Mock logger injection
-- Roundtrip testing for configuration
-- Environment variable mocking
-
-## ๐Ÿงช Testing
-
-### Running Tests
-```bash
-# Install test dependencies
-pip install -r requirements-test.txt
-
-# Run all tests
-pytest tests/
-
-# Run with coverage
-pytest tests/ --cov=lsfg_vk
-
-# Run specific test file
-pytest tests/test_installation.py
-```
-
-### Test Coverage
-- **Installation Service**: ZIP extraction, file copying, installation checking
-- **Configuration Service**: Script parsing, generation, roundtrip testing
-- **DLL Detection Service**: Environment variable priority, path checking
-- **Mock Integration**: All services work with mock loggers for testing
-
-## ๐Ÿ”„ Migration Guide
-
-### For Developers
-The public API remains unchanged - all existing frontend code will continue to work:
-
-```python
-# These calls remain identical
-plugin.install_lsfg_vk()
-plugin.check_lsfg_vk_installed()
-plugin.uninstall_lsfg_vk()
-plugin.get_lsfg_config()
-plugin.update_lsfg_config(...)
-plugin.check_lossless_scaling_dll()
-```
-
-### For Maintainers
-1. **Adding new features**: Add to appropriate service module
-2. **Constants**: Define in `constants.py`
-3. **New response types**: Add to `types.py`
-4. **Testing**: Add tests for new functionality
-5. **Common functionality**: Add to `base_service.py`
-
-## ๐Ÿ“‹ Benefits Achieved
-
-1. **Maintainability**: Easier to find and modify specific functionality
-2. **Testability**: Comprehensive unit test coverage
-3. **Reliability**: Atomic operations and better error handling
-4. **Documentation**: Clear type definitions and API contracts
-5. **Extensibility**: Easy to add new services or features
-6. **Code Quality**: Follows Python best practices and patterns
-
-## ๐Ÿš€ Future Improvements
-
-### Next Steps (Not Yet Implemented)
-1. **Async/Sync Decision**: Evaluate if true async I/O is needed
-2. **Configuration Schema**: JSON schema validation for config files
-3. **Dependency Injection**: More sophisticated service container
-4. **Integration Tests**: End-to-end testing with real files
-5. **Performance Monitoring**: Metrics and logging for operations
-6. **Error Recovery**: More sophisticated error handling and retry logic
-
-### Potential Extensions
-- Plugin settings persistence
-- Multiple DLL version support
-- Automatic updates checking
-- Performance profiling integration
-- Steam integration improvements
-
----
-
-This refactoring maintains 100% backward compatibility while significantly improving code quality, maintainability, and testability.
diff --git a/main_new.py b/main_new.py
deleted file mode 100644
index 18b93f9..0000000
--- a/main_new.py
+++ /dev/null
@@ -1,13 +0,0 @@
-"""
-Main entry point for the lsfg-vk Decky Loader plugin.
-
-This file imports and exposes the Plugin class from the lsfg_vk package.
-The actual implementation has been refactored into separate service modules
-for better maintainability and testability.
-"""
-
-# Import the refactored Plugin class
-from lsfg_vk import Plugin
-
-# Re-export Plugin at module level for Decky Loader compatibility
-__all__ = ['Plugin']
diff --git a/requirements-test.txt b/requirements-test.txt
deleted file mode 100644
index b2a0693..0000000
--- a/requirements-test.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# Testing dependencies for the lsfg-vk plugin
-pytest>=7.0.0
-pytest-asyncio>=0.21.0
-pyfakefs>=5.0.0
diff --git a/sync-py-modules.sh b/sync-py-modules.sh
deleted file mode 100644
index f79108d..0000000
--- a/sync-py-modules.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-
-# sync-py-modules.sh
-# Script to keep py_modules/lsfg_vk in sync with development changes
-
-echo "Syncing py_modules/lsfg_vk..."
-
-# Remove old py_modules content
-rm -rf py_modules/lsfg_vk/__pycache__ 2>/dev/null
-
-# Copy updated files (excluding cache)
-rsync -av --exclude="__pycache__" lsfg_vk/ py_modules/lsfg_vk/ 2>/dev/null || {
- echo "Note: lsfg_vk/ directory not found - this is expected after cleanup"
- echo "py_modules/lsfg_vk/ is now the primary development location"
-}
-
-echo "py_modules sync complete"
diff --git a/test_refactored.py b/test_refactored.py
deleted file mode 100644
index a25d9ef..0000000
--- a/test_refactored.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/env python3
-"""
-Simple test script to verify the refactored plugin works.
-"""
-
-import sys
-from pathlib import Path
-from unittest.mock import Mock
-
-# Add the project root to the path
-project_root = Path(__file__).parent
-sys.path.insert(0, str(project_root))
-
-# Mock the decky module
-mock_decky = Mock()
-mock_decky.logger = Mock()
-sys.modules['decky'] = mock_decky
-
-# Now we can import our plugin
-from lsfg_vk import Plugin
-
-def test_plugin_creation():
- """Test that we can create a plugin instance"""
- print("๐Ÿงช Testing plugin creation...")
- plugin = Plugin()
- print("โœ… Plugin created successfully!")
- return plugin
-
-def test_installation_check():
- """Test the installation check method"""
- print("๐Ÿงช Testing installation check...")
- plugin = Plugin()
- result = plugin.check_lsfg_vk_installed()
- print(f"โœ… Installation check result: {result}")
- return result
-
-def test_dll_detection():
- """Test the DLL detection method"""
- print("๐Ÿงช Testing DLL detection...")
- plugin = Plugin()
- result = plugin.check_lossless_scaling_dll()
- print(f"โœ… DLL detection result: {result}")
- return result
-
-def test_config_operations():
- """Test configuration operations"""
- print("๐Ÿงช Testing configuration operations...")
- plugin = Plugin()
-
- # This will fail since the script doesn't exist, but should return a proper error
- result = plugin.get_lsfg_config()
- print(f"โœ… Config get result: {result}")
-
- return result
-
-if __name__ == "__main__":
- print("๐Ÿš€ Starting refactored plugin tests...\n")
-
- try:
- test_plugin_creation()
- print()
-
- test_installation_check()
- print()
-
- test_dll_detection()
- print()
-
- test_config_operations()
- print()
-
- print("๐ŸŽ‰ All tests completed successfully!")
- print("๐Ÿ“ฆ The refactored plugin structure is working correctly.")
-
- except Exception as e:
- print(f"โŒ Test failed with error: {e}")
- import traceback
- traceback.print_exc()
- sys.exit(1)