Export processors extension system #1563
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A simple, clean extension system for export processors — functions that transform code cells during
nbdev_export.Changes
New extension system
export_procsconfig in[tool.nbdev]accepts a list ofmodule:callablestringsdef my_proc(cell)that modifiescell.sourcein placeExample config:
Removed from core
black_format— moved to separatenbdev-blackpackagescrub_magics— moved tonbdev/scrubmagics.py(still ships with nbdev, but opt-in)optional_procs()— no longer neededOther changes
import_obj(s)to config.py for importingmodule:objstringsprocs→doc_procsin config for clarity (doc processors vs export processors)doc_procsandexport_procsare now lists[]instead of empty stringsDocumentation
nbs/tutorials/extensions.ipynbwith:scrub_magicsprocessor docsBreaking Changes
black_formatno longer in core — installnbdev-blackand add["nbdevblack:black_format"]toexport_procsprocsconfig renamed todoc_procsblack_formattingconfig option removed (was deprecated)