Skip to content

use tomlrt - #102

Merged
pappasam merged 3 commits into
pappasam:mainfrom
dimbleby:tomlrt
Sep 12, 2026
Merged

pappasam merged 3 commits into
pappasam:mainfrom
dimbleby:tomlrt

Conversation

@dimbleby

Copy link
Copy Markdown
Contributor

Hi -

I'm not sure if this is something you should want or not; but I've done it and I think it's interesting enough to show to you anyway.

I've been writing tomlrt, a library occupying roughly the same space as tomlkit. But - hopefully - faster, less buggy, with a cleaner API.

I've been using toml-sort as a testing ground for tomlrt: you are doing some reasonable but complicated stuff, getting tomlrt to support it has improved my library regardless of where this pull request goes.

Anyway the upshot of that is that toml-sort can now be implemented relatively cleanly via tomlrt APIs - no grubbing around in tomlkit internals and figuring out for yourself how to get hold of comments etc.

Per the diffs in the tests, the main visible changes are

  • tomlrt likes to put spaces inside the curly braces for an inline table
    • my understanding is that this is the common convention and that it is tomlkit that is a bit unusual in not doing that
    • maybe that would be a "breaking" change for toml-sort and already enough reason not to switch, so be it
  • fixes some bugs re preserving orphaned comments
  • adds a blank line before some comments, I think this is a clear improvement

I'm pretty sure that we also fix a small pile of open issues, probably #55, #59, #67, #69, #94, #101

By all means close this out: if it's of no interest, if toml-sort is basically done, if tomlkit is good enough, or really for any reason at all.

@dimbleby
dimbleby force-pushed the tomlrt branch 2 times, most recently from 6e2dbe7 to 3bd9eca Compare July 21, 2026 22:12
@dimbleby

Copy link
Copy Markdown
Contributor Author

fixes some bugs re preserving orphaned comments

I had assumed yesterday that dropping orphaned comments was accidental, but perhaps it is not. In case it is deliberate: tomlrt can do that too.

@dimbleby
dimbleby force-pushed the tomlrt branch 2 times, most recently from 68b37c9 to 4a71467 Compare July 24, 2026 15:07
@pappasam

Copy link
Copy Markdown
Owner

Sorry for the late reply, I'm open to merge this soon! Can you update the CHANGELOG with any behavior changes you're aware of (if any)?

@dimbleby

Copy link
Copy Markdown
Contributor Author

Can you update the CHANGELOG with any behavior changes you're aware of (if any)?

I added a mention of the spaces around curly braces - as visible in the changes to fixtures in this PR, and mentioned above. Also did a poetry update tomlrt while I am here.

Mention spaces around curly braces.

Also `poetry update tomlrt`.
@pappasam
pappasam merged commit 14e7d89 into pappasam:main Sep 12, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants