Skip to content

Support numpy < 2. - #23

Merged
roytsmart merged 2 commits into
mainfrom
feature/numpy-1
Sep 29, 2026
Merged

roytsmart merged 2 commits into
mainfrom
feature/numpy-1

Conversation

@roytsmart

@roytsmart roytsmart commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

The numpy>2 requirement was added in #8 only because np.trapezoid is new in numpy 2.0. Nothing else in colorsynth needs numpy 2.

Changes

  • _colorsynth.py imports numpy.trapezoid as _trapezoid, and falls back to numpy.trapz on numpy < 2. The fallback can't just call np.trapz, because numpy 2.4 removed it.
  • The dependency is relaxed from numpy>2 to numpy>=1.24. The old specifier also excluded numpy 2.0.0 itself, which was probably not intended.
  • tests.yml gets one extra job, ubuntu-latest, Python 3.10, numpy==1.24.*, that tests the floor. That job also uploads coverage for the np.trapz branch. The other jobs keep their names unchanged, because the repository ruleset requires them as status checks.
  • The trapezoid-equivalence test uses the same alias for its reference integral.

Testing

Run locally against the source tree:

Python numpy numba astropy result
3.10 1.24.4 0.67.0 6.1.7 79 passed
3.11 1.26.4 0.67.0 7.2.2 79 passed
3.13 2.4.6 0.64.0 7.2.0 79 passed

The warning count (30) is the same on every version. pyright 1.1.411 (the CI version) and black are clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01N6zUsPoxW26srMeWormpe8

The `numpy>2` requirement only existed because `np.trapezoid` was added in
numpy 2.0. Fall back to `np.trapz` when `np.trapezoid` is not available,
relax the requirement to `numpy>=1.24`, and test that floor in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N6zUsPoxW26srMeWormpe8
@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8142b12) to head (55b3c11).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #23   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines          450       455    +5     
=========================================
+ Hits           450       455    +5     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N6zUsPoxW26srMeWormpe8
@roytsmart
roytsmart merged commit 0cf28b7 into main Sep 29, 2026
18 checks passed
@roytsmart
roytsmart deleted the feature/numpy-1 branch September 29, 2026 23:47
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