Esempio n. 1
0
def post_dist():
    target = pjoin(HERE, NAME, 'static', 'package.json')
    with open(target) as fid:
        version = json.load(fid)['jupyterlab']['version']
    print(Version(version))
    print(Version(get_version(f'{NAME}/_version.py')))
    if Version(version) != Version(get_version(f'{NAME}/_version.py')):
        raise ValueError('Version mismatch, please run `build:update`')
Esempio n. 2
0
def assert_equal_version():
    cdir = Path(__file__).parent
    server_version = parse(
        get_version(str(cdir / "jupyter_project" / "_version.py")))
    package_json = cdir / "package.json"
    package_config = json.loads(package_json.read_text())
    jlab_version = parse(package_config.get("version", "0"))
    assert server_version == jlab_version, f"Frontend ({jlab_version}) and server ({server_version}) versions are not matching."
Esempio n. 3
0
def post_dist():
    from packaging.version import Version
    from jupyter_packaging import get_version

    target = pjoin(HERE, NAME, 'static', 'package.json')
    with open(target) as fid:
        version = json.load(fid)['jupyterlab']['version']

    if Version(version) != Version(get_version(f'{NAME}/_version.py')):
        raise ValueError('Version mismatch, please run `build:update`')
Esempio n. 4
0
def post_dist():
    from jupyter_packaging import get_version
    from packaging.version import Version

    target = pjoin(HERE, NAME, "static", "package.json")
    with open(target) as fid:
        version = json.load(fid)["jupyterlab"]["version"]

    if Version(version) != Version(get_version(f"{NAME}/_version.py")):
        raise ValueError(
            "Version mismatch, please run `npm run prepare:python-release`")
Esempio n. 5
0
    get_version,
    create_cmdclass,
    combine_commands,
    install_npm,
    ensure_targets,
)
import setuptools

HERE = os.path.abspath(os.path.dirname(__file__))

# The name of the project
NAME = "jupyterlab-classic"
PACKAGE_NAME = NAME.replace("-", "_")

# Get our version
version = get_version(os.path.join(PACKAGE_NAME, "_version.py"))

main_bundle_dest = os.path.join(HERE, PACKAGE_NAME, "static")
main_bundle_source = os.path.join(HERE, "builder")

labext_name = "@jupyterlab-classic/lab-extension"
lab_extension_dest = os.path.join(HERE, PACKAGE_NAME, "labextension")
lab_extension_source = os.path.join(HERE, "packages", "lab-extension")

# Representative files that should exist after a successful build
jstargets = [
    os.path.join(lab_extension_source, "lib", "index.js"),
    os.path.join(lab_extension_dest, "package.json"),
    os.path.join(main_bundle_dest, "bundle.js"),
]
Esempio n. 6
0
    install_npm,
    ensure_targets,
    combine_commands,
    get_version,
)

here = os.path.dirname(os.path.abspath(__file__))

log.set_verbosity(log.DEBUG)
log.info('setup.py entered')
log.info('$PATH=%s' % os.environ['PATH'])

name = 'ipyspeck'

# Get ipyspeck version
version = get_version(pjoin(name, '_version.py'))

js_dir = pjoin(here, 'js')
js_dir2 = pjoin(here, 'ipyspeck', 'stspeck', 'frontend')

