Skip to content

IPython magic commands need to be runnable from comments so other tools can work with them. #3263

@janosh

Description

@janosh

Including magic commands in an interactive python file breaks automatic code formatting. For instance, this

#%%
%load_ext autoreload
%autoreload 2

#%%
a,b,c = [1 , 2 , 3]

will only be formatted to

#%%
# %load_ext autoreload
# %autoreload 2

#%%
a, b, c = [1, 2, 3]

if the magic commands are commented out. It would be nice if magic commands didn't throw off the formatter, at least if the file contains #%% cell delimiters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions