step away from old unmaintained "toml" library#366
Conversation
|
Thanks for raising this. The GitHub actions for this repo are a bit messed up at the moment so I need to fix those before I can get round to merging this in |
|
Hi @a-detiste I finally got round to updating the tooling for this package, would you like to rebase and update your PR? |
| from functools import lru_cache | ||
| from typing import Any | ||
|
|
||
| import toml |
There was a problem hiding this comment.
You could also remove toml from the dependencies with uv remove toml
There was a problem hiding this comment.
I tried
git/maison$ uv remove toml
error: No `project` table found in: `/home/tchet/git/maison/pyproject.toml`
There was a problem hiding this comment.
That's strange, there's definitely one there. Have you pulled latest main branch?
There was a problem hiding this comment.
I forgot to git pull
|
There are a few failing CI checks, would you be ok to address them? |
I don't know how to fix this:
I find this new syntax distastefull but I can do it |
Actually can't see a way to fix that so feel free to amend this line to a 99 |
| try: | ||
| return dict(toml.load(self.filepath)) | ||
| except toml.decoder.TomlDecodeError as exc: | ||
| with Path.open(self.filepath, "rb") as fd: |
There was a problem hiding this comment.
I think the linter was suggesting self.filepath.open(mode="rb") as fd:
|
Ha that makes more sense.
Le jeu. 25 sept. 2025, 10:00, Dom Batten ***@***.***> a
écrit :
… ***@***.**** commented on this pull request.
------------------------------
In src/maison/config_sources/toml_source.py
<#366 (comment)>:
> @@ -31,8 +36,9 @@ def _load_file(self) -> dict[Any, Any]:
BadTomlError: If toml cannot be parsed
"""
try:
- return dict(toml.load(self.filepath))
- except toml.decoder.TomlDecodeError as exc:
+ with Path.open(self.filepath, "rb") as fd:
I think the linter was suggesting self.filepath.open(mode="rb") as fd:
—
Reply to this email directly, view it on GitHub
<#366 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB47WUDTJMHOVSIDDOIQBBL3UOOJJAVCNFSM6AAAAACFGTI2TGVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTENRWGMYTKNRZHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
everything should be fine now |
There was a problem hiding this comment.
these fixtures aren't being used now so you could remove them all and remove the tomli_w dependency
|
Thanks @a-detiste ! |
Hi,
This is a more general version of the Debian patch:
https://salsa.debian.org/python-team/packages/python-maison/-/blob/debian/master/debian/patches/0002-remove-toml.patch?ref_type=heads
We don't have
rtomlin Debian (yet?), but we have a lot of old things to remove.I'm not convinced by the performance argument of
rtomlfor reading tiny text files.https://wiki.debian.org/Python/Backports