Skip to content
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
113 changes: 56 additions & 57 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,78 +15,77 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- 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"
- name: Install dependencies
run: python -m pip install -U "jupyterlab>=4.0.0,<5"

- name: Lint the extension
run: |
set -eux
jlpm
jlpm run lint:check
- name: Lint the extension
run: |
set -eux
jlpm
jlpm run lint:check

- name: Build the extension
run: |
set -eux
python -m pip install .[test]
- name: Build the extension
run: |
set -eux
python -m pip install .[test]

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

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

- name: Package the extension
run: |
set -eux
- name: Package the extension
run: |
set -eux

pip install build
python -m build
pip uninstall -y "nbvv" jupyterlab
pip install build
python -m build
pip uninstall -y "nbvv" jupyterlab

- name: Upload extension packages
uses: actions/upload-artifact@v3
with:
name: extension-artifacts
path: dist/nbvv*
if-no-files-found: error
- name: Upload extension packages
uses: actions/upload-artifact@v4
with:
name: extension-artifacts
path: dist/nbvv*
if-no-files-found: error

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

steps:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
architecture: 'x64'
- uses: actions/download-artifact@v3
with:
name: extension-artifacts
- 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 "jupyterlab>=4.0.0,<5" nbvv*.whl


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

jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "nbvv.*OK"
python -m jupyterlab.browser_check --no-browser-test

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
architecture: 'x64'
- uses: actions/download-artifact@v4
with:
name: extension-artifacts
- 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 "jupyterlab>=4.0.0,<5" nbvv*.whl


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

jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "nbvv.*OK"
python -m jupyterlab.browser_check --no-browser-test

