Before this fix, one could not import os in a # pipeline-api as the resulting FastAPI python module would then have import os defined twice. But, in the case where a# pipeline-api cell had a reference to an os module that had been imported previously in a non-# pipeline-api cell, an error occurred when converting the notebook since os had not been defined (as only # pipeline-api cells are inspected in the notebook->fastAPI route conversion, per design).
The fix is to include implied "standard" imports for os, gzip, mimetypes, and json when inferring parameters in pipeline_api during notebook-to-script conversion, but not when executing the jinja pipeline-template logic since those imports already exist at the top of the template.
Before this fix, one could not
import os
in a# pipeline-api
as the resulting FastAPI python module would then haveimport os
defined twice. But, in the case where a# pipeline-api
cell had a reference to anos
module that had been imported previously in a non-# pipeline-api
cell, an error occurred when converting the notebook sinceos
had not been defined (as only# pipeline-api
cells are inspected in the notebook->fastAPI route conversion, per design).The fix is to include implied "standard" imports for
os
,gzip
,mimetypes
, andjson
when inferring parameters inpipeline_api
during notebook-to-script conversion, but not when executing the jinja pipeline-template logic since those imports already exist at the top of the template.