Skip to content

Make cell-magics opt-in rather than opt-out #557

@MarcoGorelli

Description

@MarcoGorelli

Currently, nbqa tries to process all cell magics except those in

nbQA/nbqa/save_source.py

Lines 31 to 51 in a99e0e2

MAGIC = [
"%%!",
"%%bash",
"%%cython",
"%%HTML",
"%%html",
"%%javascript",
"%%js",
"%%latex",
"%%markdown",
"%%perl",
"%%python2",
"%%ruby",
"%%script",
"%%sh",
"%%sx",
"%%system",
"%%SVG",
"%%svg",
"%%writefile",
]

I think we should do the opposite: never process cell magics, except for some hard-coded common ones like matplotlib inline and timeit, + add a command-line argument so users can pass extra ones they might want to process

This means deprecating nbqa_ignore_cells and instead adding nbqa_process_cells.

IMO it's OK to make a 0.6.0 release with this breaking change in - this is a relatively new project, and it's not like the user-base is large enough that we need to go through a deprecation cycle

cc @nbQA-dev/nbqa-core in case anyone has any comments - else I'll try to work on during the weekend

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions