chore: Replace toml with tomllib + tomli-w#190
Open
Amund211 wants to merge 1 commit into
Open
Conversation
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>
There was a problem hiding this comment.
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
tomltotomli-wand removestypes-toml. - Updates settings and logfile cache TOML read/write paths.
- Preserves prior
Nonehandling 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. |
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.
Summary
uiri/tomlpackage has had no PyPI release since November 2020 and predates the TOML 1.0 specification.tomllib(available since 3.11; we require 3.14) and writes totomli-w. This matches the pattern used by pip, setuptools, build, and hatch.types-tomlfrom dev deps (no longer needed;tomllibis in typeshed,tomli-wships its own stubs).Behavioural note: None handling
tomli-wstrictly follows the TOML 1.0 spec, which has no null type. The previousuiri/tomlimplementation silently omittedNonevalues. 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_nonehelper is applied at the write boundary. No behaviour change is intended.Test plan
uv run pytest— 1340 passed, 2 skippeduv run coverage run && uv run coverage report— 100%uv run mypy, black, isort, flake8 (all via pre-commit) — all passvk: Nonespecial-key keybind set)🤖 Generated with Claude Code