Skip to content

chore: Replace toml with tomllib + tomli-w#190

Open
Amund211 wants to merge 1 commit into
mainfrom
chore/replace-toml-with-tomllib
Open

chore: Replace toml with tomllib + tomli-w#190
Amund211 wants to merge 1 commit into
mainfrom
chore/replace-toml-with-tomllib

Conversation

@Amund211

Copy link
Copy Markdown
Owner

Summary

  • The uiri/toml package has had no PyPI release since November 2020 and predates the TOML 1.0 specification.
  • Switch reads to the stdlib tomllib (available since 3.11; we require 3.14) and writes to tomli-w. This matches the pattern used by pip, setuptools, build, and hatch.
  • Drop types-toml from dev deps (no longer needed; tomllib is in typeshed, tomli-w ships its own stubs).

Behavioural note: None handling

tomli-w strictly follows the TOML 1.0 spec, which has no null type. The previous uiri/toml implementation silently omitted None values. To preserve the existing read paths (which already fall back to defaults for missing keys, e.g. SpecialKeyDict.vk, the optional API keys, logfile_cache.last_used), a small recursive _drop_none helper is applied at the write boundary. No behaviour change is intended.

Test plan

  • uv run pytest — 1340 passed, 2 skipped
  • uv run coverage run && uv run coverage report — 100%
  • uv run mypy, black, isort, flake8 (all via pre-commit) — all pass
  • Manual: launch the overlay, verify settings file is read and written correctly (especially with a vk: None special-key keybind set)

🤖 Generated with Claude Code

The uiri/toml package has had no release since 2020 and predates the
TOML 1.0 spec. Switch reads to the stdlib tomllib (available since
3.11; we require 3.14) and writes to tomli-w. This matches the pattern
used by pip, setuptools, build, and hatch.

Add a small recursive _drop_none helper at the write boundary in
settings.py: TOML has no null type, but the previous uiri/toml
implementation silently omitted None values. Preserve that behaviour
so the existing read paths (which fall back to defaults for missing
keys) keep working. Apply the same shape in write_logfile_cache.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 14, 2026 15:12

Copilot AI left a comment

Copy link
Copy Markdown

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 replaces the legacy toml dependency with stdlib tomllib for reads and tomli-w for writes across settings and logfile cache persistence.

Changes:

  • Swaps runtime dependency from toml to tomli-w and removes types-toml.
  • Updates settings and logfile cache TOML read/write paths.
  • Preserves prior None handling by omitting unsupported TOML null values before writing.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pyproject.toml Updates TOML-related dependencies.
uv.lock Reflects dependency lock changes for tomli-w and removal of toml/types-toml.
src/prism/overlay/settings.py Migrates settings read/write logic to tomllib/tomli-w and drops None values before serialization.
src/prism/overlay/user_interaction/logfile_utils.py Migrates logfile cache TOML parsing and writing to the new libraries.
tests/prism/overlay/user_interaction/test_logfile_utils.py Updates logfile cache tests to use tomllib/tomli-w.

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