-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dotted keys with multiline strings #279
base: master
Are you sure you want to change the base?
Conversation
Thanks for the patch as I also suffered this problem. |
I think this library is no longer properly maintained (although I know it's very widely used). you might try rtoml which should fix this problem and many more (admission: I built rtoml). |
That sounds great, wanna try this soon! |
https://github.com/samuelcolvin/rtoml/tree/master/benchmarks Perhaps poetry likes life in the slow lane :-) |
@samuelcolvin does |
I don't think so, it'll be the same as toml-rs which it's based on. |
In that case your comparison is not fair, and you should probably remove it from the table. That feature is very important for poetry, and tools in general (that need to alter config files without modifying the formatting of the file). They're designed and optimized for different use case. |
I've just tried and rtoml definitely doesn't provide roundtrip guarantees. I don't know if that's a problem in the python or a characteristic of toml-rs (you would have though it would be necessary to load and write to I see the distinction, though for many applications it's not a problem. Happy to accept a PR to add a clarification to benchmarks. By the way, I think (if I remember correctly) tomlkit also fails some of the standard toml tests. I can give details if necessary. |
https://toml.io/en/ uiri/toml#267 uiri/toml#279 (comment) While the TOML spec is alive and well, the `toml` package that was used in this project is dead (uiri/toml#267). There are several alternatives. `rtoml` is the fastest, but does not provide "round trip" guarantees (meaning that it can't load, then dump, and get an identical result). However, for simple loading and parsing it's fine. `tomli` is another alternative, but it is read-only (writing requires a separate `tomli-w` package), and requires files to be opened in binary mode to parse TOML. `tomlkit` is used by Poetry (from the Poetry author), but is currently 70x slower than `rtoml`. It's also important to note that the TOML parsing and settings loading is somewhat tangential to the focus of the inboard project. A separate project, https://github.com/br3ndonland/fastenv, is more focused on settings management, and may feature TOML support in the future. This commit will remove `toml` from the `fastapi` Poetry extras group. Note that `toml` is still a sub-dependency of some `dev-dependencies`, including pre-commit and pytest.
I've added a test for this: toml-lang/toml-test#57
fix #265
The problem is that when you call
currentlevel[pair[0]] = value
on line 786, you've re-assigned currentlevel thus isn't not the same as where you were callingcurrentlevel[multikey] = value
on line 395, this get's around that problem by returning a newmultilevel
object.