feat: warn when a newer version is available#795
Conversation
|
☂️ Python Coverage
Overall Coverage
New Files
Modified Files
|
marcosnav
left a comment
There was a problem hiding this comment.
This is a great addition. I have some usability feedback, I forced the output from _fetch_latest_version and while trying this out I noticed that the new version warning message only triggers on successful deployments.
For example, a project with missing requirements.txt shows this (no warning about a new version):

It seems that any error that goes through the exception handler (which covers RSConnectException and general Exception) calls sys.exit(1) and the warning never prints.
So in practice, you'd only see the version warning after a successful deploy (or possibly a very late failure like a task timeout on the server side).
That seems like a significant gap, users that most likely could benefit from "hey, upgrade" are the ones hitting bugs that were already fixed.
Also, how complicated is to have this warning for all commands info, version, list...?
|
@marcosnav huh good catch I thought I fixed that. My guess is maybe on fast failures the error beats the fetch command and so we don't get the warning. |
|
@marcosnav okay I figured out the issue and it stems from an issue that we have to resolve in what our approach is here. There are 3 things we want with this feature:
The issue is that 2 and 3 are actually at odds with each other because if there is no cache (i.e first time running it in over 24h) then the check must be blocking in order to fire before the command finishes (in the case of a fast failure i.e missing requirements.txt) Maybe the best we can do here to satisfy all criteria is to make the check blocking but only when the cache is empty. Otherwise there's just no way around avoiding the case that you caught above. |
@joshyam-k Just to confirm, by blocking you mean a synchronous wait on the version check right? If that is the case I think it is ok to wait. Maybe just to avoid hanging issues, we could have a timeout of about 3s to the PyPI check and discard the check if it takes longer than that so the command continues. WDYT? |
|
@marcosnav yes correct. And if we go that route I'm even more inclined to keep this scoped to just deploy commands. We don't want multi second latency on things like |
|
@joshyam-k Yes, that sounds right. BTW, there is already a |
Print a warning message to stderr when a newer version of the cli is available.
Intent
Fixes #779
Type of Change
Approach
RSCONNECT_DISABLE_VERSION_CHECKAutomated Tests
Unit tests for each new helper in isolation and also a
TestCLIIntegrationtest that tests the feature end-to-end through the cli.Checklist
rsconnect-python-tests-at-nightworkflow in Connect against this feature branch.