Skip to content

chore(deps): replace toml by tomli for py<3.11 as a fallback for "tomllib"#179

Merged
mdevolde merged 1 commit into
jxmorris12:masterfrom
mdevolde:chore/toml
Jun 10, 2026
Merged

chore(deps): replace toml by tomli for py<3.11 as a fallback for "tomllib"#179
mdevolde merged 1 commit into
jxmorris12:masterfrom
mdevolde:chore/toml

Conversation

@mdevolde

Copy link
Copy Markdown
Collaborator

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 tomllib exists. And replace toml fallback by a maintained lib tomli.

Summary of changes

  • Replace toml dependency by tomli (only for py<3.11).
  • Rename _deprecated.py as _compat.py.
  • Add the tomllib/tomli import 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

  • 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): chore(deps) update

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 toml with tomli only for Python <3.11 (using tomllib otherwise).
  • Renamed/internalized compatibility helpers by replacing _deprecated.py with _compat.py (now also exposing toml_loads).
  • Updated internal imports and call sites to use _compat.deprecated and _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.

Comment thread language_tool_python/_compat.py
@mdevolde mdevolde merged commit 5a3960f into jxmorris12:master Jun 10, 2026
10 checks passed
@mdevolde mdevolde deleted the chore/toml branch June 10, 2026 13:12
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