Skip to content

feat(download_lt): added a new way to handle LT downloads#155

Merged
mdevolde merged 1 commit intojxmorris12:masterfrom
mdevolde:download
Mar 7, 2026
Merged

feat(download_lt): added a new way to handle LT downloads#155
mdevolde merged 1 commit intojxmorris12:masterfrom
mdevolde:download

Conversation

@mdevolde
Copy link
Collaborator

@mdevolde mdevolde commented Mar 6, 2026

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

  • New AbstractClass LocalLanguageTool that expose an common interface for subclasses who implements some type of LT download.
  • New ReleaseLocalLanguageTool class (implementation of LocalLanguageTool) that implements the downloading of LT from release page
  • New SnapshotLocalLanguageTool class (implementation of LocalLanguagetool) that implements the downloading of LT from snapshot page
  • Added the possibility to download LT since version 4.0
  • Fixed the necessary java version for old LT releases (from 1.8 to 1.9)
  • Deprecated some funcs:
    • language_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_info
  • language_tool_python.server._get_valid_spelling_file_path from classmethod to instance method
  • Addapted tests for new classes and other changes
  • Adapted readme

Screenshots (if appropriate):

Not applicable.

How has this been tested?

Applied local tests.

Resources

Not applicable.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (changes to documentation only)
  • Refactor / code style update (non-breaking change that improves code structure or readability)
  • Tests / CI improvement (adding or updating tests or CI configuration only)
  • Other (please describe):

Checklist

  • Followed the project's contributing guidelines.
  • Updated any relevant tests.
  • Updated any relevant documentation.
  • Added comments to your code where necessary.
  • Formatted your code, run the linters, checked types and tests.

Copy link
Contributor

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 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 LocalLanguageTool ABC with ReleaseLocalLanguageTool and SnapshotLocalLanguageTool subclasses replacing the old imperative download functions in download_lt.py
  • Deprecation of legacy download/utility functions in download_lt.py and utils.py, with server.py updated 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.

Copy link
Contributor

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

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.

Copy link
Contributor

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

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.

@mdevolde mdevolde marked this pull request as ready for review March 7, 2026 14:00
@mdevolde mdevolde merged commit 3a3b2aa into jxmorris12:master Mar 7, 2026
8 checks passed
@mdevolde mdevolde deleted the download branch March 7, 2026 14:02
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