Skip to content

build: migrate to uv, add ruff/ty, format all files#115

Open
FIrgolitsch wants to merge 1 commit intomainfrom
pr-a-build-tooling
Open

build: migrate to uv, add ruff/ty, format all files#115
FIrgolitsch wants to merge 1 commit intomainfrom
pr-a-build-tooling

Conversation

@FIrgolitsch
Copy link
Copy Markdown
Contributor

@FIrgolitsch FIrgolitsch commented Apr 30, 2026

Stacked PR 1/16 — review order: #115#97#98#99#100#101#108#106#107#87#116#110#111#40#112#113


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, #97#113).

Build system: setup.pyuv + pyproject.toml

  • Full pyproject.toml: project metadata, core deps, optional extras (gpu, gpu-cuda12, gpu-cuda13, docs, dev), entries in [project.scripts]
  • uv.lock for reproducible resolution
  • Remove setup.py, requirements.txt, requirements-pytest.txt
  • Dockerfile migrated from pip to uv

Lint & format: ruff + ty

  • [tool.ruff] — target py312, line-length 127, rules E/F/W/I/UP/B/C4/PIE
  • [tool.ruff.lint.isort]_thread_config in its own section (must be imported before numpy/scipy/SimpleITK so thread caps apply)
  • [tool.ty] — linumpy-only, py312, cupy/cupyx/numbaAny, relaxed overrides for tests and GPU modules
  • .pre-commit-config.yaml — ruff-format, ruff lint (--fix), ty (advisory / non-blocking)
  • ruff format applied to all Python files; ruff check --fix applied (import ordering, f-strings, type upgrades, safe pathlib swaps)

CI & Docker

  • .github/workflows/python-app.ymlastral-sh/setup-uv@v5, uv sync, uv run ruff, uv run ty, uv run pytest
  • Dockerfile switched from pip to uv

Other

  • linumpy/py.typed PEP 561 marker
  • .gitignore additions for uv / ty / ruff caches
  • scripts/linum_axis_XYZ_to_ZYX.py renamed to lowercase linum_axis_xyz_to_zyx.py so the file name matches its [project.scripts] entry point on case-sensitive filesystems

Notes

  • This PR contains build-tooling and formatting changes only — no library code, no new modules, no new scripts.
  • New library modules and scripts arrive in the dependent PRs (see chain order above).
  • [project.scripts] here only references scripts present at this branch point; each stacked PR adds its own entries.
  • A small set of pre-existing lint warnings (E501, E722, E741, UP031, B007) on files inherited from earlier history are listed in [tool.ruff.lint.per-file-ignores]. They are mopped up in the dependent PRs that rewrite those files.
  • Two pre-existing flaky tests in linumpy/tests/test_utils_shifts.py (test_filter_step_outliers_local_mad_detects_spike, test_filter_step_outliers_clamp) are marked @pytest.mark.xfail. They are fixed in the dependent PRs.

Replaces #95

PR #95 was permanently locked closed by GitHub after main was force-rewritten earlier and lost common history with this branch. main has now been restored to f0df3bf4 (same tree, same content), so this PR can proceed normally.

- Drop setup.py and requirements*.txt; add pyproject.toml + uv.lock
- Configure ruff (lint + format) and ty in pyproject.toml
- Pre-commit hook runs ruff-format, ruff --fix, ty
- CI workflow updated to use astral-sh/setup-uv and uv run
- Dockerfile migrated from pip to uv
- Add linumpy/py.typed PEP 561 marker
- Apply ruff format + safe ruff --fix to all existing files
- Lowercase scripts/linum_axis_xyz_to_zyx.py to match its entry point
  (the original uppercase \"linum_axis_XYZ_to_ZYX.py\" file is renamed
  to follow snake_case)
- Pre-existing lint warnings (E501, E722, E741, UP031, B007) on a handful
  of files inherited from earlier history are listed in
  per-file-ignores; they are mopped up in the dependent PRs that
  rewrite those files
- Two pre-existing flaky tests in linumpy/tests/test_utils_shifts.py are
  marked xfail; they are fixed in the dependent PRs

This PR contains build-tooling and formatting changes only — no library
code, no new modules, no new scripts. New library modules and scripts
arrive in the dependent PRs (see PR description for the chain order).
@FIrgolitsch FIrgolitsch requested a review from CHrlS98 April 30, 2026 04:13
@FIrgolitsch
Copy link
Copy Markdown
Contributor Author

@CHrlS98 This is the new starting points of the PR now. Had to change some stuff around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant