posit-dev / publisher

MIT License
4 stars 0 forks source link

Python package sniffer: find all imports in a notebook #1763

Closed jonkeane closed 4 months ago

jonkeane commented 4 months ago

I believe that we only look in the first code chunk for jupyter notebooks. Observed in user testing: having imports in both a first code chunk and a second code chunk, but packages in the second code chunk didn't seem to be added to requirements.txt

kgartland-rstudio commented 4 months ago

Here's an example to reproduce: https://github.com/rstudio/connect-content/blob/kg-publisher/bundles/stock-report-jupyter/stock-report-jupyter.ipynb

The import requests is in a later cell and does not get added to requirements.txt when running the Python Scan.

mmarchetti commented 4 months ago

May be fixed by #1770