-
Notifications
You must be signed in to change notification settings - Fork 1
Use tomlkit to dump updated dependencies #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #212 +/- ##
==========================================
- Coverage 85.37% 85.36% -0.02%
==========================================
Files 12 12
Lines 937 943 +6
==========================================
+ Hits 800 805 +5
- Misses 137 138 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
We only write to the pyproject.toml file once, and only if there were no errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this update! Seems like there is a problem with the Windows builds, though.
Partly out of scope-question regarding validation: Does the code check if there are multiple occurrences of a dependency where there should not be? Or will such user error be caught somewhere else?
for more information, see https://pre-commit.ci
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.