How to use the nbsite.util.copy_files function in nbsite

To help you get started, we’ve selected a few nbsite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyviz-dev / nbsite / nbsite / cmd.py View on Github external
def init(project_root='', doc='doc', theme=''):
    """
    Start an nbsite project: create a doc folder containing nbsite
    template files

    Use the theme argument to specify a particular theme to use as template
    """
    paths = _prepare_paths(project_root, doc=doc)
    if theme:
        copy_files(os.path.join(dirname(__file__), 'templates', theme),
                   paths['doc'])
    else:
        copy_files(os.path.join(dirname(__file__), 'templates', 'basic'),
                   paths['doc'])
github pyviz-dev / nbsite / nbsite / cmd.py View on Github external
inspect_links=False,
          overwrite=False):
    """
    Build the site from the rst files and the notebooks

    Usually this is run after `nbsite scaffold`
    """
    paths = _prepare_paths(project_root, examples=examples, doc=doc, examples_assets=examples_assets)
    if overwrite:
        for path in glob.glob(os.path.join(paths['doc'], '**', '*.ipynb'), recursive=True):
            print('Removing evaluated notebook from {}'.format(path))
            os.remove(path)
    subprocess.check_call(["sphinx-build","-b",what,paths['doc'],output])
    print('Copying json blobs (used for holomaps) from {} to {}'.format(paths['doc'], output))
    copy_files(paths['doc'], output, '**/*.json')
    copy_files(paths['doc'], output, 'json_*')
    if 'examples_assets' in paths:
        build_assets = os.path.join(output, examples_assets)
        print("Copying examples assets from %s to %s"%(paths['examples_assets'],build_assets))
        copy_files(paths['examples_assets'], build_assets)
    fix_links(output, inspect_links)
    # create a .nojekyll file in output for github compatibility
    subprocess.check_call(["touch", os.path.join(output, '.nojekyll')])
    if not clean_dry_run:
        print("Call `nbsite build` with `--clean-dry-run` to not actually delete files.")
    clean(output, clean_dry_run)
github pyviz-dev / nbsite / nbsite / cmd.py View on Github external
clean_dry_run=False,
          inspect_links=False,
          overwrite=False):
    """
    Build the site from the rst files and the notebooks

    Usually this is run after `nbsite scaffold`
    """
    paths = _prepare_paths(project_root, examples=examples, doc=doc, examples_assets=examples_assets)
    if overwrite:
        for path in glob.glob(os.path.join(paths['doc'], '**', '*.ipynb'), recursive=True):
            print('Removing evaluated notebook from {}'.format(path))
            os.remove(path)
    subprocess.check_call(["sphinx-build","-b",what,paths['doc'],output])
    print('Copying json blobs (used for holomaps) from {} to {}'.format(paths['doc'], output))
    copy_files(paths['doc'], output, '**/*.json')
    copy_files(paths['doc'], output, 'json_*')
    if 'examples_assets' in paths:
        build_assets = os.path.join(output, examples_assets)
        print("Copying examples assets from %s to %s"%(paths['examples_assets'],build_assets))
        copy_files(paths['examples_assets'], build_assets)
    fix_links(output, inspect_links)
    # create a .nojekyll file in output for github compatibility
    subprocess.check_call(["touch", os.path.join(output, '.nojekyll')])
    if not clean_dry_run:
        print("Call `nbsite build` with `--clean-dry-run` to not actually delete files.")
    clean(output, clean_dry_run)
github pyviz-dev / nbsite / nbsite / cmd.py View on Github external
Usually this is run after `nbsite scaffold`
    """
    paths = _prepare_paths(project_root, examples=examples, doc=doc, examples_assets=examples_assets)
    if overwrite:
        for path in glob.glob(os.path.join(paths['doc'], '**', '*.ipynb'), recursive=True):
            print('Removing evaluated notebook from {}'.format(path))
            os.remove(path)
    subprocess.check_call(["sphinx-build","-b",what,paths['doc'],output])
    print('Copying json blobs (used for holomaps) from {} to {}'.format(paths['doc'], output))
    copy_files(paths['doc'], output, '**/*.json')
    copy_files(paths['doc'], output, 'json_*')
    if 'examples_assets' in paths:
        build_assets = os.path.join(output, examples_assets)
        print("Copying examples assets from %s to %s"%(paths['examples_assets'],build_assets))
        copy_files(paths['examples_assets'], build_assets)
    fix_links(output, inspect_links)
    # create a .nojekyll file in output for github compatibility
    subprocess.check_call(["touch", os.path.join(output, '.nojekyll')])
    if not clean_dry_run:
        print("Call `nbsite build` with `--clean-dry-run` to not actually delete files.")
    clean(output, clean_dry_run)