Skip to content

Export processors extension system#1563

Merged
jph00 merged 1 commit intomainfrom
pr/export-processors-extension-system
Jan 31, 2026
Merged

Export processors extension system#1563
jph00 merged 1 commit intomainfrom
pr/export-processors-extension-system

Conversation

@jph00
Copy link
Contributor

@jph00 jph00 commented Jan 31, 2026

A simple, clean extension system for export processors — functions that transform code cells during nbdev_export.

Changes

New extension system

  • export_procs config in [tool.nbdev] accepts a list of module:callable strings
  • Each processor is a simple function: def my_proc(cell) that modifies cell.source in place
  • No entry points or magic — just explicit imports

Example config:

[tool.nbdev]
export_procs = ["nbdev.scrubmagics:scrub_magics"]

Removed from core

  • black_format — moved to separate nbdev-black package
  • scrub_magics — moved to nbdev/scrubmagics.py (still ships with nbdev, but opt-in)
  • optional_procs() — no longer needed

Other changes

  • Added import_obj(s) to config.py for importing module:obj strings
  • Renamed procsdoc_procs in config for clarity (doc processors vs export processors)
  • Config defaults for doc_procs and export_procs are now lists [] instead of empty strings

Documentation

  • Updated nbs/tutorials/extensions.ipynb with:
    • Built-in scrub_magics processor docs
    • New section on writing export processors
    • Comparison of doc processors vs export processors

Breaking Changes

  • black_format no longer in core — install nbdev-black and add ["nbdevblack:black_format"] to export_procs
  • procs config renamed to doc_procs
  • black_formatting config option removed (was deprecated)

@jph00 jph00 added the enhancement New feature or request label Jan 31, 2026
@jph00 jph00 merged commit 60974a8 into main Jan 31, 2026
@jph00 jph00 deleted the pr/export-processors-extension-system branch January 31, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant