workaround for python2.5 typing origin change#675
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (2)
|
| Layer / File(s) | Summary |
|---|---|
NumPy array origin and dtype extraction plugins/python/python/phlex/_typing.py |
normalize_type matches both np.ndarray and np.typing.NDArray, and uses different dtype-argument extraction for each convention. |
Estimated code review effort
🎯 1 (Trivial) | ⏱️ ~5 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Title check | The title points to Python 2.5, but the change is actually a NumPy 2.5 typing-origin workaround. | Rename it to mention NumPy 2.5 and the typing.NDArray origin change, e.g. "work around NumPy 2.5 typing.NDArray origin change". |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
21 fixed, 0 new since branch point (7409297) ✅ 21 CodeQL alerts resolved since the branch point
Review the full CodeQL report for details. |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #675 +/- ##
==========================================
+ Coverage 83.55% 83.60% +0.04%
==========================================
Files 170 170
Lines 6283 6300 +17
Branches 706 708 +2
==========================================
+ Hits 5250 5267 +17
Misses 810 810
Partials 223 223
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
In numpy 2.5, the
__origin__of anytyping.NDArray[]points to the generic type (ie. .typing.NDArrayitself), rather than the base type (ie.numpy.ndarray). The latter is the convention for container types (e.g.types.List), the former for descriptive types liketypes.UnionType. It's probably an unintended consequence of this:Nevertheless, this PR supports both, regardless whether 2.5.0 is used in the wild and/or not fixed later.
normalize_typeinplugins/python/python/phlex/_typing.pyto recognize bothnp.ndarrayandnp.typing.NDArrayas NumPy array origins.np.ndarraycontinues to use the existing second-type-argument pattern when present.np.typing.NDArraynow uses its single type argument directly as the dtype.__origin__behavior while remaining compatible with the prior behavior.