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

EBR-91: Migrate tvb-ext-unicore to Jupyter4 and Python3.11 #29

Merged
merged 15 commits into from
Sep 11, 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
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

40 changes: 0 additions & 40 deletions .eslintrc.js

This file was deleted.

103 changes: 63 additions & 40 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,100 +7,123 @@ on:
pull_request:
types: [opened, synchronize, reopened]


jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
python-version: [ "3.8", "3.11", "3.12" ]

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install dependencies
run: python -m pip install -U "jupyterlab>=4.0.0,<5" check-manifest pyunicore pytest pytest-mock build

- name: Install Node.js dependencies
run: jlpm install

- name: Test the extension with jlpm
run: |
python -m pip install -U jupyterlab~=3.6 check-manifest pyunicore pytest pytest-mock pytest-cov
set -eux
jlpm run test

- name: Build the extension
env:
CLB_AUTH: 'TEST_TOKEN'
run: |
set -eux
jlpm
jlpm run eslint:check
python -m pip install .
jlpm run build
python -m pip install .[test]

jupyter server extension list 2>&1 | grep -ie "tvbextunicore.*OK"

jupyter labextension list 2>&1 | grep -ie "tvb-ext-unicore.*OK"
python -m jupyterlab.browser_check

check-manifest -v

pip install build
python -m build --sdist
cp dist/*.tar.gz myextension.tar.gz
pip uninstall -y "tvb-ext-unicore" jupyterlab
rm -rf myextension

- name: Run tests
- name: Run Python & JS tests
run: |
set -eux
pytest tvbextunicore -r ap

- name: Compute coverage
run: |
pytest -v --cov --cov-report=xml

- name: Run JS tests
run: |
yarn test

- name: Compute JS coverage
- name: Package the extension
run: |
yarn test --coverage
set -eux

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
pip install build
python -m build
pip uninstall -y "tvb-ext-unicore" jupyterlab

- uses: actions/upload-artifact@v3
- name: Upload extension packages
uses: actions/upload-artifact@v4
with:
name: myextension-sdist
path: myextension.tar.gz
name: extension-artifacts-${{ matrix.python-version }}
path: dist/tvbextunicore*
if-no-files-found: error

sonar_cloud:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install dependencies
run: python -m pip install -U "jupyterlab>=4.0.0,<5" check-manifest pyunicore pytest pytest-mock pytest-cov

- name: Compute coverage
run: |
python -m pip install .[test]
pytest -v --cov --cov-report=xml
yarn test --coverage

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

test_isolated:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.11'
architecture: 'x64'
- uses: actions/download-artifact@v3

- uses: actions/download-artifact@v4
with:
name: myextension-sdist
name: extension-artifacts-3.11

- name: Install and Test
run: |
set -eux
# Remove NodeJS, twice to take care of system and locally installed node versions.
sudo rm -rf $(which node)
sudo rm -rf $(which node)
pip install --upgrade pip
pip install myextension.tar.gz
pip install jupyterlab==3.6.5
jupyter labextension list

pip install "jupyterlab>=4.0.0,<5" tvbextunicore*.whl

jupyter server extension list 2>&1 | grep -ie "tvbextunicore.*OK"
jupyter labextension list 2>&1 | grep -ie "tvb-ext-unicore.*OK"
python -m jupyterlab.browser_check --no-chrome-test
python -m jupyterlab.browser_check --no-browser-test
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
*.bundle.*
lib/
node_modules/
*.log
.eslintcache
.stylelintcache
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo
tvbextunicore/labextension
# Version file is handled by hatchling
tvbextunicore/_version.py

# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python
Expand Down Expand Up @@ -112,4 +117,6 @@ dmypy.json
.DS_Store
/.idea/

.tvb_ext_unicore.log*
.tvb_ext_unicore.log*
# Yarn cache
.yarn/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
**/node_modules
**/lib
**/package.json
!/package.json
tvbextunicore
5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
enableImmutableInstalls: false
nodeLinker: node-modules
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

<!-- <START NEW CHANGELOG ENTRY> -->

<!-- <END NEW CHANGELOG ENTRY> -->
30 changes: 0 additions & 30 deletions MANIFEST.in

This file was deleted.

43 changes: 40 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ EBRAINS Lab and keep it in an environment variable called **CLB_AUTH**.

## Requirements

* JupyterLab version 3
* JupyterLab version >= 4
* pyunicore >= 1.0

## Install
Expand Down Expand Up @@ -123,8 +123,45 @@ In development mode, you will also need to remove the symlink created by `jupyte
command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
folder is located. Then you can remove the symlink named `tvb-ext-unicore` within that folder.

### Acknowledgments

### Testing the extension

#### Server tests

This extension is using [Pytest](https://docs.pytest.org/) for Python code testing.

Install test dependencies (needed only once):

```sh
pip install -e ".[test]"
# Each time you install the Python package, you need to restore the front-end extension link
jupyter labextension develop . --overwrite
```

To execute them, run:

```sh
pytest -vv -r ap --cov tvbextunicore
```

#### Frontend tests

This extension is using [Jest](https://jestjs.io/) for JavaScript code testing.

To execute them, execute:

```sh
jlpm
jlpm test
```

### Packaging the extension

See [RELEASE](RELEASE.md)

## Acknowledgments

This project has received funding from the European Union’s Horizon 2020 Framework Programme for Research and Innovation under the Specific Grant Agreement No. 945539 (Human Brain Project SGA3).

This project has received funding from the European Union’s Horizon Europe Programme under the Specific Grant Agreement No. 101147319 (EBRAINS 2.0 Project).
This project has received funding from the European Union’s Horizon Europe Programme under the Specific Grant Agreement No. 101147319 (EBRAINS 2.0 Project).

Loading