Skip to content

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

Merged
CHrlS98 merged 1 commit into
mainfrom
pr-a-build-tooling
May 7, 2026
Merged

build: migrate to uv, add ruff/ty, format all files#115
CHrlS98 merged 1 commit into
mainfrom
pr-a-build-tooling

Conversation

@FIrgolitsch

@FIrgolitsch FIrgolitsch commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

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

Base: main. First PR in the chain.


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.

@CHrlS98 CHrlS98 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you confirm before I go any deeper?

Comment thread linumpy/io/npz.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought you removed the npz stuff, is this the right PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It gets dropped in #97 as part of a refactor of all the packages

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.

2 participants