Skip to content

Feat/ty#57

Merged
cako merged 9 commits intomainfrom
feat/ty
Jan 12, 2026
Merged

Feat/ty#57
cako merged 9 commits intomainfrom
feat/ty

Conversation

@cako
Copy link
Owner

@cako cako commented Jan 12, 2026

  • Add ty configuration to pyproject.toml with environment and rules
  • Configure ty to check src/ and tests/ with examples excluded
  • Set unused-ignore-comment to warn during migration period
  • Add ty ignore comments for matplotlib to_rgba scalar arguments
  • Update documentation to reference both ty and mypy as type checkers
  • Keep mypy configuration for compatibility during transition

Note

Modernizes typing and monogenic UDCT internals, and wires up fast Rust-based type checking.

  • Replace numpy._typing/torch._typing with new numpy.typing and torch.typing modules; propagate _F, _C, generic UDCTCoefficients/UDCTWindows, and _to_(real|complex)_dtype; update all imports/signatures across NumPy/Torch code
  • Redesign monogenic coefficients: per-wedge arrays now stack channels along last dim [scalar.real, scalar.imag, riesz_1..riesz_ndim] (real dtype); update forward/backward implementations, vect/struct, and tests; example adjusts by viewing first 2 channels as complex
  • Adjust UDCT forward/backward dispatch and window/utility typing; minor fixes (torch Riesz norm sum, MEYER_TRANSITION_POLYNOMIAL dtype, matplotlib to_rgba ignores)
  • Add ty configuration in pyproject.toml (env, src/includes, rules/overrides); docs mention ty alongside mypy; nox pre-commit invocation simplified

Written by Cursor Bugbot for commit 291a671. This will update automatically on new commits. Configure here.

cako added 8 commits January 11, 2026 20:41
…th ndim+2 monogenic channels

- Replace RealUDCTCoefficients/ComplexUDCTCoefficients with single generic UDCTCoefficients[T]
- Make UDCTWindows generic over floating types using UDCTWindows[F]
- Update monogenic coefficients to use ndim+2 real channels instead of ndim+1 complex
- Store complex scalar as 2 real channels (scalar.real, scalar.imag) for monogenic transform
- Reconstruct complex scalar via .view(complex_dtype) on first 2 channels in backward transform
- Update tests to verify ndim+2 channels and real dtype for monogenic coefficients
…ws type aliases consistently

- Change F, C, T TypeVars from constrained to bound per NumPy recommendation
  - F = TypeVar("F", bound=np.floating)
  - C = TypeVar("C", bound=np.complexfloating)
  - T = TypeVar("T", bound=np.inexact)
- Add type parameters to all UDCTWindows usages (e.g., UDCTWindows[np.floating])
- Replace raw list[list[list[npt.NDArray[...]]]] with UDCTCoefficients[T] throughout
- Remove unused type: ignore comments that are no longer needed
- Fix unreachable code warnings by restructuring transform_kind dispatch logic
- Rename _typing.py to typing.py in numpy and torch modules
- Add __all__ to export public types (UDCTCoefficients, UDCTWindows)
- Make internal types private with underscore prefix (_F, _C, _T, _A, etc.)
- Update all imports across source and test files
- Fix mypy overload-cannot-match type ignore placement
… with numpy

- Use generic TypeVar _T for circular_shift instead of np.generic
- Remove explicit type annotation from MEYER_TRANSITION_POLYNOMIAL (use np.float64)
- Add comments for matplotlib to_rgba accepting scalars (type stub limitation)
- Fix torch.sqrt argument type by replacing sum() with explicit loop
- Align torch _struct_monogenic with numpy: stack channels along last axis
  (reduces nesting from 4 to 3 levels, uses ndim+2 channels)
- Add _vect_monogenic for channel-wise coefficient serialization
- Fix _UDCTFunction.backward signature to use *grad_outputs (LSP compliance)
- Add ty: ignore comments for dynamic FunctionCtx.udct attribute
- Add ty configuration to pyproject.toml with environment and rules
- Configure ty to check src/ and tests/ with examples excluded
- Set unused-ignore-comment to warn during migration period
- Add ty ignore comments for matplotlib to_rgba scalar arguments
- Update documentation to reference both ty and mypy as type checkers
- Keep mypy configuration for compatibility during transition
@codecov
Copy link

codecov bot commented Jan 12, 2026

Codecov Report

❌ Patch coverage is 84.95575% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.90%. Comparing base (594b611) to head (291a671).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/curvelets/torch/_udct.py 29.16% 17 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #57      +/-   ##
==========================================
- Coverage   94.26%   93.90%   -0.36%     
==========================================
  Files          27       27              
  Lines        1848     1855       +7     
==========================================
  Hits         1742     1742              
- Misses        106      113       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cako cako merged commit 63956ee into main Jan 12, 2026
26 of 29 checks passed
@cako cako deleted the feat/ty branch January 12, 2026 07:01
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