-
-
Notifications
You must be signed in to change notification settings - Fork 672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split addonHandler module #17797
Open
ctoth
wants to merge
20
commits into
nvaccess:master
Choose a base branch
from
nvda-art:addonCleanup
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Split addonHandler module #17797
Conversation
This file contains 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
Split addon handling code into separate modules: - AddonBase.py - Base classes AddonBase and AddonError - AddonBundle.py - Bundle class for handling addon packages - AddonManifest.py - Manifest class and manifest handling This improves code organization by: - Separating concerns into logical modules - Reducing complexity of __init__.py No functional changes, only code reorganization.
Move the Addon class from addonHandler/__init__.py into its own module (addon.py) to improve code organization and readability. Also move AddonStateCategory enum and state management from addonStore/models/status.py to addonHandler/addonState.py where it more logically belongs. This is a refactoring change that: - Reduces the size of addonHandler/__init__.py by extracting Addon class - Places addon state management closer to the addon code - Improves overall code modularity and organization
Tests cover bundle initialization, validation, extraction, and creation from directories, including various error handling scenarios. Both mocked and real file tests ensure proper functionality with different file types and path formats.
@ctoth is this PR ready for review? |
CyrilleB79
reviewed
Mar 21, 2025
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.
Link to issue number:
N/A - Code organization improvement
Summary of the issue:
The addonHandler module was overly large with all functionality in init.py, making it difficult to maintain and understand. This PR reorganizes the code into smaller, more focused modules while preserving the same functionality, and adds tests for the AddonBundle component.
Description of user facing changes
None. This is a purely internal refactoring of the codebase with no user-facing changes.
Description of development approach
This PR splits the large
addonHandler/__init__.py
file into several logical modules:addonBase.py
- Contains base classes and common exceptionsaddon.py
- Contains the main Addon class implementationAddonBundle.py
- Contains bundle-related functionalityAddonManifest.py
- Contains manifest-related functionalityaddonState.py
- Manages the state of addons in NVDAThe PR focuses on maintaining functionality while improving code organization. The main additions are unit tests for the AddonBundle functionality, which previously lacked test coverage.
Testing strategy:
Known issues with pull request:
None
Code Review Checklist:
@coderabbitai summary