Use tomlkit to dump updated dependencies #212
Open
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.
Closes #203
Add a new utility function to update the parsed
pyproject.toml
file in-memory document, which will eventually be dumped (usingtomlkit
) and written to (overwriting) thepyproject.toml
file.This let's
tomlkit
handle the serialization (converting the parsed file back to TOML-syntax) and should be more stable than the current implementation using regular expressions.As a side note, this now only writes to/updates the
pyproject.toml
file once - at the end of going through all dependencies if no errors occurred.This is an (improved) change from the existing behaviour, which writes to/updates the
pyproject.toml
file for each dependency (if necessary) and does not revert changes if an error occurs. The improvement I see here, is that thepyproject.toml
file now is only changed if there were no errors, plus the disk is touched only once for writing.