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

Feature test environment #31

Merged
merged 23 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions .github/actions/build-ext/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "Build"
garciagenrique marked this conversation as resolved.
Show resolved Hide resolved
runs:
using: "composite"
steps:
- name: Build the extension
run: |
set -eux
python -m pip install .
shell: bash

25 changes: 25 additions & 0 deletions .github/actions/post-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Post Test"
runs:
using: "composite"
steps:
- name: Install check-manifest
run: python -m pip install -U check-manifest
shell: bash
- name: Install Node (for Playwright)
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Install Playwright
run: npx playwright install
shell: bash
- name: extension checks
run: |
jupyter server extension list 2>&1 | grep -ie "rucio_jupyterlab.*OK"
jupyter labextension list 2>&1 | grep -ie "rucio-jupyterlab.*OK"
shell: bash
- name: Browser check
run: python -m jupyterlab.browser_check
shell: bash
- name: Check Manifest.in
run: check-manifest -v
shell: bash
40 changes: 40 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Setup"
runs:
using: "composite"
steps:
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '14.x'
garciagenrique marked this conversation as resolved.
Show resolved Hide resolved
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Setup pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-3.9-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.9-
pip-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
shell: bash
- name: Setup yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- name: Install Python dependencies
run: python -m pip install -r requirements.txt
shell: bash
- name: Install JS dependencies
run: jlpm
shell: bash

16 changes: 16 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Test"
runs:
using: "composite"
steps:
- name: Run ESLint
run: jlpm run eslint:check
shell: bash
- name: Run Jest
run: jlpm jest
shell: bash
- name: Run Pytest
run: pytest rucio_jupyterlab/tests/
shell: bash
- name: Run Pylint
run: pylint --fail-under=8.5 rucio_jupyterlab/
shell: bash
60 changes: 6 additions & 54 deletions .github/workflows/build-and-publish-tagged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,13 @@ jobs:
name: Build and Publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'
- name: Setup pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-3.8-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.8-
pip-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- name: Install Python dependencies
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- uses: ./.github/actions/test
- uses: ./.github/actions/build-ext
- uses: ./.github/actions/post-test
- name: Build sdist
run: |
python -m pip install -U jupyterlab~=3.1 check-manifest
python -m pip install -r requirements.txt
- name: Install JS dependencies
run: jlpm
- name: Run ESLint
run: jlpm run eslint:check
- name: Run Jest
run: jlpm jest
- name: Run Pytest
run: pytest rucio_jupyterlab/tests/
- name: Run Pylint
run: pylint --fail-under=8.5 rucio_jupyterlab/
- name: Build the extension
run: |
set -eux
python -m pip install .
jupyter server extension list 2>&1 | grep -ie "rucio_jupyterlab.*OK"
jupyter labextension list 2>&1 | grep -ie "rucio-jupyterlab.*OK"
python -m pip uninstall jupyter_server_terminals
python -m jupyterlab.browser_check

check-manifest -v

pip install build
python -m build --sdist
- name: Publish distribution to PyPI
Expand Down
64 changes: 6 additions & 58 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,67 +5,15 @@ on:
branches: master
pull_request:
branches: '*'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'
- name: Setup pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-3.8-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.8-
pip-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- name: Install Python dependencies
run: |
python -m pip install -U jupyterlab~=3.1 check-manifest
python -m pip install -r requirements.txt
- name: Install JS dependencies
run: jlpm
- name: Run ESLint
run: jlpm run eslint:check
- name: Run Jest
run: jlpm jest
- name: Run Pytest
run: pytest rucio_jupyterlab/tests/
- name: Run Pylint
run: pylint --fail-under=8.5 rucio_jupyterlab/
- name: Install Node (for Playwright)
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Install Playwright
run: npx playwright install
- name: Build the extension
run: |
set -eux
python -m pip install .
jupyter server extension list 2>&1 | grep -ie "rucio_jupyterlab.*OK"
jupyter labextension list 2>&1 | grep -ie "rucio-jupyterlab.*OK"
python -m jupyterlab.browser_check
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- uses: ./.github/actions/test
- uses: ./.github/actions/build-ext
- uses: ./.github/actions/post-test

