Skip to content

Commit 7494c88

Browse files
authored
Fix "pip" collision in workflow script causing normal cells to be filtered out (#489)
## Problem Describe the purpose of this change. What problem is being solved and why? The convert-notebook script, used in the test notebooks action was failing notebooks that should pass under normal circumstances. The issue was a line in the workflow script that filtered out cells containing the string "pip", which filtered out "pipeline", "pipe", etc. This can be seen in the following prs: Instance 1: "pipeline" getting filtered out: #474 Instance 2: "pipe" getting filtered out: https://github.com/pinecone-io/examples/actions/runs/16154448867/job/45593572999?pr=473 ## Solution Describe the approach you took. Link to any relevant bugs, issues, docs, or other resources. I added a list of pip commands we'd want to ignore at the relevant level of preprocessing and had the script filter cells with those out, instead of "pip" ## Type of Change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [x] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update - [ ] Infrastructure change (CI configs, etc) - [ ] Non-code change (docs, etc) - [ ] None of the above: (explain here) ## Test Plan Describe specific steps for validating this change. I'll re-run tests that failed with the old script.
1 parent 8b51f4e commit 7494c88

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

.github/actions/run-notebook/convert-notebook.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,30 @@
7070

7171
# Collect cells that are not pip install commands
7272
executable_cells = ["from IPython.display import display"]
73+
74+
# pip commands we want to ignore:
75+
76+
PIP_COMMANDS = [
77+
"pip install",
78+
"pip uninstall",
79+
"pip freeze",
80+
"pip list",
81+
"pip show",
82+
"pip check",
83+
"pip download",
84+
"pip config",
85+
"pip search",
86+
"pip wheel",
87+
"pip hash",
88+
"pip cache",
89+
"pip index"
90+
]
91+
92+
7393
for cell in nb.cells:
7494
if cell.cell_type == "code":
75-
if "pip" not in cell.source:
95+
# ensures the cell is not a pip command, avoid hitting words that contain "pip"
96+
if not any(cmd in cell.source for cmd in PIP_COMMANDS):
7697
# Remove any lines that start with "!" or "%"
7798
# These are "magic" commands such as "%matplotlib inline" that
7899
# are not executable outside of a notebook environment.

0 commit comments

Comments
 (0)