@@ -29,15 +29,25 @@ def generate_requirements(settings: Settings) -> Path:
2929 out_path = Path (tmp .name )
3030
3131 if pm == "uv" :
32+ cmd = ["uv" , "export" , "--format" , "requirements-txt" , "--no-hashes" , "-o" , str (out_path )]
33+ if settings .debug :
34+ print (f"[debug] uv export command: { cmd } " , file = sys .stderr )
3235 subprocess .run (
33- [ "uv" , "export" , "--format" , "requirements-txt" , "--no-hashes" , "-o" , str ( out_path )] ,
36+ cmd ,
3437 check = True ,
3538 capture_output = True ,
3639 text = True ,
3740 )
41+ if settings .debug :
42+ print (
43+ f"[debug] generated requirements ({ out_path } ):\n { out_path .read_text ()} " ,
44+ file = sys .stderr ,
45+ )
3846 elif pm == "pip" :
3947 result = subprocess .run (["pip" , "freeze" ], capture_output = True , text = True , check = True )
4048 out_path .write_text (result .stdout )
49+ if settings .debug :
50+ print (f"[debug] pip freeze output ({ out_path } ):\n { result .stdout } " , file = sys .stderr )
4151 elif pm == "poetry" :
4252 subprocess .run (
4353 ["poetry" , "self" , "add" , "poetry-plugin-export" ],
@@ -59,11 +69,21 @@ def generate_requirements(settings: Settings) -> Path:
5969 capture_output = True ,
6070 text = True ,
6171 )
72+ if settings .debug :
73+ print (
74+ f"[debug] poetry export output ({ out_path } ):\n { out_path .read_text ()} " ,
75+ file = sys .stderr ,
76+ )
6277 elif pm == "pipenv" :
6378 result = subprocess .run (
6479 ["pipenv" , "requirements" ], capture_output = True , text = True , check = True
6580 )
6681 out_path .write_text (result .stdout )
82+ if settings .debug :
83+ print (
84+ f"[debug] pipenv requirements output ({ out_path } ):\n { result .stdout } " ,
85+ file = sys .stderr ,
86+ )
6787
6888 return out_path
6989
@@ -110,11 +130,16 @@ def read_bandit_sarif(sarif_path: Path) -> dict[str, Any]:
110130 return {"results" : results , "errors" : []}
111131
112132
113- def run_pip_audit (requirements_path : Path ) -> list [dict [str , Any ]]:
133+ def run_pip_audit (
134+ requirements_path : Path , settings : Settings | None = None
135+ ) -> list [dict [str , Any ]]:
114136 """Run pip-audit, write pip-audit-report.json, return parsed report."""
115137 output_file = Path ("pip-audit-report.json" )
116138 cmd = ["pip-audit" , "-r" , str (requirements_path ), "-f" , "json" ]
117139
140+ if settings and settings .debug :
141+ print (f"[debug] pip-audit command: { cmd } " , file = sys .stderr )
142+
118143 result = subprocess .run (cmd , capture_output = True , text = True )
119144 # pip-audit exits 1 when vulnerabilities are found — that is expected
120145 if result .returncode not in (0 , 1 ):
@@ -123,6 +148,13 @@ def run_pip_audit(requirements_path: Path) -> list[dict[str, Any]]:
123148 file = sys .stderr ,
124149 )
125150
151+ if settings and settings .debug :
152+ print (
153+ f"[debug] pip-audit exit={ result .returncode } "
154+ f"stdout_len={ len (result .stdout )} stderr={ result .stderr !r} " ,
155+ file = sys .stderr ,
156+ )
157+
126158 raw = result .stdout .strip ()
127159 if raw :
128160 parsed : Any = json .loads (raw )
0 commit comments