Skip to content

Exclude/include notebook code when converting from synb to py-script #12

@broeks-m

Description

@broeks-m

Hello,

Thanks for the great tool! I'm using it to convert synapse notebooks (from a git repro) to a python script.
When converting from python to a notebookscript it's possible to exclude python-code.

I don't know if you do feature requests, but I would like to be able to exclude or include lines when converting from a synapse notebook to a python script. 2 examples:


1
When a notebook contains "# nb--exclude--begin" and "# nb--exclude--end" the lines betweens these codeblocks would not be included when converting from synapse notebook to python script

In a synapse notebookcell:

# nb--exclude--begin
{My code that only needs to run in a notebook}
# nb--exclude--end

None of these lines are present in de python script


2
The other option would be to include a line that's excluded in the synapse notebook. Just bij removing: ' """ nb--include--begin ' and ' nb--include--end """ '

In a synapse notebookcell:

""" nb--include--begin
{My code that only needs to run in a powershell script}
nb--include--end """

Resulting pythonscript:
{My code that only needs to run in a powershell script}


Hope my description is understandable, if it's not, let me know!

Greetings

Martijn

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