check_links:
name: Check Links
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Distributions
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: nbvv-releaser-dist-${{ github.run_number }}
path: .jupyter_releaser_checkout/dist
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ jupyter labextension develop . --overwrite
jlpm build
```

During development it may sometimes be useful to do some manual cleanup:

```bash
rm -rf node_modules
rm -rf yarn.lock
jlpm install
jlpm build
```
Comment on lines +79 to +86

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can think of some other repos that could use this


You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.

```bash
Expand Down
1 change: 0 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ Here is a summary of the steps to cut a new release:
- If the repo generates PyPI release(s), create a scoped PyPI [token](https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#saving-credentials-on-github). We recommend using a scoped token for security reasons.

- You can store the token as `PYPI_TOKEN` in your fork's `Secrets`.

- Advanced usage: if you are releasing multiple repos, you can create a secret named `PYPI_TOKEN_MAP` instead of `PYPI_TOKEN` that is formatted as follows:

```text
Expand Down
8 changes: 4 additions & 4 deletions examples/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
],
"source": [
"import numpy\n",
"from aicsimageio import AICSImage\n",
"from bioio import BioImage\n",
"import nbvv\n",
"image = AICSImage(\"AICS-10_5_5.ome.tif\")\n",
"image = BioImage(\"AICS-10_5_5.ome.tif\")\n",
"imgdata = image.get_image_data(\"CZYX\", T=0)\n",
"imgdata.shape"
]
Expand All @@ -33,7 +33,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "14d9e3e11aed4e0cb6860a4c5797be66",
"model_id": "c0100108126a4cd98d505c060f15c644",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -74,7 +74,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.12.4"
}
},
"nbformat": 4,
Expand Down
22 changes: 12 additions & 10 deletions nbvv/img_prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,19 @@ def atlas_dimensions(
"sizeY": tile_height,
"sizeZ": stack_height,
"sizeC": aics_image.shape[0],
"physicalPixelSize": physical_pixel_size if physical_pixel_size is not None else [1, 1, 1],
"physicalPixelSize": (
physical_pixel_size if physical_pixel_size is not None else [1, 1, 1]
),
"spatialUnit": "µm",
"channelNames": (
"channelNames": (
channel_names
if channel_names is not None
else ["CH_" + str(i) for i in range(aics_image.shape[0])]
),
}

# "originalSize": [aics_image.shape[3], aics_image.shape[2], aics_image.shape[1]],

return dims


Expand All @@ -118,7 +120,7 @@ def img_prep(img, shape=(128, 128)):

# C Z Y X
response = numpy.zeros(
(channels, img.shape[1], shape[1], shape[0]), dtype=numpy.uint8
(channels, img.shape[1], shape[1], shape[0]), dtype=img.dtype
)

for channel_index in range(channels):
Expand All @@ -127,11 +129,11 @@ def img_prep(img, shape=(128, 128)):

resized_channel = resize(channel_data, (shape[0], shape[1]))

mn = min(0, resized_channel.min())
mx = resized_channel.max()
resized_channel = 255.0 * (resized_channel - mn) / (mx - mn)
# atlas = np.interp(atlas, (min(0, atlas.min()), atlas.max()), (0.0, 255.0))
resized_channel = resized_channel.astype(numpy.uint8)
# mn = min(0, resized_channel.min())
# mx = resized_channel.max()
# resized_channel = 255.0 * (resized_channel - mn) / (mx - mn)

# resized_channel = resized_channel.astype(numpy.uint8)
Comment on lines +132 to +136

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why this is retained?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I suppose we can just delete it


response[channel_index] = resized_channel

Expand Down
4 changes: 2 additions & 2 deletions nbvv/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import nbvv.img_prep
import numpy
import traitlets
from typing import List, Tuple
from typing import List, Tuple, Optional

# use this line if we are keeping package.json version up to date:
semver_range_frontend = "~" + nbvv._version.__version__
Expand Down Expand Up @@ -39,7 +39,7 @@ def volshow(
spacing: Tuple[float, float, float] = (1.0, 1.0, 1.0),
density: float = 0.1,
brightness: float = 1.0,
channel_names: List[str] = None,
channel_names: Optional[List[str]] = None,
viewer_height: int = 500,
):
"""
Expand Down
18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
"src/**/*.{ts,tsx}"
],
"type": "module",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"repository": {
Expand Down Expand Up @@ -55,15 +56,15 @@
"watch:labextension": "jupyter labextension watch ."
},
"dependencies": {
"@aics/web-3d-viewer": "^2.9.0",
"@aics/vole-app": "^2.13.5",
"@babel/runtime": "7.24.1",
"@jupyter-widgets/base": "^6.0.7",
"@jupyterlab/application": "^4.0.0",
"@jupyterlab/coreutils": "^6.0.0",
"@jupyterlab/services": "^7.0.0",
"antd": "^5.16.2",
"react": "^18.x",
"react-dom": "^18.x"
"react-dom": "^18.x",
"three": "^0.171.0"
},
"devDependencies": {
"@jupyterlab/builder": "^4.0.0",
Expand Down Expand Up @@ -93,11 +94,12 @@
"stylelint-config-standard": "^34.0.0",
"stylelint-csstree-validator": "^3.0.0",
"stylelint-prettier": "^4.0.0",
"typescript": "~5.0.2",
"typescript": "~5.8.3",
"webpack": "^5.101.0",
"yjs": "^13.5.0"
},
"resolutions": {
"d3-selection": "1.3.0"
"d3-selection": "3"
},
"publishConfig": {
"access": "public"
Expand All @@ -114,13 +116,15 @@
}
},
"extension": true,
"outputDir": "nbvv/labextension"
"outputDir": "nbvv/labextension",
"webpackConfig": "./webpack.config.cjs"
},
"eslintIgnore": [
"node_modules",
"dist",
"coverage",
"**/*.d.ts"
"**/*.d.ts",
"webpack.config.cjs"
],
"eslintConfig": {
"extends": [
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as base from '@jupyter-widgets/base';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const semver_range = require('../package.json').version;

import * as jupyter_volume from './view';
import * as jupyter_volume from './view.js';

/**
* Initialization data for the nbvv extension.
Expand Down
Loading