python-poetry/tomlkit

I am switching to `rtoml`

caniko opened this issue · 4 comments

I switched to rtoml last month, it is both faster and supports pathlib.Path parsing from .toml.

Sharing my experience here for those that might follow my path in the future.

Not sure what you mean by "support":

import rtoml
from pathlib import Path

a = {"path": Path("abc")}
rtoml.dumps(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/fming/wkspace/github/test-pdm/.venv/lib/python3.11/site-packages/rtoml/__init__.py", line 49, in dumps
    return serialize(obj)
           ^^^^^^^^^^^^^^
_rtoml.TomlSerializationError: PosixPath('abc') (PosixPath) is not serializable to TOML

IIUC this is what you were trying to address in #280
Also it doesn't preserve styles which is the most important feature of tomlkit.

I get it is an important feature for you, but it isn't for me.

There is a PR, it should be supported soon.

Yes but it's the only reason to use tomlkit, if you don't need it you just use other toml libs. Even I myself would do it like this. But don't throw complaints on the maintainers about how you think it's useless.

Not really complaining, just sharing my experience in case somebody else has the same issue.

tomlkit fills an important niche for those that want to be strict without ambiguity. It is just not for me.