INNER CODE UNIT · Python
get_py_version
devstream-io/devstream · devstream/env_manager.py:44
def get_py_version(py: str) -> Optional[str]:
"""
Get the version of the python executable.
"""
py_version_cmd = [py, "--version"]
with subprocess.Popen(py_version_cmd, stdout=subprocess.PIPE, stderr=None) as proc:
proc.wait()
if proc.returncode != 0:
return None
out = proc.stdout.read().decode("utf-8")
return out.split()[1]
@staticmethod
def get_dep_hash(reqirements_file: str) -> str:
"""
Get the hash of the requirements file content.