Skip to content

System assigns result in invalid syntax #816

Open
@MarcoGorelli

Description

If I have a cell with

flake8_version = !flake8 --version
flake8_version

, then this executes fine.

However, the equivalent Python representation of it from jupytext is:

# %%
flake8_version = !flake8 --version
flake8_version

which is invalid syntax (and not something I could run flake8 on 😄 )

I'm bringing this up because in #781 you commented

magic commands are always commented out by default

but this one wasn't commented out.

From a quick glance at the source code, it looks like magics are detected using regular expressions - have you considered using IPython's TransformerManager and then ast-parsing instead? I'm happy to help out with this if you want greater support for magic detection (at least, in Python notebooks)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions