chore(deps): replace toml by tomli for py<3.11 as a fallback for "tomllib"#179
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the project’s TOML parsing dependency strategy by using the stdlib tomllib on Python ≥3.11 and falling back to tomli on older Python versions, while also consolidating version-dependent imports into a new internal compatibility module.
Changes:
- Replaced the runtime dependency on
tomlwithtomlionly for Python <3.11 (usingtomllibotherwise). - Renamed/internalized compatibility helpers by replacing
_deprecated.pywith_compat.py(now also exposingtoml_loads). - Updated internal imports and call sites to use
_compat.deprecatedand_compat.toml_loads.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Swaps toml for tomli with a Python <3.11 marker and removes the toml package entry. |
pyproject.toml |
Updates project dependencies to use tomli only on Python <3.11. |
language_tool_python/_compat.py |
New centralized compat module exposing deprecated and toml_loads with version-based fallbacks. |
language_tool_python/_deprecated.py |
Removes the old dedicated deprecated helper module in favor of _compat.py. |
language_tool_python/download_lt.py |
Switches TOML parsing from toml.loads to _compat.toml_loads. |
language_tool_python/__main__.py |
Switches TOML parsing from toml.loads to _compat.toml_loads for version/config reads. |
language_tool_python/utils.py |
Updates deprecated import to come from _compat. |
language_tool_python/match.py |
Updates deprecated import to come from _compat. |
tests/test_deprecated.py |
Updates test import to reference _compat.deprecated. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or 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
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.
chore(deps): replace toml by tomli for py<3.11 as a fallback for "tomllib"
Why the pull request was made
To avoid having a dependency for toml on py<3.11 when
tomllibexists. And replacetomlfallback by a maintained libtomli.Summary of changes
tomldependency bytomli(only for py<3.11)._deprecated.pyas_compat.py.tomllib/tomliimport in_compat.py, to expose a common interface in the lib.Screenshots (if appropriate):
Not applicable.
How has this been tested?
Applied local tests.
Resources
Not applicable.
Types of changes
Checklist