MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / execute_pip_get_local_package_version

Function execute_pip_get_local_package_version

PySimpleGUI/PySimpleGUI.py:24641–24664  ·  view source on GitHub ↗

Retturns the version number of a given package that has been pip installed. If a window is provided, then the function will run threaded due to a possible long delay. When the thead completes, they key provided in the paramters will be returned as an event and the value will be the vers

(package, interpreter=None, window=None, key=None)

Source from the content-addressed store, hash-verified

24639 return 'error'
24640
24641def execute_pip_get_local_package_version(package, interpreter=None, window=None, key=None):
24642 """
24643 Retturns the version number of a given package that has been pip installed.
24644 If a window is provided, then the function will run threaded due to a possible long delay.
24645 When the thead completes, they key provided in the paramters will be returned as an event and the value will be the version
24646 :param package: The name of the package to get version of
24647 :type package: str
24648 :param interpreter: The interpreter to use to check. If none specified, then the currently running interpreter is used
24649 :type interpreter: str
24650 :param window: Optional Window. If provided, the operation is run as a thread and the results passed to the window as an event
24651 :type window: (Window)
24652 :param key: key that will be sent to Window when operation completes
24653 :type key: str | int | tuple | object
24654 :return: String with the version number or None is package wasn't found or if a window is provided (the return value wiil lbe sent to window)
24655 :rtype: (str | None)
24656 """
24657 if interpreter is None:
24658 interpreter = sys.executable
24659 if window:
24660 thread = threading.Thread(target=__get_ver_thread, args=(interpreter, package, window, key), daemon=True)
24661 thread.start()
24662 return None
24663 else:
24664 return __get_ver_thread(interpreter, package, window, key)
24665
24666
24667

Callers

nothing calls this directly

Calls 2

__get_ver_threadFunction · 0.85
startMethod · 0.80

Tested by

no test coverage detected