build: migrate to uv, add ruff/ty, format all files#95
Open
FIrgolitsch wants to merge 21 commits intomainfrom
Open
build: migrate to uv, add ruff/ty, format all files#95FIrgolitsch wants to merge 21 commits intomainfrom
FIrgolitsch wants to merge 21 commits intomainfrom
Conversation
This was referenced Apr 1, 2026
This was referenced Apr 17, 2026
8c93c45 to
687b26f
Compare
CHrlS98
requested changes
Apr 22, 2026
a48129d to
82b44be
Compare
This was referenced Apr 23, 2026
82b44be to
ce8e35d
Compare
Relocates thread-pool configuration into a dedicated config sub-package.
- Remove dead modules data_io.py and npz.py (unused). - Move Allen brain atlas helpers from io/allen.py into a new linumpy.reference sub-package. - Drop star imports from io/__init__.py. - Modernize remaining io/ modules (Path, type hints, docstrings).
- Move utils/io.py argparse helpers to a new linumpy.cli.args module. - Move utils/metrics.py into a top-level linumpy.metrics package. - Remove now-empty linumpy.utils package.
…in.py Promotes the single-file linumpy.segmentation module into a package with a dedicated brain.py module for clarity and future extension.
- imaging/transform.py: image transformation helpers. - imaging/overlay.py: overlay/composite helpers.
…osaic.quick_stitch - mosaic/discovery.py: tile-discovery helpers. - mosaic/quick_stitch.py: quick low-resolution stitching helpers.
- mosaic/grid.py: grid construction (from stitching/mosaic_grid.py).
- mosaic/overlap.py: tile overlap helpers (extracted from stitching).
- registration/manual.py: interactive registration GUI
(from stitching/manual_registration.py).
- registration/sitk.py: SimpleITK-based registration
(from stitching/registration.py).
- registration/phase_correlation.py: phase-correlation registration.
- registration/refinement.py: multi-stage refinement helpers.
- registration/transforms.py: affine/rigid transform utilities.
- Drop dead modules stitching/FileUtils.py, stitching/topology.py,
stitching/stitch_utils.py.
…ckage Splits the 1786-line linumpy/preproc/icorr.py module into focused modules: - intensity/normalize.py: intensity normalization helpers. - intensity/attenuation.py: attenuation correction. - intensity/psf_model.py: PSF-model-based illumination correction. - intensity/vignette.py: vignetting correction. - intensity/artifact.py: artifact removal helpers. - intensity/convert.py: intensity conversion helpers.
…ckage Splits xyzcorr.py into focused modules: - geometry/crop.py: volume cropping helpers. - geometry/resample.py: resampling utilities. - geometry/interface.py: tissue-interface detection and fitting. - geometry/galvo.py: galvo / scanner geometry helpers. Repoints linumpy.microscope.oct to use the new geometry.galvo module.
…it utils.py - stack_alignment/io.py: I/O helpers (CSV/JSON read/write). - stack_alignment/units.py: unit conversion helpers. - stack_alignment/filter.py: outlier filtering helpers. Renames the corresponding test module from test_utils_shifts.py to test_stack_alignment.py.
- psf/synthetic.py: synthesize_3d_psf helper (renamed from get_3d_psf for clarity). - psf/extract.py: extract experimental PSFs from data.
Updates all 43 linum_*.py scripts plus 2 script tests to use the
new sub-packages introduced in this refactor:
linumpy.preproc.icorr -> linumpy.intensity.{normalize,attenuation,
psf_model,vignette,
artifact,convert}
linumpy.preproc.xyzcorr -> linumpy.geometry.{crop,resample,
interface,galvo}
linumpy.shifts.utils -> linumpy.stack_alignment.{io,units,filter}
linumpy.psf.psf_estimator -> linumpy.psf.{synthetic,extract}
linumpy.stitching -> linumpy.mosaic.{grid,overlap,discovery,
quick_stitch} and
linumpy.registration.{manual,sitk,
phase_correlation,
refinement,transforms}
linumpy.utils_images -> linumpy.imaging.{transform,overlay}
linumpy.utils.io -> linumpy.cli.args
linumpy.utils.metrics -> linumpy.metrics
linumpy.io.allen -> linumpy.reference.allen
linumpy.segmentation -> linumpy.segmentation.brain
linumpy.reconstruction -> linumpy.mosaic.{discovery,quick_stitch}
linumpy._thread_config -> linumpy.config.threads
- Update setuptools `packages.find` and ruff `per-file-ignores` to reflect the renamed/split modules (intensity/, geometry/, mosaic/, registration/, stack_alignment/, etc.). - Update isort `thread-config` section to reference linumpy.config.threads. - Refresh uv.lock to pick up incidental dependency updates. - Pre-existing tooling tweaks (expanded ruff rule set, ty config, GPU dependency cleanup) carried in the working tree.
Refreshes all transitive package versions to current resolutions (idna, magicgui, ome-zarr, pre-commit, pydantic, pytest, ruff, ty, typer, virtualenv, etc.).
Removed pins on numpy, scipy, hyperactive, pynrrd, and numcodecs. basicpy 2.0.0 (latest available) transitively pins scipy<1.13, which forces numpy<2; override that ceiling via [tool.uv].override-dependencies so we resolve modern numpy 2.x and scipy 1.17 across the stack.
ce8e35d to
cc75fc8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #95 — Build Tooling & Formatting
Migrates the build system to modern Python tooling and applies consistent formatting across the codebase. Prerequisite for all other stacked PRs (#87, #96–#104).
Build system: setup.py → uv + pyproject.toml
pyproject.toml: project metadata, core deps, optional extras (gpu,gpu-cuda12,gpu-cuda13,docs,dev), entries in[project.scripts]uv.lockfor reproducible resolutionsetup.py,requirements.txt,requirements-pytest.txtDockerfileupdated to use uvLint & format: ruff + ty
[tool.ruff]— target py312, line-length 127, rules E/F/W/I/UP/B/RUF/SIM/C4/PIE/PTH[tool.ruff.lint.isort]—_thread_configin its own section (must import before numpy/jax to set thread caps)[tool.ty]— linumpy-only, py312, cupy/cupyx/numba → Any, relaxed overrides for tests and GPU modules.pre-commit-config.yaml— ruff-format, ruff lint (--fix), ty (advisory / non-blocking)ruff formatapplied to all Python files;ruff check --fixapplied (import ordering, f-strings, type upgrades, PTH replacements where safe)CI & Docker
.github/workflows/python-app.yml—astral-sh/setup-uv@v5,uv sync,uv run ruff,uv run ty,uv run pytestDockerfileswitched from pip to uvOther
linumpy/py.typedmarker.gitignoreadditions for uv / ty caches and local benchmark outputsCommits
build: migrate to uv, add ruff/ty, format all filesbuild: expand ruff rules, refresh uv.lock, add ty pre-commit— enables PTH/SIM/C4/PIE, refreshesuv.lock, wires ty into pre-commit as advisoryNotes
[project.scripts]here only contains scripts present at the branch point; each stacked PR adds its own entries