check-manifest -v
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "rucio"]
path = docker/test_env/rucio
url = [email protected]:rucio/rucio.git
[submodule "docker/test_env/rucio"]
path = docker/test_env/rucio
url = https://github.com/rucio/rucio.git
2 changes: 1 addition & 1 deletion CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ Specifies the environment variable name containing the OIDC access token.
## IPython Kernel
To allow users to access the paths from within the notebook, a kernel extension must be enabled. The kernel resides in module `rucio_jupyterlab.kernels.ipython`.

To enable the extension, use `load_ext` IPython magic:
To enable the kernel extension from inside a notebook, use `load_ext` IPython magic:

```py
%load_ext rucio_jupyterlab.kernels.ipython
Expand Down
36 changes: 0 additions & 36 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ global-exclude .git
global-exclude .ipynb_checkpoints

exclude Dockerfile
exclude docker/*
recursive-exclude docker *
exclude jest.config.js
exclude requirements.txt
exclude rucio_jupyterlab/tests/*
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Rucio JupyterLab Extension

![Github Actions Status](https://github.com/rucio/jupyterlab-extension/workflows/Build/badge.svg)
[![Test](https://github.com/rucio/jupyterlab-extension/actions/workflows/test.yml/badge.svg)](https://github.com/rucio/jupyterlab-extension/actions/workflows/test.yml)
[![Build and Publish Extension](https://github.com/rucio/jupyterlab-extension/actions/workflows/build-and-publish-tagged.yml/badge.svg)](https://github.com/rucio/jupyterlab-extension/actions/workflows/build-and-publish-tagged.yml)

This is a JupyterLab extension that integrates with [Rucio - Scientific Data Management](https://github.com/rucio/rucio) to allow users to access some of Rucio's capabilities directly from the JupyterLab interface.

Expand Down Expand Up @@ -35,6 +36,14 @@ $ yum install epel-release
$ yum install gfal2-all gfal2-python voms-clients-java
```

To be able to access the paths from within the notebook, you need to add the following snippet in your IPython configuration (e.g. `~/.ipython/profile_default/ipython_kernel_config.py`).

```python
c.IPKernelApp.extensions = ['rucio_jupyterlab.kernels.ipython']
```

More details in the [IPython Kernel configuration](CONFIGURATION.md#ipython-kernel)

Restart your JupyterLab instance afterwards to load the server extension.

## Configuration
Expand Down
4 changes: 0 additions & 4 deletions docker/configure.sh

This file was deleted.

40 changes: 40 additions & 0 deletions docker/container/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM jupyter/docker-stacks-foundation:python-3.9
LABEL maintainer="Muhammad Aditya Hilmy <[email protected]>, Francesc Torradeflot <[email protected]>"

ENV CONTAINER_PURPOSE="test"
ARG NB_USER="jovyan"
ARG NB_UID="1000"
ARG NB_GID="100"

USER $NB_UID

RUN mamba install -y -n base -c conda-forge \
python-gfal2 \
nodejs=14 \
pip \
&& mamba clean --all -f -y

USER root

COPY . /rucio-jupyterlab
WORKDIR /rucio-jupyterlab

RUN fix-permissions /rucio-jupyterlab \
&& sed -i -e 's/\r$/\n/' /rucio-jupyterlab/docker/container/configure.sh

COPY docker/container/jupyter_server_config.py $HOME/.jupyter/jupyter_server_config.py
RUN fix-permissions $HOME/.jupyter
RUN mkdir -p /opt/rucio/etc \
&& chown -R ${NB_UID}:${NB_GID} /opt/rucio/etc

USER $NB_UID

RUN /rucio-jupyterlab/docker/container/install_extension.sh

ENV JUPYTER_ENABLE_LAB=yes

WORKDIR $HOME
ENTRYPOINT ["/rucio-jupyterlab/docker/container/docker-entrypoint.sh"]
CMD ["/rucio-jupyterlab/docker/container/configure.sh", "/rucio-jupyterlab/docker/container/start_notebook.sh"]

USER ${NB_UID}
Loading
Loading