avoid private tomlkit method#5943
Merged
neersighted merged 1 commit intopython-poetry:masterfrom Jul 13, 2022
Merged
Conversation
mkniewallner
approved these changes
Jul 2, 2022
Member
mkniewallner
left a comment
There was a problem hiding this comment.
Not familiar with tomlkit, but this definitely looks ok to me.
Only thing I can see, which I don't think is related to this change but more to how tomlkit works. Given this file:
[tool.poetry]
name = "aaa"
version = "0.1.0"
description = ""
authors = []
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.dependencies]
python = "^3.9"By running poetry add --group dev pytest, the file will be modified to:
[tool.poetry]
name = "aaa"
version = "0.1.0"
description = ""
authors = []
[tool.poetry.group.dev.dependencies]
pytest = "^7.1.2"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.dependencies]
python = "^3.9"So there seems to be a mishandling of the carriage return (but again, pretty sure it's not related to the change, just thought it would be worth mentioning).
Contributor
Author
|
@mkniewallner if you think the missing newline is interesting, please take it to the |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #4718
I don't know why the code was using the private method
_insert_after(), in only this one place. So far as I can see it's unnecessary; but tomlkit remains quite the mystery to me.Following the repro of #4718 (comment), we now successfully achieve a pyproject.toml structured as follows:
which has put the new entry in a sensible place anyway, so that's good.
Not sure how to write a test for this or that it's even worthwhile. This branch is covered in existing tests so not breaking them is a strong start, the new code is much more obvious than the old code was, I feel that a new testcase would be testing tomlkit more than it would be testing poetry.