python-poetry / tomlkit

Style-preserving TOML library for Python
MIT License
699 stars 100 forks source link

I am switching to `rtoml` #293

Closed caniko closed 1 year ago

caniko commented 1 year ago

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.

frostming commented 1 year ago

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.

caniko commented 1 year ago

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

There is a PR, it should be supported soon.

frostming commented 1 year ago

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.

caniko commented 1 year ago

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.