allow to disable checking for the latest package version via env (#4407)

This commit is contained in:
benedikt-bartscher 2024-11-21 20:06:47 +01:00 committed by GitHub
parent 095c1e5b7f
commit ecb52651c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View File

@ -547,6 +547,9 @@ class EnvironmentVariables:
# Where to save screenshots when tests fail.
SCREENSHOT_DIR: EnvVar[Optional[Path]] = env_var(None)
# Whether to check for outdated package versions.
REFLEX_CHECK_LATEST_VERSION: EnvVar[bool] = env_var(True)
environment = EnvironmentVariables()

View File

@ -93,6 +93,8 @@ def check_latest_package_version(package_name: str):
Args:
package_name: The name of the package.
"""
if environment.REFLEX_CHECK_LATEST_VERSION.get() is False:
return
try:
# Get the latest version from PyPI
current_version = importlib.metadata.version(package_name)