Skip to content
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

Version warning #327

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

clausmichele
Copy link
Member

Trying to solve this issue: #296

Copy link
Member

@soxofaan soxofaan left a comment

Choose a reason for hiding this comment

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

cool, thanks for starting this PR

def check_if_latest_version():
try:
package = 'openeo'
response = requests.get(f'https://pypi.org/pypi/{package}/json')
Copy link
Member

Choose a reason for hiding this comment

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

I think we should put a timeout here of just a couple of seconds so that users are not blocked to do import openeo when pypi is slow

Copy link
Member

Choose a reason for hiding this comment

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

I also think we should do this check like once a day, or cache the pypi.org response

Copy link
Member

Choose a reason for hiding this comment

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

for example, the pip implementation is roughly contained here: https://github.com/pypa/pip/blob/main/src/pip/_internal/self_outdated_check.py
apparently the check frequency is once a week there

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added the timeout. The pip implementation using the cache would require some more time to be ported over.

openeo/__init__.py Outdated Show resolved Hide resolved
@soxofaan
Copy link
Member

soxofaan commented Mar 3, 2023

quick note: with #176 the conda package is now also distributed through conda, which makes this "version warning" feature a bit more complex: you don't want to push users to pip install if the package was originally installed with conda. I'm not sure if it is possible to properly detect the installation context and emit the correct warning

@soxofaan soxofaan marked this pull request as draft August 21, 2024 10:03
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.

2 participants