# Representative files that should exist after a successful build
jstargets = [
    pjoin(js_dir, 'dist', 'index.js'),
]
jstargets2 = [
    pjoin(js_dir2, 'build', 'static'),
]
data_files_spec = [
    ('share/jupyter/nbextensions/ipyspeck', 'ipyspeck/static', '*.*'),
    ('etc/jupyter/nbconfig/notebook.d', '.', 'ipyspeck.json'),
    ('share/streamlit/component/stspeck', 'ipyspeck/stspeck/frontend/build',
Esempio n. 7
0
]

package_data_spec = dict()
package_data_spec[NAME] = [
    'staging/*', 'staging/templates/*', 'staging/.yarnrc',
    'static/**', 'tests/mock_packages/**', 'themes/**', 'schemas/**', '*.js'
]


def exclude(filename):
    """Exclude JavaScript map files"""
    return filename.endswith('.js.map')

staging = pjoin(HERE, NAME, 'staging')
npm = ['node', pjoin(staging, 'yarn.js')]
VERSION = get_version('%s/_version.py' % NAME)


def check_assets():
    from packaging.version import Version

    # Representative files that should exist after a successful build
    targets = [
        'static/package.json',
        'schemas/@jupyterlab/shortcuts-extension/shortcuts.json',
        'themes/@jupyterlab/theme-light-extension/index.css'
    ]

    for t in targets:
        if not os.path.exists(pjoin(HERE, NAME, t)):
            msg = ('Missing file: %s, `build:prod` script did not complete '
Esempio n. 8
0
from os import path

from jupyter_packaging import (
    create_cmdclass,
    install_npm,
    ensure_targets,
    combine_commands,
    get_version,
)

pjoin = path.join

name = "jupyterlab_commands"
here = path.abspath(path.dirname(__file__))
jshere = path.abspath(path.join(here, "js"))
version = get_version(pjoin(here, name, "_version.py"))

with open(path.join(here, "README.md"), encoding="utf-8") as f:
    long_description = f.read().replace("\r\n", "\n")

requires = ["jupyterlab>=3.0.0", "notebook>=6.0.3"]

requires_dev = requires + [
    "black>=20.",
    "bump2version>=1.0.0",
    "flake8>=3.7.8",
    "flake8-black>=0.2.1",
    "jupyter_packaging",
    "mock",
    "pytest>=4.3.0",
    "pytest-cov>=2.6.1",
Esempio n. 9
0
from jupyter_packaging import (combine_commands, create_cmdclass,
                               ensure_python, ensure_targets, get_version,
                               install_npm)

# the name of the project
name = 'jupyter-fs'

# the Path to the python pkg dir
py_pkg = Path('jupyterfs')

# the Path to the javascript pkg dir
js_pkg = Path('js')

ensure_python(('2.7', '>=3.6'))

version = get_version(str(py_pkg / '_version.py'))

with open('README.md', encoding='utf-8') as f:
    long_description = f.read()

data_files_spec = [
    # lab extension installed by default:
    ('share/jupyter/lab/extensions', str(py_pkg / 'labdist'), '*.tgz'),
    # config to enable server extension by default:
    ('etc/jupyter', 'jupyter-config', '**/*.json'),
]

cmdclass = create_cmdclass('pack_labext', data_files_spec=data_files_spec)
cmdclass['pack_labext'] = combine_commands(
    install_npm(js_pkg, build_cmd='build:labdist', npm=['jlpm']),
    ensure_targets(
Esempio n. 10
0
import pathlib
from setuptools import setup, find_packages
from jupyter_packaging import get_version

NAME = "pytest-jupyter"
PACKAGE_NAME = NAME.replace("-", "_")
DESCRIPTION = "A pytest plugin for testing Jupyter libraries and extensions."
VERSION = get_version(f"{PACKAGE_NAME}/_version.py")

HERE = pathlib.Path('.')
readme_path = HERE.joinpath('README.md')
README = readme_path.read_text()

# Build the extra requirements for each plugin.
EXTRA_REQUIRES = {
    'docs': [
        'Sphinx',
        'myst_parser',
        'pydata_sphinx_theme',
    ],
    'core': ['jupyter_core'],
    'server':
    ['nbformat', 'jupyter_core', 'jupyter_server', 'pytest-tornasync']
}

setup_args = dict(
    name=NAME,
    version=VERSION,
    description=DESCRIPTION,
    long_description=README,
    long_description_content_type='text/markdown',
Esempio n. 11
0
log.set_verbosity(log.DEBUG)
log.info("setup.py entered")
log.info("$PATH=%s" % os.environ["PATH"])

here = os.path.dirname(os.path.abspath(__file__))
# IS_REPO = os.path.exists(os.path.join(here, ".git"))
# STATIC_DIR = os.path.join(here, "scatterplot", "static")
# NODE_ROOT = os.path.join(here, "js")
# NPM_PATH = os.pathsep.join(
#     [
#         os.path.join(NODE_ROOT, "node_modules", ".bin"),
#         os.environ.get("PATH", os.defpath),
#     ]
# )
js_dir = os.path.join(here, 'js')
version = get_version("jscatter/_version.py")

js_targets = [
    os.path.join(js_dir, 'dist', 'index.js'),
]

data_files_spec = [
    ("share/jupyter/nbextensions/jscatter", "jscatter/nbextension", "*.*"),
    ("share/jupyter/labextensions/jscatter", "jscatter/labextension", "**"),
    ("share/jupyter/labextensions/jscatter", ".", "install.json"),
    ("etc/jupyter/nbconfig/notebook.d", ".", "jscatter.json"),
]


def read(*parts, **kwargs):
    filepath = os.path.join(here, *parts)
Esempio n. 12
0
import pathlib
from setuptools import setup
from jupyter_packaging import (get_version)

here = pathlib.Path('.')
version_path = here.joinpath('jupyter_server', '_version.py')
VERSION = get_version(str(version_path))

readme_path = here.joinpath('README.md')
README = readme_path.read_text()

setup_args = dict(
    name='jupyter_server',
    description=
    'The backend—i.e. core services, APIs, and REST endpoints—to Jupyter web applications.',
    long_description=README,
    version=VERSION,
    author='Jupyter Development Team',
    author_email='*****@*****.**',
    url='http://jupyter.org',
    license='BSD',
    platforms="Linux, Mac OS X, Windows",
    keywords=['ipython', 'jupyter'],
    classifiers=[
        'Intended Audience :: Developers',
        'Intended Audience :: System Administrators',
        'Intended Audience :: Science/Research',
        'License :: OSI Approved :: BSD License',
        'Programming Language :: Python',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
Esempio n. 13
0
from setuptools import setup

from jupyter_packaging import (
    create_cmdclass,
    install_npm,
    ensure_targets,
    combine_commands,
    get_version,
    skip_if_exists,
)

import os
from os.path import join as pjoin

here = os.path.dirname(os.path.abspath(__file__))
version = get_version(pjoin('bqplot', '_version.py'))

js_dir = pjoin(here, 'js')

# Representative files that should exist after a successful build
jstargets = [
    pjoin('share', 'jupyter', 'nbextensions', 'bqplot', 'index.js'),
    pjoin('share', 'jupyter', 'labextensions', 'bqplot', 'package.json'),
]

data_files_spec = [
    ('share/jupyter/nbextensions/bqplot', 'share/jupyter/nbextensions/bqplot', '*.js'),
    ('share/jupyter/labextensions/bqplot/', 'share/jupyter/labextensions/bqplot/', '**'),
    ('share/jupyter/labextensions/bqplot/', here, 'install.json'),
    ('etc/jupyter/nbconfig/notebook.d', 'etc/jupyter/nbconfig/notebook.d', 'bqplot.json'),
]
    ensure_python,
    get_version,
)

from setuptools import setup

HERE = os.path.abspath(os.path.dirname(__file__))

# The name of the project
name = "{{ cookiecutter.python_package_name }}"

# Ensure a valid python version
ensure_python(">=3.5")

# Get our version
version = get_version(pjoin(HERE, name, "_version.py"))

nb_path = pjoin(HERE, name, "nbextension", "static")
js_path = pjoin(HERE, "ts")
lab_path = pjoin(HERE, "ts", "lab-dist")

# Representative files that should exist after a successful build
jstargets = [pjoin(nb_path, "index.js"), pjoin(js_path, "lib", "plugin.js")]

package_data_spec = {name: ["nbextension/static/*.*js*"]}

data_files_spec = [
    (
        "share/jupyter/nbextensions/{{ cookiecutter.python_package_name }}",
        nb_path,
        "*.js*",
Esempio n. 15
0
import os
from setuptools import setup, find_packages
from codecs import open
from os import path
from jupyter_packaging import (ensure_python, get_version)

ensure_python(('2.7', '>=3.7'))
pjoin = path.join
name = 'jupyter_paperboy'
here = path.abspath(path.dirname(__file__))
version = get_version(pjoin(here, 'paperboy', '_version.py'))

print(
    'WARNING: https://issues.apache.org/jira/browse/AIRFLOW-1430?subTaskView=unresolved'
)
os.environ['AIRFLOW_GPL_UNIDECODE'] = '1'

with open(path.join(here, 'README.md'), encoding='utf-8') as f:
    long_description = f.read()

with open(path.join(here, 'requirements.txt'), encoding='utf-8') as f:
    requires = [r for r in f.read().split(os.linesep) if '-e' not in r]
    if os.name == 'nt':
        # no gunicorn on windows
        if 'gunicorn' in requires:
            requires.remove('gunicorn')
        requires.append('waitress')

setup(
    name=name,
    version=version,
Esempio n. 16
0
    ensure_python,
    get_version,
)

from setuptools import setup, find_packages

HERE = Path(__file__).absolute().parent

# The name of the project
name = "ipyscales"

# Ensure a valid python version
ensure_python(">=3.5")

# Get our version
version = get_version(HERE.joinpath(name, "_version.py"))

nb_path = HERE.joinpath(name, "nbextension", "static")
js_path = HERE.joinpath("js")
lab_path = HERE.joinpath("js", "lab-dist")

# Representative files that should exist after a successful build
jstargets = [nb_path / "index.js", js_path / "lib" / "plugin.js"]

package_data_spec = {name: ["nbextension/static/*.*js*"]}

data_files_spec = [
    ("share/jupyter/nbextensions/jupyter-scales", nb_path, "*.js*"),
    ("share/jupyter/lab/extensions", lab_path, "*.tgz"),
    ('share/jupyter/labextensions/jupyter-scales', lab_path / 'jupyter-scales',
     '**/*.*'),
Esempio n. 17
0
jstargets = [
    os.path.join(HERE, namepy, "ui", "nbextension", "index.js"),
    os.path.join(HERE, namepy, "ui", "labextension", "package.json"),
]

builder = jp.npm_builder(os.path.join(HERE, namejs), build_cmd="build:prod")
cmdclass = jp.wrap_installers(
    pre_develop=builder,
    pre_dist=builder,
    ensured_targets=jstargets,
    skip_if_exists=jstargets,
)
setup_args = dict(
    name=namepy,
    description="A package for labeling image data quickly",
    version=jp.get_version(os.path.join(namepy, "version.py")),
    scripts=glob.glob(os.path.join("scripts", "*")),
    cmdclass=cmdclass,
    data_files=jp.get_data_files(
        data_specs=[
            ("share/jupyter/nbextensions/qslwidgets", "qsl/ui/nbextension", "**"),
            ("share/jupyter/labextensions/qslwidgets", "qsl/ui/labextension", "**"),
            ("share/jupyter/labextensions/qslwidgets", "qsl/ui/assets", "install.json"),
            ("etc/jupyter/nbconfig/notebook.d", "qsl/ui/assets", "qsl.json"),
        ]
    ),
    platforms="Linux, Mac OS X, Windows",
    keywords=["Jupyter", "Widgets", "IPython"],
    python_requires=">=3.6",
    entry_points="""
        [console_scripts]
Esempio n. 18
0
from setuptools import setup, find_packages
from codecs import open
from os import path

from jupyter_packaging import (create_cmdclass, install_npm, ensure_targets,
                               combine_commands, ensure_python, get_version)

pjoin = path.join

ensure_python(('2.7', '>=3.3'))

name = 'jupyterlab_powerpoint'
here = path.abspath(path.dirname(__file__))
jshere = path.join(here, 'js')
version = get_version(pjoin(here, name, '_version.py'))

with open(path.join(here, 'README.md'), encoding='utf-8') as f:
    long_description = f.read()

requires = [
    'jupyterlab>=1.0.0',
    'nbconvert>=5.5.0',
    'nbformat>=4.4.0',
    'python-pptx>=0.6.0',
]

dev_requires = requires + [
    'pytest', 'pytest-cov', 'pylint', 'flake8', 'bump2version', 'autopep8',
    'mock'
]
Esempio n. 19
0
    ensure_targets,
    combine_commands,
    get_version,
)

here = os.path.dirname(os.path.abspath(__file__))

log.set_verbosity(log.DEBUG)
log.info("setup.py entered")
log.info("$PATH=%s" % os.environ["PATH"])

name = "idom_jupyter"
LONG_DESCRIPTION = "A client for IDOM implemented using Jupyter widgets"

# Get idom_jupyter version
version = get_version(pjoin(name, "_version.py"))

js_dir = pjoin(here, "js")

# Representative files that should exist after a successful build
jstargets = [
    pjoin(js_dir, "dist", "index.js"),
]

data_files_spec = [
    (
        "share/jupyter/nbextensions/idom-client-jupyter",
        "idom_jupyter/nbextension",
        "*.*",
    ),
    (
Esempio n. 20
0
from jupyter_packaging import (
    create_cmdclass, install_npm, ensure_targets,
    combine_commands, get_version, skip_if_exists
)

name = 'ipytree'

here = os.path.dirname(os.path.abspath(__file__))
long_description = 'A Tree Widget using jsTree'

log.set_verbosity(log.DEBUG)
log.info('setup.py entered')
log.info('$PATH=%s' % os.environ['PATH'])

# Get ipytree version
version = get_version(os.path.join(name, '_version.py'))

js_dir = os.path.join(here, 'js')

# Representative files that should exist after a successful build
jstargets = [
    os.path.join('ipytree/nbextension', 'index.js'),
    os.path.join('ipytree/labextension', 'package.json'),
]

data_files_spec = [
    ('share/jupyter/nbextensions/ipytree', 'ipytree/nbextension', '**'),
    ('share/jupyter/labextensions/ipytree', 'ipytree/labextension', "**"),
    ('etc/jupyter/nbconfig/notebook.d', '.', 'ipytree.json'),
]
Esempio n. 21
0
from codecs import open
from os import path
from pathlib import Path
from setuptools import setup, find_packages
from subprocess import CalledProcessError

from jupyter_packaging import (
    combine_commands, command_for_func, create_cmdclass, ensure_python,
    ensure_targets, get_version, run
)

ensure_python(('2.7', '>=3.3'))

name = 'jupyter-fs'
here = path.abspath(path.dirname(__file__))
version = get_version(path.join(here, "jupyterfs", '_version.py'))

with open(path.join(here, 'README.md'), encoding='utf-8') as f:
    long_description = f.read()

requires = [
    'fs>=2.4.11',
    'fs-s3fs>=1.1.1',
    'jupyterlab>=2.0.0',
    'notebook>=5.7.0',
]

test_requires = [
    'boto3',
    'docker',
    'fs-miniofs',
Esempio n. 22
0
from jupyter_packaging import (
    create_cmdclass, install_npm, ensure_targets,
    combine_commands, ensure_python, get_version,
)
import setuptools

HERE = os.path.abspath(os.path.dirname(__file__))

# The name of the project
name = "rucio_jupyterlab"

# Ensure a valid python version
ensure_python(">=3.5")

# Get our version
version = get_version(os.path.join(name, "_version.py"))

lab_path = os.path.join(HERE, name, "labextension")

# Representative files that should exist after a successful build
jstargets = [
    os.path.join(HERE, "lib", "src", "index.js"),
]

package_data_spec = {
    name: [
        "*"
    ]
}

data_files_spec = [
Esempio n. 23
0
import os

from jupyter_packaging import (
    create_cmdclass,
    install_npm,
    ensure_targets,
    combine_commands,
    get_version,
    skip_if_exists,
)

LONG_DESCRIPTION = 'An ipywidget image widget for astronomical purposes'
here = os.path.dirname(os.path.abspath(__file__))
name = 'bqplot-image-gl'
package_name = name.replace('-', '_')
version = get_version(pjoin(package_name, '_version.py'))

js_dir = pjoin(here, 'js')

# Representative files that should exist after a successful build
jstargets = [
    pjoin('share', 'jupyter', 'nbextensions', f'{name}', 'index.js'),
    # pjoin('share', 'jupyter', 'labextensions', f'{name}', 'package.json'),
]

data_files_spec = [
    (f'share/jupyter/nbextensions/{name}',
     f'share/jupyter/nbextensions/{name}', '*.js'),
    (f'share/jupyter/labextensions/{name}/',
     f'share/jupyter/labextensions/{name}/', '**'),
    (f'etc/jupyter/nbconfig/notebook.d', f'etc/jupyter/nbconfig/notebook.d',