pyviewarr 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyviewarr-0.2.0/.gitignore +14 -0
- pyviewarr-0.2.0/LICENSE +7 -0
- pyviewarr-0.2.0/PKG-INFO +81 -0
- pyviewarr-0.2.0/README.md +67 -0
- pyviewarr-0.2.0/pyproject.toml +41 -0
- pyviewarr-0.2.0/src/pyviewarr/__init__.py +526 -0
- pyviewarr-0.2.0/src/pyviewarr/static/widget.css +1 -0
- pyviewarr-0.2.0/src/pyviewarr/static/widget.js +48 -0
pyviewarr-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2026 Joseph D. Long
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
pyviewarr-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyviewarr
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
License-File: LICENSE
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Requires-Dist: anywidget<0.10,>=0.9
|
|
7
|
+
Requires-Dist: numpy<3,>=2.0
|
|
8
|
+
Provides-Extra: dev
|
|
9
|
+
Requires-Dist: jupyterlab; extra == 'dev'
|
|
10
|
+
Requires-Dist: matplotlib>=3.5; extra == 'dev'
|
|
11
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
12
|
+
Requires-Dist: watchfiles; extra == 'dev'
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# pyviewarr
|
|
16
|
+
|
|
17
|
+
A faster, more intuitive way to explore 2D data (i.e. monochromatic images) in Python notebooks.
|
|
18
|
+
|
|
19
|
+
- Server-side slicing — view 1 MB of a 100 GB data cube without downloading 100 GB of data
|
|
20
|
+
- Interactive re-stretching by right-clicking and dragging in X and Y (inspired by [ds9](https://sites.google.com/cfa.harvard.edu/saoimageds9))
|
|
21
|
+
- Stepper buttons for moving along the leading axes of N-D data where N > 2
|
|
22
|
+
- Linear, log, and symmetric linear (i.e. centered at zero with `vmin == -vmax`) scales
|
|
23
|
+
- Panning and zooming (`0` key resets, `-` zooms out, `=` zooms in)
|
|
24
|
+
- A few good colormaps
|
|
25
|
+
|
|
26
|
+
_Clanker code disclaimer: written in collaboration with Anthropic's Claude LLM. Use at your own risk._
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
pip install pyviewarr
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
or with [uv](https://github.com/astral-sh/uv):
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
uv add pyviewarr
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Development
|
|
41
|
+
|
|
42
|
+
Be sure to clone with `git clone --recurse-submodules` (or, if you cloned first and **then** read this, `git submodule update --init --recursive` to initialize an existing clone).
|
|
43
|
+
|
|
44
|
+
The frontend part of the widget (i.e. `viewarr` itself) is written in Rust with egui, requiring a Rust compiler toolchain for `wasm32-unknown-unknown` and the [`wasm-pack`](https://drager.github.io/wasm-pack/installer/) tool installed.
|
|
45
|
+
|
|
46
|
+
Install rust with rustup: https://rustup.rs/
|
|
47
|
+
|
|
48
|
+
Now that you have `cargo`, install wasm-pack with `cargo install wasm-pack`.
|
|
49
|
+
|
|
50
|
+
Using [uv](https://github.com/astral-sh/uv) for development will automatically manage virtual environments and dependencies for you.
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
uv run jupyter lab example.ipynb
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Alternatively, create and manage your own virtual environment:
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
python -m venv .venv
|
|
60
|
+
source .venv/bin/activate
|
|
61
|
+
pip install -e ".[dev]"
|
|
62
|
+
jupyter lab example.ipynb
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The widget front-end code bundles it's JavaScript dependencies. After setting up Python,
|
|
66
|
+
make sure to install these dependencies locally:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
npm install
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
While developing, you can run the following in a separate terminal to automatically
|
|
73
|
+
rebuild JavaScript as you make changes:
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
npm run dev
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Open `example.ipynb` in JupyterLab, VS Code, or your favorite editor
|
|
80
|
+
to start developing. Changes made in `js/` will be reflected
|
|
81
|
+
in the notebook.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# pyviewarr
|
|
2
|
+
|
|
3
|
+
A faster, more intuitive way to explore 2D data (i.e. monochromatic images) in Python notebooks.
|
|
4
|
+
|
|
5
|
+
- Server-side slicing — view 1 MB of a 100 GB data cube without downloading 100 GB of data
|
|
6
|
+
- Interactive re-stretching by right-clicking and dragging in X and Y (inspired by [ds9](https://sites.google.com/cfa.harvard.edu/saoimageds9))
|
|
7
|
+
- Stepper buttons for moving along the leading axes of N-D data where N > 2
|
|
8
|
+
- Linear, log, and symmetric linear (i.e. centered at zero with `vmin == -vmax`) scales
|
|
9
|
+
- Panning and zooming (`0` key resets, `-` zooms out, `=` zooms in)
|
|
10
|
+
- A few good colormaps
|
|
11
|
+
|
|
12
|
+
_Clanker code disclaimer: written in collaboration with Anthropic's Claude LLM. Use at your own risk._
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
pip install pyviewarr
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
or with [uv](https://github.com/astral-sh/uv):
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
uv add pyviewarr
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Development
|
|
27
|
+
|
|
28
|
+
Be sure to clone with `git clone --recurse-submodules` (or, if you cloned first and **then** read this, `git submodule update --init --recursive` to initialize an existing clone).
|
|
29
|
+
|
|
30
|
+
The frontend part of the widget (i.e. `viewarr` itself) is written in Rust with egui, requiring a Rust compiler toolchain for `wasm32-unknown-unknown` and the [`wasm-pack`](https://drager.github.io/wasm-pack/installer/) tool installed.
|
|
31
|
+
|
|
32
|
+
Install rust with rustup: https://rustup.rs/
|
|
33
|
+
|
|
34
|
+
Now that you have `cargo`, install wasm-pack with `cargo install wasm-pack`.
|
|
35
|
+
|
|
36
|
+
Using [uv](https://github.com/astral-sh/uv) for development will automatically manage virtual environments and dependencies for you.
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
uv run jupyter lab example.ipynb
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Alternatively, create and manage your own virtual environment:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
python -m venv .venv
|
|
46
|
+
source .venv/bin/activate
|
|
47
|
+
pip install -e ".[dev]"
|
|
48
|
+
jupyter lab example.ipynb
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The widget front-end code bundles it's JavaScript dependencies. After setting up Python,
|
|
52
|
+
make sure to install these dependencies locally:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
npm install
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
While developing, you can run the following in a separate terminal to automatically
|
|
59
|
+
rebuild JavaScript as you make changes:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
npm run dev
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Open `example.ipynb` in JupyterLab, VS Code, or your favorite editor
|
|
66
|
+
to start developing. Changes made in `js/` will be reflected
|
|
67
|
+
in the notebook.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pyviewarr"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
dependencies = ["anywidget>=0.9,<0.10", "numpy>=2.0,<3"]
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
|
|
12
|
+
# For projects not using `uv`, you can install these development dependencies with:
|
|
13
|
+
# `pip install -e ".[dev]"`
|
|
14
|
+
# If you're using `uv` for development, feel free to remove this section.
|
|
15
|
+
[project.optional-dependencies]
|
|
16
|
+
dev = ["watchfiles", "jupyterlab", "pytest>=7.0", "matplotlib>=3.5"]
|
|
17
|
+
|
|
18
|
+
# Dependency groups (recognized by `uv`). For more details, visit:
|
|
19
|
+
# https://peps.python.org/pep-0735/
|
|
20
|
+
[dependency-groups]
|
|
21
|
+
dev = ["watchfiles", "jupyterlab", "pytest>=7.0", "matplotlib>=3.5"]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
[tool.hatch.build]
|
|
25
|
+
only-packages = true
|
|
26
|
+
artifacts = ["src/pyviewarr/static/*"]
|
|
27
|
+
|
|
28
|
+
[tool.hatch.build.hooks.jupyter-builder]
|
|
29
|
+
build-function = "hatch_jupyter_builder.npm_builder"
|
|
30
|
+
ensured-targets = ["src/pyviewarr/static/widget.js"]
|
|
31
|
+
skip-if-exists = ["src/pyviewarr/static/widget.js"]
|
|
32
|
+
dependencies = ["hatch-jupyter-builder>=0.5.0"]
|
|
33
|
+
|
|
34
|
+
[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
|
|
35
|
+
npm = "npm"
|
|
36
|
+
build_cmd = "build:all"
|
|
37
|
+
|
|
38
|
+
[tool.pytest.ini_options]
|
|
39
|
+
testpaths = ["tests"]
|
|
40
|
+
python_files = ["test_*.py"]
|
|
41
|
+
python_functions = ["test_*"]
|