nbdev icon indicating copy to clipboard operation
nbdev copied to clipboard

Show location of mixing of imports and code

Open hamelsmu opened this issue 3 years ago • 1 comments

From the forums

since I have got lots of mixes in more than one notebooks, and the warning does not tell me where those mixes come from, I wonder whether you could add the info on where those mixes are from or much better if nbdev could automatically separate the import into a separate cell?

hamelsmu avatar Aug 26 '22 02:08 hamelsmu

This will require access to the filename in ipynb-filter.

jph00 avatar Aug 26 '22 06:08 jph00

I was trying to migrate ghtop to nbdev v2 for a demo I'm having with Will soon and encountered this

You can repro this on this commit by running nbdev_prepare

 nbdev_prepare                                                                                                                 (master)ghtop-docs
Success.
NB: From v1.2 `_quarto.yml` is no longer auto-updated. Please remove the `custom_quarto_yml` line from `settings.ini`
/Users/hamel/github/nbdev/nbdev/processors.py:182: UserWarning: Found cells containing imports and other code. See FAQ.
---
from time import sleep
def _randwait(): yield from (sleep(random.random()/200) for _ in range(100))

c = EventTimer(store=5, span=0.03)
for o in _randwait(): c.add(1)
---

  warn(f'Found cells containing imports and other code. See FAQ.\n---\n{cell.source}\n---\n')
pandoc -o README.md
  to: gfm+footnotes+tex_math_dollars-yaml_metadata_block
  output-file: index.html
  standalone: true
  default-image-extension: png

metadata
  description: See what's happening on GitHub in real time (also helpful if you need to use up your API quota as quickly as possible).
  title: ghtop

Output created: _docs/README.md

hamelsmu avatar Sep 21 '22 15:09 hamelsmu