Python client for the ccx3 Neurodesk-oriented image and VM API
Project description
neurodesk
neurodesk is a Python client and shell helper for the ccx3 daemon. It is
focused on Neurodesk container discovery, CVMFS-backed image import, VM
lifecycle management, and running container commands from Python, notebooks, or
normal shell scripts.
What It Provides
- A typed HTTP client for
ccvm - High-level
container("name")helpers for Neurodesk containers - CVMFS listing and file-read helpers
- Automatic daemon startup for local workflows
- Shell activation and command wrappers for
nd load/nd exec - Fulltest helpers for running Neurodesk test suites inside containers
Installation
The package is published as neurodesk:
pip install neurodesk
Both import neurodesk and import pyneurodesk are supported.
Development Setup
The package uses uv and requires Python 3.9 or newer.
cd pyneurodesk
uv sync
uv run pytest
The default package install keeps the client and shell dependencies small. The
pyneurodesk-fulltest helper needs NIfTI and YAML support, so install the
optional extra when you want to run fulltest recipes:
uv sync --extra fulltest
Publishing
Platform wheels should include the bundled ccvm binary so installs do not
need a Go toolchain at runtime. Use the repository release helper from the repo
root to cross-compile the currently supported wheels (linux/amd64,
linux/arm64, darwin/arm64, and stable windows/amd64) with
CGO_ENABLED=0:
UV_PUBLISH_TOKEN=pypi-... tools/publish_neurodesk.sh
By default the helper builds and publishes wheels only. To also publish a source-only sdist, run:
UV_PUBLISH_TOKEN=pypi-... tools/publish_neurodesk.sh --include-sdist
The sdist intentionally does not contain ccvm; installing from it fails during
wheel build unless ccvm is discoverable through PYNEURODESK_CCVM,
CCX3_CCVM, CCVM_BINARY, or PATH.
If you want to exercise real VM execution, build the Go daemon first from the repository root:
go build -o /tmp/ccx3-dev/ccvm ./cmd/ccvm
Then point pyneurodesk at it if it is not bundled in the default location:
export PYNEURODESK_CCVM=/tmp/ccx3-dev/ccvm
Python Usage
Run a Neurodesk command from Python:
import neurodesk as nd
niimath = nd.container("niimath")
print(niimath.run("niimath", "-help"))
Share a host directory with a container:
from pathlib import Path
import neurodesk as nd
work = nd.share_dir(Path.cwd(), writable=True)
niimath = nd.container("niimath")
print(niimath.run("sh", "-lc", f"ls {work.guest_path}"))
Connect to an existing daemon:
import neurodesk as nd
client = nd.connect(base_url="http://127.0.0.1:3456")
print(client.instance_status())
Shell Usage
Generate an activation script and load a container:
source <(uv run neurodesk activate --shell bash)
nd load niimath
niimath -help
On PowerShell, neurodesk activate auto-detects the native shell. The short
form uses PowerShell's built-in iex alias:
nd activate | iex
nd load niimath
niimath -help
Run a one-off command through the active VM:
nd exec niimath -- niimath -help
The shell integration creates wrapper scripts in a session directory under the user cache directory and reuses the shared daemon/VM where possible.
CVMFS Helpers
Search for available versions:
import neurodesk as nd
print(nd.search("niimath"))
Import a specific CVMFS path with the lower-level client:
import neurodesk as nd
from pyneurodesk.models import CVMFSSource, ImportImageRequest
client = nd.connect()
source = CVMFSSource(
mirror="https://cvmfs.neurodesk.org",
repo="neurodesk.ardc.edu.au",
path="/containers/niimath_1.0.20250804_20251016",
)
client.import_image("niimath-cvmfs", ImportImageRequest.from_cvmfs_container(
mirror=source.mirror,
repo=source.repo,
path=source.path,
))
Tests
Unit tests do not require KVM or a live daemon:
uv run pytest
The shell smoke example does require the Go daemon and host virtualization:
./examples/test_niimath_shell.sh
Environment Variables
PYNEURODESK_BASE_URL: connect to an existingccvmdaemonPYNEURODESK_CCVM: path to theccvmbinary used for automatic startupPYNEURODESK_CACHE_DIR: cache root for daemon state and shell sessionsPYNEURODESK_HTTP_TIMEOUT: default HTTP timeout in secondsPYNEURODESK_BOOT_TIMEOUT: VM boot timeout in seconds, default5CCX3_VM_BOOT_TIMEOUT: daemon-side VM boot timeout in seconds, default5PYNEURODESK_RELEASES_DIR: local Neurodesk release metadata directoryPYNEURODESK_RELEASES_API: GitHub contents API endpoint for release metadata
Notes
pyneurodesk delegates actual container execution to ccvm. On stable amd64
hosts (linux/amd64 and windows/amd64), the daemon currently runs native
amd64 containers and rejects known foreign architectures. Live execution
requires the host virtualization setup described in the top-level repository
README.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neurodesk-0.3.0-py3-none-win_amd64.whl.
File metadata
- Download URL: neurodesk-0.3.0-py3-none-win_amd64.whl
- Upload date:
- Size: 11.3 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
964db04e8cac52d33662e8fcbb4086bec88a5b38227a636044bea11d47bfdea9
|
|
| MD5 |
ad9dcec8d2f30db8989fdbdefaeb642e
|
|
| BLAKE2b-256 |
181d47920f7787ae4550cad5c1b122ea50d2776d1edcdbbf3da85e7dcb87dc07
|
File details
Details for the file neurodesk-0.3.0-py3-none-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: neurodesk-0.3.0-py3-none-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 11.4 MB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d296066d8b43176a598a6b8a07911a29b41c17932a51873b8a5600f05a9e874
|
|
| MD5 |
a54048a7970ddd830d40547d126acd6e
|
|
| BLAKE2b-256 |
73882d7d6e20ca15e9c5281c25f1ce84aa6ff71593dd5c7fe73e1ee83fd20178
|
File details
Details for the file neurodesk-0.3.0-py3-none-manylinux_2_17_aarch64.whl.
File metadata
- Download URL: neurodesk-0.3.0-py3-none-manylinux_2_17_aarch64.whl
- Upload date:
- Size: 10.5 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31c5a78642689ddae9fc6e02fedfe3ffba943a9d180d40852e81c7f31cffe7bb
|
|
| MD5 |
97788db8750ec4a16ed27d0c42b83b2c
|
|
| BLAKE2b-256 |
e8f1b1686e05270a13ffa5c356b1ba2a08394ae6b460b0a3b9958c4ea5fae363
|
File details
Details for the file neurodesk-0.3.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: neurodesk-0.3.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 11.1 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68f985c37ac11fb323eeef2b4c9d826f596acacd99c830b9a4c00e8dc59a4c71
|
|
| MD5 |
1b2879ceb34d7a8be323f8fd395ca811
|
|
| BLAKE2b-256 |
e1bf5fc184e9bc9f138c7bcbb68734d79313973bc89ec841ee493179cf960a41
|