Skip to content

Warning if newer reflex/reflex-hosting-cli available #2271

Merged
Alek99 merged 6 commits intomainfrom
alek/upgrade
Dec 9, 2023
Merged

Warning if newer reflex/reflex-hosting-cli available #2271
Alek99 merged 6 commits intomainfrom
alek/upgrade

Conversation

@Alek99
Copy link
Copy Markdown
Member

@Alek99 Alek99 commented Dec 7, 2023

Add check_latest_package_version when given a package this checks if there is a newer python package and throws a warning to upgrades. Used in run and init to check for reflex and reflex-hosting-cli in deploy

Screenshot 2023-12-06 at 5 53 13 PM

@Alek99 Alek99 marked this pull request as ready for review December 7, 2023 01:54
@Alek99 Alek99 requested review from masenf and picklelo December 7, 2023 01:54
@Alek99
Copy link
Copy Markdown
Member Author

Alek99 commented Dec 7, 2023

Old screen shot looks like

'Warning: Your version (0.3.4) of reflex is out of date. Upgrade to 0.3.6 with 'pip install reflex --upgrade''

@Alek99 Alek99 changed the title Throw warning if reflex or reflex-hosting-cli is old Warning if reflex or reflex-hosting-cli is old Dec 7, 2023
@Alek99 Alek99 changed the title Warning if reflex or reflex-hosting-cli is old Warning if newer reflex/reflex-hosting-cli available Dec 7, 2023
Comment thread reflex/reflex.py Outdated
Comment thread reflex/utils/prerequisites.py Outdated
picklelo
picklelo previously approved these changes Dec 7, 2023
Copy link
Copy Markdown
Contributor

@picklelo picklelo left a comment

Choose a reason for hiding this comment

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

nice

Comment thread reflex/utils/prerequisites.py Outdated
data = response.json()

latest_version = data["info"]["version"]
current_version = version.parse(constants.Reflex.VERSION)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

does this mean we're always checking against the reflex version?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch will fix

@Alek99
Copy link
Copy Markdown
Member Author

Alek99 commented Dec 8, 2023

Ended up not needed to subprocess the check is basically instant and starting a thread didn't seem to produce a noticeable difference

@Alek99 Alek99 requested a review from martinxu9 December 8, 2023 17:46
Copy link
Copy Markdown
Contributor

@picklelo picklelo left a comment

Choose a reason for hiding this comment

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

works well for me

f"Your version ({current_version}) of {package_name} is out of date. Upgrade to {latest_version} with 'pip install {package_name} --upgrade'"
)
except Exception:
pass
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: there's a contextlib.suppress if the intent here is we do not care about any exceptions.

@Alek99 Alek99 merged commit 421be57 into main Dec 9, 2023
@picklelo picklelo deleted the alek/upgrade branch January 30, 2024 03:10
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