feat(download_lt): added a new way to handle LT downloads#155
feat(download_lt): added a new way to handle LT downloads#155mdevolde merged 1 commit intojxmorris12:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the LanguageTool download management by introducing an OOP approach with a new LocalLanguageTool abstract base class and two concrete implementations (ReleaseLocalLanguageTool for versioned releases and SnapshotLocalLanguageTool for date-based/nightly snapshots). It also adds support for downloading older LT versions (4.0+), updates Java version requirements, and deprecates several legacy functions.
Changes:
- New
LocalLanguageToolABC withReleaseLocalLanguageToolandSnapshotLocalLanguageToolsubclasses replacing the old imperative download functions indownload_lt.py - Deprecation of legacy download/utility functions in
download_lt.pyandutils.py, withserver.pyupdated to use the new class hierarchy - Updated tests, README documentation, and support for older (4.0+) LT release versions via an archive URL
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
language_tool_python/download_lt.py |
Core refactor: new LocalLanguageTool ABC with subclasses; old functions deprecated |
language_tool_python/server.py |
Uses new LocalLanguageTool for download/server-start; _get_valid_spelling_file_path converted to instance method |
language_tool_python/utils.py |
Legacy functions deprecated; removed unused JAR name entries |
tests/test_download.py |
New tests for old/snapshot versions; updated HTTP error tests to use new API |
tests/test_server_local.py |
Updated to use LT_SNAPSHOT_CURRENT_VERSION and get_language_tool_download_path |
README.md |
Updated download URL docs; new minimum version (4.0) and Java prerequisite info |
coverage-badge.svg |
Coverage dropped from 77.75% to 71.89% |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
feat(download_lt): added a new way to handle LT downloads
Why the pull request was made
To improve the way to manage the LT versions that are availble on a device.
The code is easier to understand, easier to maintain and easier to use as implementations of an AbstractClass than as some funcs.
Summary of changes
LocalLanguageToolthat expose an common interface for subclasses who implements some type of LT download.ReleaseLocalLanguageToolclass (implementation ofLocalLanguageTool) that implements the downloading of LT from release pageSnapshotLocalLanguageToolclass (implementation ofLocalLanguagetool) that implements the downloading of LT from snapshot pagelanguage_tool_python.download_lt.get_common_prefix,language_tool_python.download_lt.http_get,language_tool_python.download_lt.unzip_file,language_tool_python.download_lt.download_zip,language_tool_python.download_lt.download_lt,language_tool_python.utils.find_existing_language_tool_downloads,language_tool_python.utils._extract_version,language_tool_python.utils.get_language_tool_directory,language_tool_python.utils.get_server_cmd,language_tool_python.utils.get_jar_infolanguage_tool_python.server._get_valid_spelling_file_pathfromclassmethodto instance methodScreenshots (if appropriate):
Not applicable.
How has this been tested?
Applied local tests.
Resources
Not applicable.
Types of changes
Checklist