I would like to use a commandline tool (jupytext) inside a Python file. In a console, it works like this, which makes a .ipynb file out of .py
jupytext --to notebook notebook.py
But I don't want to do it for every file in a console. How can I execute this, when running a Python file itself (.py) in order to generate .ipynb automatically?
On a side note, I came across subprocess, which works fine with UNIX command in a python file, but I am not sure how to apply it for my case:
import subprocess
list_of_files = subprocess.run(['ls', '-la'], capture_output=True, text=True)
print(list_of_files.stdout)
Thanks a lot!