Skip to content

Commit 46e1b09

Browse files
authored
Release 0.13.2 (#344)
* Release 0.13.2 * Run black * Remove mentions to nbextension * Fix import * Update ui-test deps * Update ui-tests * Update snapshots
1 parent b5cf121 commit 46e1b09

19 files changed

+988
-707
lines changed

.github/workflows/main.yml

-3
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@ jobs:
121121
test -f $CONDA_PREFIX/share/jupyter/labextensions/ipycanvas/package.json
122122
test -d $CONDA_PREFIX/share/jupyter/labextensions/ipycanvas/static
123123
124-
- name: Validate the nbextension
125-
run: jupyter nbextension list 2>&1 | grep "ipycanvas/extension"
126-
127124
- name: Validate the labextension
128125
run: jupyter labextension list 2>&1 | grep ipycanvas
129126

.github/workflows/update_galata_references.yml

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
- name: Configure git to use https
2828
run: git config --global hub.protocol https
2929

30+
- name: Install hub
31+
run: sudo apt-get update && sudo apt-get install -y hub
32+
3033
- name: Checkout the branch from the PR that triggered the job
3134
run: hub pr checkout ${{ github.event.issue.number }}
3235
env:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ $RECYCLE.BIN/
146146

147147
**/node_modules/
148148
ipycanvas/nbextension/static/index.*
149+
.yarn
149150

150151
# Coverage data
151152
# -------------

docs/conf.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
html_theme = "pydata_sphinx_theme"
2121
htmlhelp_basename = "ipycanvasdoc"
2222

23-
html_theme_options = dict(github_url="https://github.com/jupyter-widgets-contrib/ipycanvas")
23+
html_theme_options = dict(
24+
github_url="https://github.com/jupyter-widgets-contrib/ipycanvas"
25+
)
2426

2527
html_static_path = ["_static"]
2628

docs/installation.rst

+2-22
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,18 @@ Using conda
1717
1818
conda install -c conda-forge ipycanvas
1919
20-
JupyterLab extension
21-
--------------------
22-
23-
If you have JupyterLab, you will also need to install the JupyterLab extension. In order to install the JupyterLab extension,
24-
you will need ``npm`` to be installed. You can easily install ``npm`` with conda:
25-
26-
.. code:: bash
27-
28-
conda install -c conda-forge nodejs
29-
30-
Then you can install the JupyterLab extension:
31-
32-
.. code:: bash
33-
34-
jupyter labextension install @jupyter-widgets/jupyterlab-manager ipycanvas
35-
3620
Development installation
3721
------------------------
3822

39-
For a development installation (requires npm):
23+
For a development installation (requires npm and jupyterlab):
4024

4125
.. code:: bash
4226
4327
git clone https://github.com/jupyter-widgets-contrib/ipycanvas.git
4428
cd ipycanvas
4529
pip install -e .
4630
47-
# If you are developing on the classic Jupyter Notebook
48-
jupyter nbextension install --py --symlink --sys-prefix ipycanvas
49-
jupyter nbextension enable --py --sys-prefix ipycanvas
50-
51-
# If you are developing on JupyterLab
31+
# Installing the JupyterLab extension
5232
jupyter labextension develop . --overwrite
5333
jlpm run build
5434

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ channels:
33
- conda-forge
44
dependencies:
55
- jupyterlab=3
6-
- ipycanvas=0.13.1
6+
- ipycanvas=0.13.2
77
- ipyevents
88
- branca

examples/py3d_engine/py3d_engine.py

+28-20
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,45 @@ def normalize(vec):
1313
def project_vector(x, y, z, matrix):
1414
vec = np.dot(matrix, pad_ones(x, y, z))
1515

16-
return vec[0]/vec[3], vec[1]/vec[3], vec[2]/vec[3]
16+
return vec[0] / vec[3], vec[1] / vec[3], vec[2] / vec[3]
1717

1818

1919
def get_look_at_matrix(eye, center, up):
2020
n = normalize(eye - center)
2121
u = normalize(np.cross(up, n))
2222
v = np.cross(n, u)
2323

24-
matrix_r = [[u[0], u[1], u[2], 0],
25-
[v[0], v[1], v[2], 0],
26-
[n[0], n[1], n[2], 0],
27-
[0, 0, 0, 1]]
24+
matrix_r = [
25+
[u[0], u[1], u[2], 0],
26+
[v[0], v[1], v[2], 0],
27+
[n[0], n[1], n[2], 0],
28+
[0, 0, 0, 1],
29+
]
2830

29-
matrix_t = [[1, 0, 0, -eye[0]],
30-
[0, 1, 0, -eye[1]],
31-
[0, 0, 1, -eye[2]],
32-
[0, 0, 0, 1]]
31+
matrix_t = [
32+
[1, 0, 0, -eye[0]],
33+
[0, 1, 0, -eye[1]],
34+
[0, 0, 1, -eye[2]],
35+
[0, 0, 0, 1],
36+
]
3337

3438
return np.dot(matrix_r, matrix_t)
3539

3640

3741
def get_perspective_matrix(fovy, aspect, near, far):
38-
f = 1. / tan(fovy * pi / 360.)
42+
f = 1.0 / tan(fovy * pi / 360.0)
3943

40-
return np.array([
41-
[f/aspect, 0, 0, 0],
42-
[ 0, f, 0, 0],
43-
[ 0, 0, (near + far)/(near - far), 2 * near * far/(near - far)],
44-
[ 0, 0, -1, 0]
45-
])
44+
return np.array(
45+
[
46+
[f / aspect, 0, 0, 0],
47+
[0, f, 0, 0],
48+
[0, 0, (near + far) / (near - far), 2 * near * far / (near - far)],
49+
[0, 0, -1, 0],
50+
]
51+
)
4652

4753

48-
class OrbitCamera():
54+
class OrbitCamera:
4955

5056
def __init__(self, radius, center, aspect, near=0, far=8):
5157
self.radius = radius
@@ -60,7 +66,7 @@ def update_position(self, elev, azim):
6066
self.elev = elev
6167
self.azim = azim
6268

63-
relev, razim = np.pi * self.elev/180, np.pi * self.azim/180
69+
relev, razim = np.pi * self.elev / 180, np.pi * self.azim / 180
6470

6571
xp = self.center[0] + cos(razim) * cos(relev) * self.radius
6672
yp = self.center[1] + sin(razim) * cos(relev) * self.radius
@@ -69,7 +75,7 @@ def update_position(self, elev, azim):
6975
self.position = np.array((xp, yp, zp))
7076
self.front = self.center - self.position
7177

72-
if abs(relev) > pi / 2.:
78+
if abs(relev) > pi / 2.0:
7379
self.up = np.array((0, 0, -1))
7480
else:
7581
self.up = np.array((0, 0, 1))
@@ -78,5 +84,7 @@ def update_position(self, elev, azim):
7884

7985
def update_matrix(self):
8086
self.view_matrix = get_look_at_matrix(self.position, self.center, self.up)
81-
self.projection_matrix = get_perspective_matrix(50, self.aspect, self.near, self.far)
87+
self.projection_matrix = get_perspective_matrix(
88+
50, self.aspect, self.near, self.far
89+
)
8290
self.matrix = np.dot(self.projection_matrix, self.view_matrix)

ipycanvas/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
# Copyright (c) Martin Renou.
55
# Distributed under the terms of the Modified BSD License.
66

7-
__version__ = "0.13.1"
7+
__version__ = "0.13.2"

ipycanvas/utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Binary module."""
2+
23
from io import BytesIO
34

45
from PIL import Image as PILImage

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ipycanvas",
3-
"version": "0.13.1",
3+
"version": "0.13.2",
44
"description": "Interactive widgets library exposing the browser's Canvas API",
55
"keywords": [
66
"jupyter",
@@ -59,7 +59,7 @@
5959
"roughjs": "^4.3.1"
6060
},
6161
"devDependencies": {
62-
"@jupyterlab/builder": "^4",
62+
"@jupyterlab/builder": "^3 || ^4",
6363
"@types/node": "^10.11.6",
6464
"@types/webpack-env": "^1.13.6",
6565
"@typescript-eslint/eslint-plugin": "^4.8.1",

pyproject.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[build-system]
22
requires = [
33
"hatchling",
4-
"jupyterlab==4.*",
4+
"jupyterlab>=3,<5",
55
]
66
build-backend = "hatchling.build"
77

@@ -24,17 +24,18 @@ classifiers = [
2424
"License :: OSI Approved :: BSD License",
2525
"Programming Language :: Python",
2626
"Programming Language :: Python :: 3",
27-
"Programming Language :: Python :: 3.7",
2827
"Programming Language :: Python :: 3.8",
2928
"Programming Language :: Python :: 3.9",
3029
"Programming Language :: Python :: 3.10",
30+
"Programming Language :: Python :: 3.11",
31+
"Programming Language :: Python :: 3.12",
3132
]
3233
dependencies = [
3334
"ipywidgets>=7.6.0,<9",
3435
"numpy",
3536
"pillow>=6.0",
3637
]
37-
version = "0.13.1"
38+
version = "0.13.2"
3839

3940
[project.license]
4041
file = "LICENSE.txt"

ui-tests/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
},
1212
"author": "ipycanvas",
1313
"license": "Apache-2.0",
14+
"dependencies": {
15+
"@jupyterlab/galata": "^5.0.0",
16+
"klaw-sync": "^6.0.0",
17+
"rimraf": "^3.0.2"
18+
},
1419
"devDependencies": {
15-
"@jupyterlab/galata": "^5.0.1",
1620
"@playwright/test": "^1.32.0"
17-
},
18-
"dependencies": {
19-
"@types/klaw-sync": "^6.0.1",
20-
"klaw-sync": "^6.0.0"
2121
}
2222
}

ui-tests/tests/ipycanvas.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// Copyright (c) Jupyter Development Team.
22
// Distributed under the terms of the Modified BSD License.
33

4-
import { IJupyterLabPageFixture, test } from '@jupyterlab/galata';
5-
import { expect } from '@playwright/test';
4+
import { expect, IJupyterLabPageFixture, test } from '@jupyterlab/galata';
65
import * as path from 'path';
76
const klaw = require('klaw-sync');
87

Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)