Skip to main content

A Jupyter Widget for Niivue based on anywidget.

Project description

ipyniivue

PyPI Version License Binder

A Jupyter Widget for Niivue based on anywidget.


Installation

Install ipyniivue using pip:

pip install ipyniivue

Usage

In a Jupyter environment:

from ipyniivue import NiiVue

nv = NiiVue()
nv.load_volumes([{"path": "images/mni152.nii.gz"}])
nv

This will render an interactive Niivue widget within your notebook.

See the basic demo to learn more.


Documentation

See the Documentation for usage.


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.

Command Cheat Sheet

Run these commands from the root of the project:

Command Description
hatch run format Format the project with ruff format . and apply linting with ruff --fix .
hatch run lint Lint the project with ruff check .
hatch run test Run unit tests with pytest
hatch run docs Build docs with Sphinx

Alternatively, you can manually create a virtual environment and manage 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, meaning the codebase is a hybrid of Python and JavaScript. The JavaScript code resides under the js/ directory and uses esbuild for bundling. Whenever you make changes to the JavaScript code, you need to rebuild the files under src/ipyniivue/static.

You have two options:

  1. Build Once: Build the JavaScript code one time:

    npm run build
    
  2. Start Development Server: Start a development server that automatically rebuilds the code as you make changes:

    npm run dev
    

    We recommend this approach for a smoother development experience.

Working with Jupyter

Once the development server is running, you can start JupyterLab or Visual Studio Code to develop the widget. When you're finished, stop the development server with Ctrl+C.

Note: To have anywidget automatically apply changes as you work, set the environment variable ANYWIDGET_HMR=1. You can set this directly in a notebook cell:

%env ANYWIDGET_HMR=1

or in the shell:

export ANYWIDGET_HMR=1

Release Process

Releases are automated using GitHub Actions via the release.yml workflow.

Steps to Create a New Release

  1. Commit Changes: Ensure all your changes are committed.

  2. Create a Tag: Create a new tag matching the pattern v*:

    git tag -a vX.X.X -m "vX.X.X"
    git push --follow-tags
    
  3. Workflow Actions: When triggered, the workflow will:

    • Publish the package to PyPI with the tag version.
    • Generate a changelog based on conventional commits.
    • 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.
  • It's recommended to follow the Conventional Commits specification.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipyniivue-2.4.1.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

ipyniivue-2.4.1-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file ipyniivue-2.4.1.tar.gz.

File metadata

  • Download URL: ipyniivue-2.4.1.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ipyniivue-2.4.1.tar.gz
Algorithm Hash digest
SHA256 83e739eeab28a24d74463932456dba9912b93344f62b56bc633f8ba61919568c
MD5 e1b7ed3c3fcba22e56c7fde35049b470
BLAKE2b-256 e0af608a23d171d0fb9154eeabcce976b761abe95cf76ca1c6c608c4596b2a22

See more details on using hashes here.

Provenance

The following attestation bundles were made for ipyniivue-2.4.1.tar.gz:

Publisher: release.yml on niivue/ipyniivue

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ipyniivue-2.4.1-py3-none-any.whl.

File metadata

  • Download URL: ipyniivue-2.4.1-py3-none-any.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ipyniivue-2.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bed7ae82b63a4363082ae49271e938b6ab2884031f884efe3562da66ab630da4
MD5 64ac88558e594bc6629ac9dad5c78de4
BLAKE2b-256 3761e711a5b6d7a4ebfcca535cce76df3c70fcc32329ce029a79fbd8af766734

See more details on using hashes here.

Provenance

The following attestation bundles were made for ipyniivue-2.4.1-py3-none-any.whl:

Publisher: release.yml on niivue/ipyniivue

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page