Skip to main content

SCons tool for Jupyter notebook

Project description

SCons nbconvert tool

About

This tool can be used to convert jupyter pages with nbconvert.

Install

Installing it, requires you to copy (or, even better: checkout) the contents of the package's nbconvert folder to

  • /path_to_your_project/site_scons/site_tools/nbconvert", if you need the nbconvert Tool in one project only, or
  • /user/share/scons/site_scons/site_tools/nbconvert, for a system-wide installation.

For more infos about this, please refer to

  • the SCons User's Guide, sect. "Where to put your custom Builders and Tools"

Activate the tool

Create a build environment with the nbconvert builder

import os
import sconstool_nbconvert

env = Environment(ENV = {'PATH' : os.environ['PATH']},
                  tools=['default', sconstool_nbconvert.generate],
                  NBCONVERT_ENVIRONMENT_VARS={'flags': ['execute', 'no-input'],
                  'to': 'html',
                  'log-level': 'CRITICAL', 
                  'ExecutePreprocessor.kernel_name': 'python3',
                  'HTMLExporter.exclude_anchor_links': True,
                  'template': 'classic'})

The NBCONVERT_ENVIRONMENT_VARS must contain a list of flags. Allowed flags are: [execute] [allow-errors] [inplace] [clear-output] [no-prompt] [no-input] [show-input]

It can also contain a list of build options. For a list of options visit the nbconvert documentation

Call the target

The nbconvert target can be called with one source and target file.

env.nbconvert('rendered_templ.html', os.path.join('test.ipynb'))

Templates

There is a template folder in this repository. It can be used to convert the notebooks to hugo content pages. It will allow metadata in the jupyter notebook for the FrontMatter creation. Jupyterlab is needed to edit this data. The FrontMatter section can be added before the jupyter metadata starting with kernelspec.

{
    "FrontMatter": {
        "author": "spielhuus",
        "category": "article",
        "date": "2021-01-10",
        "tag": "grundlage",
        "title": "cmos",
        "draft": "true"
    },
    
    "kernelspec": {
    },
    "language_info": {
    }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sconstool_nbconvert-0.0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sconstool_nbconvert-0.0.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file sconstool_nbconvert-0.0.1.tar.gz.

File metadata

  • Download URL: sconstool_nbconvert-0.0.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for sconstool_nbconvert-0.0.1.tar.gz
Algorithm Hash digest
SHA256 55d4eb0a406abb6316a0d53f08fd98e8ec58cb8feed8f0f84c1d548d7aa72bf2
MD5 5f28ea2c9accd2cfa61ac7a2bb44cda5
BLAKE2b-256 db450d1ab8960d7b43c3240bd4fa48ee483b18a392772fc6d078d93305e6d422

See more details on using hashes here.

File details

Details for the file sconstool_nbconvert-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: sconstool_nbconvert-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for sconstool_nbconvert-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7cc9e781ce3d9c38ed8b9061e06b5af76ad79d2bee80b434de06d594d5d00fff
MD5 674bcfaf3e97e7efe36501409e9d5057
BLAKE2b-256 b20fc514667d801cb6d6a8f8914c30e9a1459904d1bd0e659acff0fc9151826a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page