A Jupyter Widget for Niivue based on anywidget.
Project description
ipyniivue
A Jupyter Widget for Niivue based on anywidget.
Installation
pip install ipyniivue
Usage
In a Jupyter environment:
from ipyniivue import NiiVue
nv = NiiVue()
nv.load_volumes([{"path": "images/mni152.nii.gz"}])
nv
See the basic demo to learn more.
Development
ipyniivue uses the
recommended hatchling
build-system, which is convenient to use via the hatch
CLI. We recommend installing hatch
globally
(e.g., via pipx
) and running the various commands defined within
pyproject.toml
. hatch
will take care of creating and synchronizing a
virtual environment with all dependencies defined in pyproject.toml
.
Commands Cheatsheet
All commands are run from the root of the project, from a terminal:
Command | Action |
---|---|
hatch run format |
Format project with ruff format . and apply linting with ruff --fix . |
hatch run lint |
Lint project with ruff check . . |
hatch run test |
Run unit tests with pytest |
Alternatively, you can develop ipyniivue by manually creating a virtual
environment and managing installation and dependencies with pip
.
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
Making Changes to the JavaScript Code
This is an anywidget project, which means
the code base is hybrid Python and JavaScript. The JavaScript part is developed
under js/
and uses esbuild to bundle the code.
Any time you make changes to the JavaScript code, you need to rebuild the files
under src/ipyniivue/static
. This can be done in two ways:
npm run build
which will build the JavaScript code once, or you can start a development server:
npm run dev
which will start a development server that will automatically rebuild the code as you make changes. We recommend the latter approach, as it is more convenient.
Once you have the development server running, you can start the JupyterLab
or VS Code to develop the widget. When finished, you can stop the development
server with Ctrl+C
.
NOTE: In order to have anywidget automatically apply changes as you work, make sure to
export ANYWIDGET_HMR=1
environment variable. This can be set directly in a notebook with%env ANYWIDGET_HMR=1
in a cell.
Release Process
- Releases are automated using GitHub Actions and the
release.yml
workflow. - The workflow is triggered when a new tag matching the pattern
v*
is pushed to the repository. - To create a new release, create a tag from the command line:
git tag -a vX.X.X -m "vX.X.X" git push --follow-tags
- When triggered, the workflow will:
- Publish the package to PyPI with the tag version.
- Generate a changelog based on conventional commits and create a GitHub Release with the changelog.
Changelog Generation
- We generate a changelog for GitHub releases with
antfu/changelogithub
- Each changelog entry is grouped and rendered based on conventional commits, and it is recommended to follow the Conventional Commits.
- The tool generates the changelog based on the commits between the latest release tag and the previous release tag.
By following this release process and utilizing conventional commits, you can ensure consistent and informative releases for your project.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ipyniivue-2.1.0.tar.gz
.
File metadata
- Download URL: ipyniivue-2.1.0.tar.gz
- Upload date:
- Size: 544.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e602cdfc382db897178f413b4a4b7604c6910fa6049303f2316bf328aa1a34d0 |
|
MD5 | 2aae65005f9bffa1cd077af4b590cbb7 |
|
BLAKE2b-256 | 2654434b0ae5f0138ade8052563429275baa499e130dde88d4c14b29c6139f12 |
Provenance
The following attestation bundles were made for ipyniivue-2.1.0.tar.gz
:
Publisher:
release.yml
on niivue/ipyniivue
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
ipyniivue-2.1.0.tar.gz
- Subject digest:
e602cdfc382db897178f413b4a4b7604c6910fa6049303f2316bf328aa1a34d0
- Sigstore transparency entry: 152006216
- Sigstore integration time:
- Permalink:
niivue/ipyniivue@9d70d23256b88a1dd0cf0829874c1a2538a3c374
- Branch / Tag:
refs/tags/v2.1.0
- Owner: https://github.com/niivue
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yml@9d70d23256b88a1dd0cf0829874c1a2538a3c374
- Trigger Event:
push
- Statement type:
File details
Details for the file ipyniivue-2.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: ipyniivue-2.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 549.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ba1801af257d85c72b10707c88b799c15e92a9b09f7ccd8440fa543ad7b2bca |
|
MD5 | b945de1e1db88b69b6b578c6a8b59982 |
|
BLAKE2b-256 | fc0ce18011bf6e8f2e0910eac6be0d2b3c767f4342a7eb3a35741d3a5b0de354 |
Provenance
The following attestation bundles were made for ipyniivue-2.1.0-py2.py3-none-any.whl
:
Publisher:
release.yml
on niivue/ipyniivue
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
ipyniivue-2.1.0-py2.py3-none-any.whl
- Subject digest:
6ba1801af257d85c72b10707c88b799c15e92a9b09f7ccd8440fa543ad7b2bca
- Sigstore transparency entry: 152006218
- Sigstore integration time:
- Permalink:
niivue/ipyniivue@9d70d23256b88a1dd0cf0829874c1a2538a3c374
- Branch / Tag:
refs/tags/v2.1.0
- Owner: https://github.com/niivue
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
release.yml@9d70d23256b88a1dd0cf0829874c1a2538a3c374
- Trigger Event:
push
- Statement type: