feat: improve operation messages and make them stateful #9245
+210
−118
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.
Pull Request Check List
This PR proposes more meaningful messages on installation operations:
poetry/src/poetry/installation/installer.py
Lines 350 to 354 in fe9f85b
one could easily observe that the "Writing lock file" message is written if
updated_lock
is truthy—and can only be after actually completing writing the lock file:poetry/src/poetry/packages/locker.py
Lines 251 to 259 in fe9f85b
poetry/src/poetry/packages/locker.py
Lines 309 to 313 in fe9f85b
Where
TOMLFile.write()
atomically writes to the file.Operation
objects were partially stateful (e.g. held theskipped
attribute) and now are fully stateful (store the information about whether they are in thedone
,warning
orerror
state). Different attribute names ideas are welcome.Executor.get_operation_message()
was deprecated and polymorphism was utilized in lieu of it. The new implementation was made to be 100% equivalent except that after the relevant operations finish, their messages use past tense in ANSI supporting cases–instead of freezing at "Downgrading" ifUpdate(...).done
isTrue
, "Downgraded" is written eventually, etc.Before this can eventually be merged, we need a new GIF in the Poetry readme. @neersighted could you help with that?