0

I am working in a project where we've pinned all our depdencies. Eg:

pandas == 1.4.3
streamlit == 1.11.1
pendulum == 2.1.2
pyodbc == 4.0.34
...

It'd be good to write a function that will quickly check what is the latest version of each package in PyPi.

Eg:

def check_for_out_of_date_dependencies(pyproject_toml_filepath):
   ...

check_for_out_of_date_dependenceies()
>>> "You have pandas '1.4.3' but '1.4.4' is available"
>>> ...

Any ideas on how to do this?

MYK
  • 1,988
  • 7
  • 30
  • 1
    Do you mean you want the latest version? so why not use `pandas >= 1.4.3`? – Guy Sep 12 '22 at 09:45
  • 2
    use this api [pypi json api](https://warehouse.pypa.io/api-reference/json.html) – sahasrara62 Sep 12 '22 at 09:47
  • I am getting this error using the pypi json API: ConnectionError: HTTPConnectionPool(host='pypi', port=80): Max retries exceeded with url: /pandas/json (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed')) – MYK Sep 12 '22 at 10:32
  • https://stackoverflow.com/a/27239645/7976758 Found in https://stackoverflow.com/search?q=%5Bpypi%5D+latest+version – phd Sep 12 '22 at 10:37
  • The URL is https://pypi.org/pypi/pandas/json : HTTPS (port 443), path `/pypi/pandas/json` – phd Sep 12 '22 at 10:37
  • Fixed it. `requests.get('https://pypi.org/pypi/pandas/json')` works. – MYK Sep 12 '22 at 10:39
  • 1
    Also there is [_`python -m pip list --outdated`_](https://pip.pypa.io/en/stable/cli/pip_list/#cmdoption-o). – sinoroc Sep 12 '22 at 14:29

0 Answers0