Skip to content

Conversation

@mihikap01
Copy link
Contributor

@mihikap01 mihikap01 commented Aug 7, 2025

Prints warning messages when the user tries to run an old version of codeflash.

closes https://linear.app/codeflash-ai/issue/CF-700/print-a-warning-if-the-current-codeflash-version-is-not-the-latest

@CLAassistant
Copy link

CLAassistant commented Aug 7, 2025

CLA assistant check
All committers have signed the CLA.

@@ -1,2 +1,6 @@
# These version placeholders will be replaced by uv-dynamic-versioning during build.
<<<<<<< HEAD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove this file from local version testing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mihikap01 we can remove this file from the scope of this PR.

return

# Get current version dynamically to handle runtime changes
from codeflash.version import __version__ as current_version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have this as global import.

args = parse_args()

# Check for newer version (skip for version command to avoid confusion)
if not args.version:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With version check 'codeflash --version' we can also show the status if its outdated.

# Check for newer version (skip for version command to avoid confusion)
if not args.version:
# Check if version check is disabled in config
disable_version_check = False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure we are going to add this in the configs or existing configs with customers.
We can just have a direct non blocking check.

return _version_cache["version"]

try:
response = requests.get("https://pypi.org/pypi/codeflash/json", timeout=10)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can have quick timeout here to make it non blocking if there is network issue.

@Saga4
Copy link
Contributor

Saga4 commented Aug 11, 2025

Tested here:

(cli) saga4@codeflashs-MacBook-Air cli % python -c "from codeflash.code_utils.version_check import check_for_newer_minor_version, get_latest_version_from_pypi
print('Current version:', '0.16.3')  # from version.py
latest = get_latest_version_from_pypi()
print('Latest version from PyPI:', latest)"

Current version: 0.16.3
Latest version from PyPI: 0.16.3

@Saga4 Saga4 closed this Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants