Obsessive Coder's Dependency Toolkit — Python utilities for array manipulation, GPU dispatch, image I/O, morphology, and plotting.
Project description
ocdkit
A toolkit for array manipulation, GPU dispatch, image I/O, spatial operations, morphology, and plotting.
Install
pip install ocdkit # core (numpy, scipy, scikit-image, tifffile, matplotlib)
pip install ocdkit[torch] # + PyTorch GPU support
pip install ocdkit[plot] # + ncolor, cmap, opt_einsum
pip install ocdkit[spatial] # + numba, fastremap (contour extraction, skeletonization)
pip install ocdkit[all] # everything
Modules
| Module | What's in it |
|---|---|
ocdkit.array |
rescale, safe_divide, is_integer, get_module, unique_nonzero |
ocdkit.gpu |
resolve_device, empty_cache, torch_GPU, torch_CPU |
ocdkit.io |
imread, imwrite, getname, check_dir |
ocdkit.spatial |
kernel_setup, get_neighbors, get_neigh_inds, masks_to_affinity, get_contour, boundary_to_masks |
ocdkit.morphology |
find_boundaries, skeletonize |
ocdkit.measure |
crop_bbox, bbox_to_slice, make_square, diameters |
ocdkit.plot |
figure, image_grid, split_list, colorize, rgb_flow, vector_contours, apply_ncolor, color_swatches, recolor_label, add_label_background |
Quick start
from ocdkit.array import rescale
from ocdkit.gpu import resolve_device
from ocdkit.plot import figure, image_grid
device = resolve_device() # auto-detect CUDA / MPS / CPU
Performance tips
Pin numba's JIT cache to local disk
If your project source lives on a network filesystem (SMB / NFS), set
NUMBA_CACHE_DIR to a local-disk location. By default numba writes its
JIT cache to __pycache__ next to the source file, which on a
NAS-mounted tree means dozens of small SMB ops per fresh subprocess —
several seconds of overhead on every cold import.
ocdkit auto-applies $HOME/.cache/numba as the default if you haven't
set it (see src/ocdkit/__init__.py), but for shells, test runners, and
non-ocdkit code, set it explicitly:
# Linux / macOS — add to ~/.zshrc, ~/.bashrc, or ~/.profile
export NUMBA_CACHE_DIR="$HOME/.cache/numba"
# Windows — add to $PROFILE
[Environment]::SetEnvironmentVariable('NUMBA_CACHE_DIR', "$env:USERPROFILE\.cache\numba", 'User')
Compiled artifacts are machine-local anyway (CPU- and Python-version specific), so they don't belong on shared NAS regardless of perf.
License
BSD-3-Clause
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
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 ocdkit-0.0.3.tar.gz.
File metadata
- Download URL: ocdkit-0.0.3.tar.gz
- Upload date:
- Size: 363.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72fd1d787ba57bb8eaebd2b45018813d0ebf24d182c68396203819d3c9ab5309
|
|
| MD5 |
472654cce1b4d5794be8f68c6cda35c0
|
|
| BLAKE2b-256 |
b2b4c521c6b9823322d4339a1c57bff652ed1edd7428fadbb63461ebf6d42554
|
File details
Details for the file ocdkit-0.0.3-py3-none-any.whl.
File metadata
- Download URL: ocdkit-0.0.3-py3-none-any.whl
- Upload date:
- Size: 350.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
017fe823aa7eb0ffb87993f282dd074f79e3bdfcdb12984f43fad052f4a9b159
|
|
| MD5 |
52698d464468c3144b47268b2b09b53c
|
|
| BLAKE2b-256 |
577fe79fc9333a48c825163d50d1628fd3b7c827c1fea1507386465c69c5a062
|