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 thenbconvertTool 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": {
}
}
Metadata
Release files for sconstool-nbconvert 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sconstool_nbconvert-0.0.1.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sconstool_nbconvert-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / sconstool_nbconvert-0.0.1.tar.gz
| Download URL | sconstool_nbconvert-0.0.1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55d4eb0a406abb6316a0d53f08fd98e8ec58cb8feed8f0f84c1d548d7aa72bf2
|
|
BLAKE2b-256 checksum How to use checksums |
db450d1ab8960d7b43c3240bd4fa48ee483b18a392772fc6d078d93305e6d422
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / sconstool_nbconvert-0.0.1-py3-none-any.whl
| Download URL | sconstool_nbconvert-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7cc9e781ce3d9c38ed8b9061e06b5af76ad79d2bee80b434de06d594d5d00fff
|
|
BLAKE2b-256 checksum How to use checksums |
b20fc514667d801cb6d6a8f8914c30e9a1459904d1bd0e659acff0fc9151826a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|