-
-
Notifications
You must be signed in to change notification settings - Fork 111
Closed
Description
Hello,
After updating tomlkit to version 0.12.5, TOMLFile.write does not update the toml file correctly anymore. See the following reproductible example:
pyproject.toml file:
[tool.poetry]
name = "my-package"
version = "2.0"
description = ""
authors = ["Stefan"]
[tool.poetry.dependencies]
python = "^3.8.1"
click = "8.1.7"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.plugins."custom.plugins"]
"my_plugin" = "my_package.my_plugin:MyCustomPlugin"
script:
from tomlkit.toml_file import TOMLFile
pyproject_file = TOMLFile("pyproject.toml")
pyproject = pyproject_file.read()
pyproject["tool"]["poetry"]["repository"] = "https://my-repository.example.com"
pyproject_file.write(pyproject)
pyproject.toml result after running the script with tomlkit 0.12.4 (you can see that the repository property was added where it should be):
[tool.poetry]
name = "my-package"
version = "2.0"
description = ""
authors = ["Stefan"]
repository = "https://my-repository.example.com"
[tool.poetry.dependencies]
python = "^3.8.1"
click = "8.1.7"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.plugins."custom.plugins"]
"my_plugin" = "my_package.my_plugin:MyCustomPlugin"
pyproject.toml result after running the script with tomlkit 0.12.5 (the repository property is added under dependencies):
[tool.poetry]
name = "my-package"
version = "2.0"
description = ""
authors = ["Stefan"]
[tool.poetry.dependencies]
python = "^3.8.1"
click = "8.1.7"
repository = "https://my-repository.example.com"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.plugins."custom.plugins"]
"my_plugin" = "my_package.my_plugin:MyCustomPlugin"
This behavior results in an invalid toml file, looks like a regression in the latest release.
Thanks in advance.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels