-
Notifications
You must be signed in to change notification settings - Fork 2
feat(medcat): CU-869ary4dq Add PyPI callback #166
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
Conversation
Task linked: CU-869ary4dq Add callback to PyPI for version checks |
DEFAULT_VERSION_INFO_LEVEL, DEFAULT_VERSION_INFO_YANKED_LEVEL) | ||
|
||
|
||
DEFAULT_CACHE_PATH = Path.home() / ".cache" / "medcat_version.json" |
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.
Personally - I'd rather make a medcat (cogstack?) folder in .cache, just the folder has so much use
AVOID_LEGACY_CONVERSION_ENVIRON = "MEDCAT_AVOID_LECACY_CONVERSION" | ||
|
||
# version check | ||
MEDCAT_DISABLE_VERSION_CHECK_ENVIRON = "MEDCAT_DISABLE_VERSION_CHECK" |
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.
Can you add this to the docs as well?
The whole .md table in this PR would be great to add there.
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've added it to the README.
However, there's a separate docs/main.md
that seems to be (again) limping behind the README, but (mostly) mirrors it.
I think we should find a way to have it just automatically mirror the README.
AVOID_LEGACY_CONVERSION_ENVIRON = "MEDCAT_AVOID_LECACY_CONVERSION" | ||
|
||
# version check | ||
MEDCAT_DISABLE_VERSION_CHECK_ENVIRON = "MEDCAT_DISABLE_VERSION_CHECK" |
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.
This is pretty pedantic - but can you enforce true/false here instead? Just feels like it will save the question "I set it to False but it is somehow disabled"
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.
Yeah I'd make it the same as AVOID_LEGACY_CONVERSION_ENVIRON
just above
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.
lgtm, thanks!
* CU-869ary4dq: Add code to check for updates * CU-869ary4dq: Add option to change log level with environmental variables * CU-869ary4dq: Use option to change log level with environmental variables * CU-869ary4dq: Remove debug print output * CU-869ary4dq: Add separate log level for YANKED releases * CU-869ary4dq: Add tests for update checker * CU-869ary4dq: Move cache to subfolder * CU-869ary4dq: Check the value of version check enabling environmental value * CU-869ary4dq: Unify environmental value getting * CU-869ary4dq: Add section regarding version and update checks to README
This PR adds a PyPI callback to MedCAT.
The idea is that if there's sufficiently many (3) newer minor or patch releases, the user is notified.
And if the users is using a yanked verison, they are notified at a higher log level.
There's a number of environmental variables that govern the above so sys admins can decide whether / what users get notified for:
MEDCAT_DISABLE_VERSION_CHECK
true
,yes
ordisable
, disables the version update check entirely. Useful for CI environments, offline setups, or deployments where external network access is restricted.MEDCAT_PYPI_URL
https://pypi.org/pypi
/pypi/{pkg}/json
API.MEDCAT_MINOR_UPDATE_THRESHOLD
3
1.4.x
,1.5.x
) that must exist before MedCAT emits a “newer version available” log message.MEDCAT_PATCH_UPDATE_THRESHOLD
3
1.3.1
,1.3.2
,1.3.3
) on the same minor line required before emitting an informational update message.MEDCAT_VERSION_UPDATE_LOG_LEVEL
INFO
logging
level string (DEBUG
,INFO
,WARNING
,ERROR
,CRITICAL
).MEDCAT_VERSION_UPDATE_YANKED_LOG_LEVEL
WARNING
A few additional Notes
~/.cache/medcat_version.json
."yanked": true
flag).logging
framework — users can silence or redirect them as desired.