feat: migrate from tomlkit to tomlrt#10877
Open
dimbleby wants to merge 1 commit intopython-poetry:mainfrom
Open
feat: migrate from tomlkit to tomlrt#10877dimbleby wants to merge 1 commit intopython-poetry:mainfrom
dimbleby wants to merge 1 commit intopython-poetry:mainfrom
Conversation
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In tests/helpers.py, the new toml_dumps_dict helper calls tomlrt.Document at runtime but tomlrt is only imported in TYPE_CHECKING, so you should add a real import of tomlrt at the top of the file to avoid NameError.
- Several tests now instantiate tomlrt.Document directly (e.g. tests/utils/env/test_env_manager.py, tests/console/commands/env/test_list.py, tests/console/commands/env/test_use.py), but still import tomlkit; update these modules to import tomlrt instead so the new Document calls resolve correctly.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In tests/helpers.py, the new toml_dumps_dict helper calls tomlrt.Document at runtime but tomlrt is only imported in TYPE_CHECKING, so you should add a real import of tomlrt at the top of the file to avoid NameError.
- Several tests now instantiate tomlrt.Document directly (e.g. tests/utils/env/test_env_manager.py, tests/console/commands/env/test_list.py, tests/console/commands/env/test_use.py), but still import tomlkit; update these modules to import tomlrt instead so the new Document calls resolve correctly.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
08399c6 to
edbe5e7
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have always found tomlkit a bit disagreeable to work with:
So I got to wondering how hard it could be in the AI age to (have the bots) come up with something that I liked better.
The result is tomlrt, and this pull request shows what it would look like to move poetry to using it.
The good news is:
nl()andis_super_tableand suchlikepoetry versionthrows errorKey "source" already exists.when sources are not in order in toml-file #10144, for what its worthPer the diff, tomlrt prefers to format inline tables with spaces around the curly braces. AFAIK tomlkit is the odd one out among toml tooling in not doing this, but there would be a one-time round of noise in lock files.
For all of the faults of tomlkit: at this point poetry has mostly flushed out most of the bugs that users care about - and that is a pretty good argument for not changing anything. So even I am far from 100% convinced that this pull request is a good idea.
But I figured I should show it to you and let you consider it for yourselves.