jupyterlab/federated_labextensions.py
def watch_labextension(path, labextensions_path, logger=None, development=False, source_map=False):
    """Watch a labextension in a given path"""
    core_path = osp.join(HERE, 'staging')
    ext_path = osp.abspath(path)

    if logger:
        logger.info('Building extension in %s' % path)

    # Check to see if we need to create a symlink
    federated_extensions = get_federated_extensions(labextensions_path)

    with open(pjoin(ext_path, 'package.json')) as fid:
        ext_data = json.load(fid)

    if ext_data['name'] not in federated_extensions:
        develop_labextension_py(ext_path, sys_prefix=True)
    else:
        full_dest = pjoin(federated_extensions[ext_data['name']]['ext_dir'], ext_data['name'])
        output_dir = pjoin(ext_path, ext_data['jupyterlab'].get('outputDir', 'static'))
        if not osp.islink(full_dest):
            shutil.rmtree(full_dest)
            os.symlink(output_dir, full_dest)

    builder = _ensure_builder(ext_path, core_path)
    arguments = ['node', builder, '--core-path', core_path,  '--watch', ext_path]
    if development:
        arguments.append('--development')
    if source_map:
        arguments.append('--source-map')

    subprocess.check_call(arguments, cwd=ext_path)
Watch a labextension in a given path
Watch a labextension in a given path
Watch a labextension in a given path
def watch_labextension(path, labextensions_path, logger=None, development=False, source_map=False):
    core_path = osp.join(HERE, 'staging')
    ext_path = osp.abspath(path)
    if logger:
        logger.info('Building extension in %s' % path)
    federated_extensions = get_federated_extensions(labextensions_path)
    with open(pjoin(ext_path, 'package.json')) as fid:
        ext_data = json.load(fid)
    if ext_data['name'] not in federated_extensions:
        develop_labextension_py(ext_path, sys_prefix=True)
    else:
        full_dest = pjoin(federated_extensions[ext_data['name']]['ext_dir'], ext_data['name'])
        output_dir = pjoin(ext_path, ext_data['jupyterlab'].get('outputDir', 'static'))
        if not osp.islink(full_dest):
            shutil.rmtree(full_dest)
            os.symlink(output_dir, full_dest)
    builder = _ensure_builder(ext_path, core_path)
    arguments = ['node', builder, '--core-path', core_path,  '--watch', ext_path]
    if development:
        arguments.append('--development')
    if source_map:
        arguments.append('--source-map')
    subprocess.check_call(arguments, cwd=ext_path)
def watch_labextension ( path , labextensions_path , logger = None , development = False , source_map = False ) : core_path = osp . join ( HERE , 'staging' ) ext_path = osp . abspath ( path ) if logger : logger . info ( 'Building extension in %s' % path ) federated_extensions = get_federated_extensions ( labextensions_path ) with open ( pjoin ( ext_path , 'package.json' ) ) as fid : ext_data = json . load ( fid ) if ext_data [ 'name' ] not in federated_extensions : develop_labextension_py ( ext_path , sys_prefix = True ) else : full_dest = pjoin ( federated_extensions [ ext_data [ 'name' ] ] [ 'ext_dir' ] , ext_data [ 'name' ] ) output_dir = pjoin ( ext_path , ext_data [ 'jupyterlab' ] . get ( 'outputDir' , 'static' ) ) if not osp . islink ( full_dest ) : shutil . rmtree ( full_dest ) os . symlink ( output_dir , full_dest ) builder = _ensure_builder ( ext_path , core_path ) arguments = [ 'node' , builder , '--core-path' , core_path , '--watch' , ext_path ] if development : arguments . append ( '--development' ) if source_map : arguments . append ( '--source-map' ) subprocess . check_call ( arguments , cwd = ext_path )
Watch a labextension in a given path
Watch a labextension in a given path
"""Watch a labextension in a given path""" # Check to see if we need to create a symlink
path
labextensions_path
logger
development
source_map