Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to JupyterLab 3.0 RC #1063

Merged
merged 43 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1d1cff4
Inital lab 3 commit with sccessful build
ajbozarth Oct 17, 2020
0457f58
Removed built files and fixed gitignore and clean
ajbozarth Oct 20, 2020
25a7c18
initial changes for server
kevin-bates Oct 20, 2020
5a4c95f
Transition handler tests to jupyter-server pytest framework
kevin-bates Oct 21, 2020
bab2490
undo switch to federated build
ajbozarth Oct 21, 2020
61c5ed8
update to rc6
ajbozarth Oct 23, 2020
a992854
some clean up and fixes
ajbozarth Oct 26, 2020
c651179
remove elyra launcher to be reverted later
ajbozarth Oct 26, 2020
ad67c93
Merge branch 'master' into jupyterlab3
ajbozarth Oct 27, 2020
ca005e6
Install Latest JupyterLab pre-release
lresende Oct 28, 2020
b059d11
Fix jest tests (#1020)
marthacryan Nov 4, 2020
2e92395
Switch to use JupyterLab PathExt for path manipulation
lresende Oct 28, 2020
3f3f4b6
Update to JupyterLab rc7
lresende Nov 5, 2020
bf622af
disable launcher extension
ajbozarth Nov 5, 2020
8472226
Revert "remove elyra launcher to be reverted later"
ajbozarth Nov 5, 2020
2ba1e51
Switch to using pytest-jupyter plugin package
kevin-bates Nov 9, 2020
cd0394e
Merge branch 'master' into jupyterlab3
ajbozarth Nov 12, 2020
7def787
Merge, fix deprecation warning, remove debug.
kevin-bates Nov 12, 2020
667c608
temp update clean script to install with pre
ajbozarth Nov 12, 2020
7434436
re-enable flake8
ajbozarth Nov 12, 2020
a9af193
Merge branch 'jupyterlab3' into use-pytest-jupyter
kevin-bates Nov 12, 2020
ce03382
Add pytest-jupyter dependency
lresende Nov 14, 2020
3ac440a
Merge branch 'master'
lresende Nov 14, 2020
888afc3
Disable git integration test
lresende Nov 14, 2020
f418ad8
Update jupyterlab extension versions
lresende Nov 14, 2020
f657811
capture test failures
lresende Nov 14, 2020
3d8b6e3
Avoid duplicate runs which consume resource limits
lresende Nov 14, 2020
baa6eec
Merge branch 'master'
lresende Nov 16, 2020
f7f2993
Reduce test wait period
lresende Nov 17, 2020
0bd2ec6
Don't build on forks
lresende Nov 17, 2020
f28c3a1
Merge branch 'master'
lresende Nov 17, 2020
251692d
Merge branch 'master'
lresende Nov 18, 2020
6319696
Update setup.py
lresende Nov 18, 2020
81851df
Wait for filebrowser content before proceeding
lresende Nov 18, 2020
e24c3e2
Update cypress test configurations
lresende Nov 18, 2020
12089dc
Wait for dom element before testing
lresende Nov 18, 2020
122accf
Play with timeouts
lresende Nov 19, 2020
2455723
Disable videos
lresende Nov 19, 2020
244eb82
Fix metadata editor tags style
karlaspuldaro Nov 19, 2020
31af800
Update lab dependencies to rc10
karlaspuldaro Nov 19, 2020
cd91d5d
More updates to pipeline tests
lresende Nov 20, 2020
0ea5b9a
Merge branch 'master'
lresende Nov 20, 2020
397f6e9
Update lab3 build details
lresende Nov 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Elyra Tests (2.x)
name: Elyra Tests
on:
push:
branches: '*'
# push:
# branches: '*'
pull_request:
branches: '*'

Expand Down Expand Up @@ -40,7 +40,8 @@ jobs:
mkdir -p ~/.npm-global
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel notebook jupyterlab
python -m pip install --upgrade pip wheel jupyter_server
python -m pip install --upgrade --pre jupyterlab
- name: Log current Python dependencies version
run: |
pip freeze
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,6 @@ target/

tsconfig.tsbuildinfo
node_modules
static

.vscode/
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ install-ui: build-ui
$(call INSTALL_LAB_EXTENSION,python-editor)

install-external-extensions:
pip install --upgrade jupyterlab-git==$(GIT_VERSION)
jupyter labextension install --no-build @jupyterlab/toc@$(TOC_VERSION)
# pip install --upgrade jupyterlab-git==$(GIT_VERSION)

install: install-server install-ui install-external-extensions ## Build and install
jupyter lab build
Expand Down Expand Up @@ -142,8 +141,7 @@ dist-ui: build-ui
$(call PACKAGE_LAB_EXTENSION,metadata)
$(call PACKAGE_LAB_EXTENSION,pipeline-editor)
$(call PACKAGE_LAB_EXTENSION,python-editor)
cd dist && curl -o jupyterlab-git-$(GIT_VERSION).tgz $$(npm view @jupyterlab/git@$(GIT_VERSION) dist.tarball) && cd -
cd dist && curl -o jupyterlab-toc-$(TOC_VERSION).tgz $$(npm view @jupyterlab/toc@$(TOC_VERSION) dist.tarball) && cd -
# cd dist && curl -o jupyterlab-git-$(GIT_VERSION).tgz $$(npm view @jupyterlab/git@$(GIT_VERSION) dist.tarball) && cd -

release: dist-ui build-server ## Build wheel file for release

Expand Down
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,29 @@ pip install elyra==0.10.3 && jupyter lab build

via PyPi:
```bash
pip install --upgrade elyra && jupyter lab build
pip install --upgrade "elyra<2.0.0" && jupyter lab build
```

Note: Ubuntu and CentOS users may need to use `pip3 install elyra`

using Conda:
```bash
conda install -c conda-forge "elyra<2.0.0" && jupyter lab build
```


* [JupyterLab](https://github.com/jupyterlab/jupyterlab) 3.x is supported on **Elyra 2.0.0 and above**

via PyPi:
```bash
pip install --upgrade "elyra>=2.0.0" && jupyter lab build
```

Note: Ubuntu and CentOS users may need to use `pip3 install elyra`

using Conda:
```bash
conda install -c conda-forge elyra && jupyter lab build
conda install -c conda-forge "elyra>=2.0.0" && jupyter lab build
```

### Verify Installation
Expand Down
16 changes: 8 additions & 8 deletions docs/source/getting_started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Note: JupyterLab currently requires a re-build after installing any extension.
* [Python 3.x](https://www.python.org/downloads/)

Note: Elyra 1.0.0 and above require JupyterLab 2.x.
Note: Elyra 2.0.0 and above require JupyterLab 3.x.

### pip

Expand Down Expand Up @@ -102,10 +103,10 @@ Should output:
config dir: /usr/local/etc/jupyter
elyra enabled
- Validating...
elyra 1.5.0.dev0 OK
elyra 2.0.0.dev0 OK
jupyterlab enabled
- Validating...
jupyterlab 2.2.8 OK
jupyterlab 3.0.0rc10 OK
jupyterlab_git enabled
- Validating...
jupyterlab_git 0.23.1 OK
Expand All @@ -129,13 +130,12 @@ Should output:
```
Known labextensions:
app dir: /.../share/jupyter/lab
@elyra/code-snippet-extension v1.5.0-dev enabled OK*
@elyra/metadata-extension v1.5.0-dev enabled OK*
@elyra/pipeline-editor-extension v1.5.0-dev enabled OK*
@elyra/python-editor-extension v1.5.0-dev enabled OK*
@elyra/theme-extension v1.5.0-dev enabled OK*
@elyra/code-snippet-extension v2.0.0-dev enabled OK*
@elyra/metadata-extension v2.0.0-dev enabled OK*
@elyra/pipeline-editor-extension v2.0.0-dev enabled OK*
@elyra/python-editor-extension v2.0.0-dev enabled OK*
@elyra/theme-extension v2.0.0-dev enabled OK*
@jupyterlab/git v0.22.3 enabled OK
@jupyterlab/toc v4.0.0 enabled OK
nbdime-jupyterlab v2.0.0 enabled OK
```

Expand Down
7 changes: 4 additions & 3 deletions elyra/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
from ._version import __version__

from notebook.utils import url_path_join
from jupyter_server.utils import url_path_join

from .api.handlers import YamlSpecHandler
from .metadata.handlers import MetadataHandler, MetadataResourceHandler, SchemaHandler, SchemaResourceHandler, \
Expand All @@ -25,13 +25,14 @@
namespace_regex = r"(?P<namespace>[\w\.\-]+)"
resource_regex = r"(?P<resource>[\w\.\-]+)"

def _jupyter_server_extension_paths():

def _jupyter_server_extension_points():
return [{
"module": "elyra"
}]


def load_jupyter_server_extension(nb_server_app):
def _load_jupyter_server_extension(nb_server_app):
web_app = nb_server_app.web_app
host_pattern = '.*$'
web_app.add_handlers(host_pattern, [
Expand Down
2 changes: 1 addition & 1 deletion elyra/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = '1.5.0.dev0'
__version__ = '2.0.0.dev0'
2 changes: 1 addition & 1 deletion elyra/api/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#
import os

from notebook.base.handlers import APIHandler
from jupyter_server.base.handlers import APIHandler
from tornado import web


Expand Down
4 changes: 2 additions & 2 deletions elyra/metadata/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#

from jsonschema import ValidationError
from jupyter_server.base.handlers import APIHandler
from jupyter_server.utils import url_unescape, url_path_join
from tornado import web
from notebook.base.handlers import APIHandler
from notebook.utils import url_unescape, url_path_join

from .error import MetadataNotFoundError, MetadataExistsError, SchemaNotFoundError
from .metadata import Metadata
Expand Down
110 changes: 24 additions & 86 deletions elyra/metadata/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,105 +13,41 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os
import pytest
import sys
from traitlets.config import Config
import jupyter_core.paths

from notebook.utils import url_path_join
from tornado.escape import url_escape
from elyra.metadata import MetadataManager, SchemaManager, METADATA_TEST_NAMESPACE # noqa: F401

from .test_utils import valid_metadata_json, invalid_metadata_json, another_metadata_json, byo_metadata_json, \
invalid_json, create_json_file, create_instance


# BEGIN - Remove once transition to jupyter_server occurs
def mkdir(tmp_path, *parts):
path = tmp_path.joinpath(*parts)
if not path.exists():
path.mkdir(parents=True)
return path


config = pytest.fixture(lambda: {'NotebookApp': {"nbserver_extensions": {"elyra": True}}})
home_dir = pytest.fixture(lambda tmp_path: mkdir(tmp_path, "home"))
data_dir = pytest.fixture(lambda tmp_path: mkdir(tmp_path, "data"))
config_dir = pytest.fixture(lambda tmp_path: mkdir(tmp_path, "config"))
runtime_dir = pytest.fixture(lambda tmp_path: mkdir(tmp_path, "runtime"))
root_dir = pytest.fixture(lambda tmp_path: mkdir(tmp_path, "root_dir"))
template_dir = pytest.fixture(lambda tmp_path: mkdir(tmp_path, "templates"))
system_jupyter_path = pytest.fixture(lambda tmp_path: mkdir(tmp_path, "share", "jupyter"))
env_jupyter_path = pytest.fixture(lambda tmp_path: mkdir(tmp_path, "env", "share", "jupyter"))
system_config_path = pytest.fixture(lambda tmp_path: mkdir(tmp_path, "etc", "jupyter"))
env_config_path = pytest.fixture(lambda tmp_path: mkdir(tmp_path, "env", "etc", "jupyter"))
# These location fixtures will need to be revisited once we support multiple metadata storage types.
namespace_location = pytest.fixture(lambda jp_data_dir:
mkdir(jp_data_dir, "metadata", METADATA_TEST_NAMESPACE))
bogus_location = pytest.fixture(lambda jp_data_dir:
mkdir(jp_data_dir, "metadata", "bogus"))
shared_location = pytest.fixture(lambda jp_system_jupyter_path:
mkdir(jp_system_jupyter_path, "metadata", METADATA_TEST_NAMESPACE))
factory_location = pytest.fixture(lambda jp_env_jupyter_path:
mkdir(jp_env_jupyter_path, "metadata", METADATA_TEST_NAMESPACE))


@pytest.fixture
def environ(
monkeypatch,
tmp_path,
home_dir,
data_dir,
config_dir,
runtime_dir,
root_dir,
system_jupyter_path,
system_config_path,
env_jupyter_path,
env_config_path,
):
monkeypatch.setenv("HOME", str(home_dir))
monkeypatch.setenv("PYTHONPATH", os.pathsep.join(sys.path))
monkeypatch.setenv("JUPYTER_NO_CONFIG", "1")
monkeypatch.setenv("JUPYTER_CONFIG_DIR", str(config_dir))
monkeypatch.setenv("JUPYTER_DATA_DIR", str(data_dir))
monkeypatch.setenv("JUPYTER_RUNTIME_DIR", str(runtime_dir))
monkeypatch.setenv("METADATA_TESTING", "1") # enable metadata-tests namespace
monkeypatch.setattr(jupyter_core.paths, "SYSTEM_JUPYTER_PATH", [str(system_jupyter_path)])
monkeypatch.setattr(jupyter_core.paths, "ENV_JUPYTER_PATH", [str(env_jupyter_path)])
monkeypatch.setattr(jupyter_core.paths, "SYSTEM_CONFIG_PATH", [str(system_config_path)])
monkeypatch.setattr(jupyter_core.paths, "ENV_CONFIG_PATH", [str(env_config_path)])


# This method simulates the fetch pytest fixture defined in
# https://github.com/jupyter/jupyter_server/blob/master/jupyter_server/pytest_plugin.py
# It can be removed once the project transitions to using a jupyter server base.
# To convert the caller to use the jupyter_server form of fetch, remove the first
# parameter `self.request`.
def fetch(request, *parts, **kwargs):
# Handle URL strings

# Since base_url is already escaped, unescape it.
path = url_escape(url_path_join(*parts), plus=False)

# Make request.
method = 'GET'
if 'method' in kwargs and kwargs['method']:
method = kwargs['method']

body = None
if 'body' in kwargs and kwargs['body']:
body = kwargs['body']

return request(method, path, data=body)
# END - Remove once transition to jupyter_server occurs


# These location fixtures will need to be revisited once we support multiple metadata storage types.
namespace_location = pytest.fixture(lambda data_dir:
mkdir(data_dir, "metadata", METADATA_TEST_NAMESPACE))
bogus_location = pytest.fixture(lambda data_dir:
mkdir(data_dir, "metadata", "bogus"))
shared_location = pytest.fixture(lambda system_jupyter_path:
mkdir(system_jupyter_path, "metadata", METADATA_TEST_NAMESPACE))
factory_location = pytest.fixture(lambda env_jupyter_path:
mkdir(env_jupyter_path, "metadata", METADATA_TEST_NAMESPACE))
def setup_data(namespace_location):
create_json_file(namespace_location, 'valid.json', valid_metadata_json)
create_json_file(namespace_location, 'another.json', another_metadata_json)
create_json_file(namespace_location, 'invalid.json', invalid_metadata_json)


@pytest.fixture
def setup_hierarchy(environ, factory_location):
def setup_hierarchy(jp_environ, factory_location):
# Only populate factory info
byo_instance = byo_metadata_json
byo_instance['display_name'] = 'factory'
Expand All @@ -127,7 +63,7 @@ def store_manager(tests_manager):

@pytest.fixture(params=["elyra.metadata.storage.FileMetadataStore",
"elyra.metadata.tests.MockMetadataStore"]) # Add types as needed
def tests_manager(environ, namespace_location, request):
def tests_manager(jp_environ, namespace_location, request):
metadata_mgr = MetadataManager(namespace=METADATA_TEST_NAMESPACE, metadata_store_class=request.param)
store_mgr = metadata_mgr.metadata_store
create_instance(store_mgr, namespace_location, 'valid', valid_metadata_json)
Expand All @@ -149,11 +85,13 @@ def schema_manager():
SchemaManager.clear_instance()


# FIXME - this is not tested. Revisit once transition to jupyter_server occurs
# Set Elyra server extension as enabled (overriding server_config fixture from jupyter_server)
@pytest.fixture
def init_elyra(configurable_serverapp, argv):
app = configurable_serverapp(config=Config({'NotebookApp': {"nbserver_extensions": {"elyra": True}}}), argv=argv)
yield app
app.remove_server_info_file()
app.remove_browser_open_file()
app.cleanup_kernels()
def jp_server_config():
return {
"ServerApp": {
"jpserver_extensions": {
"elyra": True
}
}
}
Loading