Skip to content

unxt 2.0.1 makes ty report phantom missing-argument errors in downstream dataclass constructors #889

Description

@nstarman

Upgrading unxt 2.0.0 → 2.0.1 (no other change) makes ty emit 13 false missing-argument errors in coordinax, failing its type-check gate. Runtime is unaffected — the full test suite passes.

Reproduction

In coordinax at 2680b1a (pristine, no source change), bump only the unxt floor:

-  "unxt>=2.0",
+  "unxt>=2.0.1",
$ uv run ty check .
src/coordinax/vectors/_src/point.py:206:12: error[missing-argument] No argument provided for required parameter `rep`
src/coordinax/vectors/_src/point.py:239:12: ...
src/coordinax/vectors/_src/point.py:273:12: ...
src/coordinax/vectors/_src/point.py:304:12: ...
src/coordinax/vectors/_src/register_cx.py:361:12: ...
src/coordinax/vectors/_src/tangent.py:198:12: ...
packages/coordinaxs.interop.astropy/.../frames.py:344:14: ...
packages/coordinaxs.interop.astropy/.../vec_constructors.py:  (5 sites)
packages/coordinaxs.interop.astropy/.../vec_converters.py:388:12: error[missing-argument] No arguments provided for required parameters `basis`, `semantic`

With unxt==2.0.0 the same tree reports 6 diagnostics, all warnings, and the gate passes.

The errors are wrong

The flagged call is

return cls(data=data, chart=chart)

and Point has no rep field at all:

>>> [f.name for f in dataclasses.fields(cxv.Point)]
['data', 'chart', 'frame']

data and chart have no default, frame does. So the call is complete, and rep is not a constructor parameter. Every test passes on 2.0.1 — this is inference, not behaviour.

Likely cause

2.0.1 backports #816 (adopt quax-blocks v5 __make__ for unchecked quantity construction, PR #817), which changes how the unchecked constructor is attached:

src/unxt/_src/quantity/base.py:199
    _mk = quax_blocks.SupportsUncheckedMake.__dict__["__make__"]

That appears to change the __init__ signature ty synthesises for downstream subclasses of the affected bases.

Why it matters now

This blocks the ustrip work from #880. The chain is:

  1. unxts.linalg 2.0.4 ships the new ustrip/unit_of dispatches — the thing downstream wants.
  2. 2.0.4 calls QuantityMatrix._mk, which needs unxt >= 2.0.1 (its declared unxt>=2.0.0 floor is wrong — unxts.linalg 2.0.4 is unusable with any released unxt: QuantityMatrix._mk does not exist #886).
  3. unxt 2.0.1 fails coordinax's ty gate with the phantom errors above.

So there is currently no combination that gives a downstream user the new ustrip and a passing type-check. Reverted the pins in GalacticDynamics/coordinax#716 pending this.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions