nbdev
nbdev copied to clipboard
mark all cells in a nb with a certain flag
hello, is there a way to mark all cells with a flag so that conditional testing can be used?
In nbdev1, we had # all_slow, for v2, I'm aware of skip_exec and skip_showdoc. A follow up question in that case would be can the values for these flags be changed when we use nbdev_test?
For now, I am manually adding test flags to each and every cell. Is there an alternative to this? @seeM @hamelsmu ?
Deven, it should work the same you need to supply the flags you want to use to tst_flags in settings.ini like this.
Now those flags will be skipped. If you look at nbdev_test -h it will describe how you can run those flags. HTH.
If that works for you please close the issue!
I am a bit confused by this -
For now, I am manually adding test flags to each and every cell. Is there an alternative to this?
Are you saying you want to apply the test flag to an entire notebook?
Are you saying you want to apply the test flag to an entire notebook?
Yes
For instance, I have a nb which I only want to run in colab.
Ah, that's a clever hack. In that case, I'll just have to rename my nbs accordingly.
My previous workflow was something like this,
nbdev_test --flags colab # to test nbs in developed and executed in colab
nbdev_test --flags local # to test nbs in developed and executed locally on my system
The reason why I liked this workflow was the addition of a single cell was enough to have conditional testing.
@hamelsmu can we reopen this issue? I realized why having this feature was handy. Marking all cells with a certain flag still runs showdoc, without the all_slow flag, I would need to manually add the slow flag to all the cells.