vericast / nbconflux

nbconflux converts Jupyter Notebooks to Atlassian Confluence pages
BSD 3-Clause "New" or "Revised" License
117 stars 33 forks source link

Nbconvert exporter entrypoint #3

Open mpacer opened 6 years ago

mpacer commented 6 years ago

You can expose this package directly to nbconvert (so you could use jupyter nbconvert --to confluence your.ipynb) using entrypoints:

For example (from the docs):

setup(
    ...
    entry_points = {
        'nbconvert.exporters': [
            'simple = mymodule:SimpleExporter',
            'detail = mymodule:DetailExporter',
        ],
    }
)
parente commented 6 years ago

With the current implementation, the minimum required parameters on the command line for the exporter entrypoint command line would be the following:

nbconvert --to confluence --ConfluenceExporter.url=<url of the page to update> \
  --ConfluenceExporter.username=<username> --ConfluenceExporter.password=<password> \
  mynotebook.ipynb

Specifying a password on the command line is not great for securty, so we'd probably need to move the code that reads it from an env var or the .nbconflux file to the exporter. That would make the minimum command line:

nbconvert --to confluence --ConfluenceExporter.url=<url of the page to update> mynotebook.ipynb