File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 1+ name : Notebook Execution and Error Check
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - dev
8+ workflow_dispatch : # This enables manual triggering
9+
10+ jobs :
11+ install_from_hub :
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Set up Python
15+ uses : actions/setup-python@v5
16+ with :
17+ python-version : 3.11.x
18+ - name : pip install from main
19+ run : pip install git+https://github.com/guardrails-ai/guardrails.git@main
20+ - name : Install PII validator
21+ run : guardrails hub install hub://guardrails/detect_pii
22+ - name : Verify PII validator is addressable
23+ run : echo 'from guardrails.hub import DetectPII' | python
Original file line number Diff line number Diff line change 1+ import json
12import os
23import subprocess
34import sys
@@ -44,6 +45,13 @@ def pip_process(
4445 logger .debug (f"decoding output from pip { action } { package } " )
4546 if format == json_format :
4647 parsed = BytesHeaderParser ().parsebytes (output )
48+ try :
49+ return json .loads (str (parsed ))
50+ except Exception as e :
51+ logger .debug (
52+ f"json parse exception in decoding output from pip { action } { package } . Falling back to accumulating the byte stream" , # noqa
53+ e ,
54+ )
4755 accumulator = {}
4856 for key , value in parsed .items ():
4957 accumulator [key ] = value
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ def parsebytes(self, *args):
134134
135135 response = pip_process ("show" , "pip" , format = "json" )
136136
137- assert mock_logger_debug .call_count == 2
137+ assert mock_logger_debug .call_count == 3
138138 debug_calls = [
139139 call ("running pip show pip" ),
140140 call ("decoding output from pip show pip" ),
You can’t perform that action at this time.
0 commit comments