From b053e0a8146f72c14ba0fcd2d467d70051367806 Mon Sep 17 00:00:00 2001 From: artste Date: Wed, 1 Oct 2025 23:36:13 +0200 Subject: [PATCH 1/2] add verbose logging for pip list and conda environment export --- bin/pythonrunscript | 10 ++++++++-- pythonrunscript/pythonrunscript.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/bin/pythonrunscript b/bin/pythonrunscript index ab6eb54..907a423 100755 --- a/bin/pythonrunscript +++ b/bin/pythonrunscript @@ -418,10 +418,13 @@ def install_pip_requirements(proj_dir, pip_requirements, interpreter, log_level: "pip_install.out","pip_install.err", log_level) if success: - with open(os.path.join(proj_dir,"piplist.txt"),"w") as f: + piplist_txt=os.path.join(proj_dir,"piplist.txt") + with open(piplist_txt,"w") as f: subprocess.run(shlex.join([interpreter, "-m", "pip", "list"]), stdout=f, stderr=f, shell=True,executable=shutil.which('bash')) + if log_level == Log.VERBOSE: + print(open(piplist_txt,"r").read()) return True else: print("## Errors trying to install pip requirements",file=sys.stderr) @@ -464,12 +467,15 @@ def setup_conda_prefix(proj_dir:str, condaprefix_dir:str, else: assert True, "unreachable. " if success: - with open(os.path.join(proj_dir,"exported-environment.yml"),"w") as f: + exported_environment_yml = os.path.join(proj_dir,"exported-environment.yml") + with open(exported_environment_yml,"w") as f: cmd = ["conda","env","export","--quiet", "--prefix",condaprefix_dir] logging.info(f"exporting env with {cmd}") subprocess.run(shlex.join(cmd), stdout=f, stderr=f, shell=True,executable=shutil.which('bash')) + if log_level == Log.VERBOSE: + print(open(exported_environment_yml,"r").read()) else: print("## Errors trying to install conda dependencies",file=sys.stderr) return False diff --git a/pythonrunscript/pythonrunscript.py b/pythonrunscript/pythonrunscript.py index ab6eb54..907a423 100755 --- a/pythonrunscript/pythonrunscript.py +++ b/pythonrunscript/pythonrunscript.py @@ -418,10 +418,13 @@ def install_pip_requirements(proj_dir, pip_requirements, interpreter, log_level: "pip_install.out","pip_install.err", log_level) if success: - with open(os.path.join(proj_dir,"piplist.txt"),"w") as f: + piplist_txt=os.path.join(proj_dir,"piplist.txt") + with open(piplist_txt,"w") as f: subprocess.run(shlex.join([interpreter, "-m", "pip", "list"]), stdout=f, stderr=f, shell=True,executable=shutil.which('bash')) + if log_level == Log.VERBOSE: + print(open(piplist_txt,"r").read()) return True else: print("## Errors trying to install pip requirements",file=sys.stderr) @@ -464,12 +467,15 @@ def setup_conda_prefix(proj_dir:str, condaprefix_dir:str, else: assert True, "unreachable. " if success: - with open(os.path.join(proj_dir,"exported-environment.yml"),"w") as f: + exported_environment_yml = os.path.join(proj_dir,"exported-environment.yml") + with open(exported_environment_yml,"w") as f: cmd = ["conda","env","export","--quiet", "--prefix",condaprefix_dir] logging.info(f"exporting env with {cmd}") subprocess.run(shlex.join(cmd), stdout=f, stderr=f, shell=True,executable=shutil.which('bash')) + if log_level == Log.VERBOSE: + print(open(exported_environment_yml,"r").read()) else: print("## Errors trying to install conda dependencies",file=sys.stderr) return False From bbb623a6fae2038a826d7b098b8aeba8dd1473b6 Mon Sep 17 00:00:00 2001 From: artste Date: Wed, 1 Oct 2025 23:36:40 +0200 Subject: [PATCH 2/2] remove ffmpeg from conda_install_specs.txt comment --- tests/run_python3.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/run_python3.py b/tests/run_python3.py index 0c8f019..df31863 100755 --- a/tests/run_python3.py +++ b/tests/run_python3.py @@ -1,7 +1,6 @@ #!/usr/bin/env pythonrunscript # ```conda_install_specs.txt # python=3.10 -# ffmpeg # ``` # if pythonrunscript works properly,