Skip to content

fix(types): use Union[Arrow, dt_datetime] for span_range and interval start/end params - #1267

Closed
juliosuas wants to merge 1 commit into
arrow-py:masterfrom
juliosuas:fix/span-range-interval-type-hints
Closed

fix(types): use Union[Arrow, dt_datetime] for span_range and interval start/end params#1267
juliosuas wants to merge 1 commit into
arrow-py:masterfrom
juliosuas:fix/span-range-interval-type-hints

Conversation

@juliosuas

@juliosuas juliosuas commented Apr 3, 2026

Copy link
Copy Markdown

Fixes #1210.

Arrow.span_range() and Arrow.interval() accept start and end bounds like
Arrow.range() does, but their annotations only allowed datetime.

This updates those annotations to accept Arrow | datetime and normalizes
Arrow bounds before passing them through fromdatetime().

The test dependency markers also skip two optional test-only dependencies on
Windows PyPy. The affected dateparser regression test already uses
pytest.importorskip("dateparser"), and pre-commit is only needed by the
lint environment.

Tests:

tox -e lint
tox -e py314

@codecov

codecov Bot commented Apr 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2224255) to head (36af9c0).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #1267   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines         2315      2315           
  Branches       358       358           
=========================================
  Hits          2315      2315           

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

@juliosuas
juliosuas force-pushed the fix/span-range-interval-type-hints branch 2 times, most recently from f6c4a7c to b058de2 Compare June 25, 2026 21:59
@juliosuas
juliosuas force-pushed the fix/span-range-interval-type-hints branch from b058de2 to 36af9c0 Compare June 25, 2026 22:09
@juliosuas juliosuas closed this by deleting the head repository Aug 26, 2026
@juliosuas

Copy link
Copy Markdown
Author

Accidentally closed when the source fork was deleted during a profile cleanup. Same commits restored here: #1342

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.

Type hints for Arrow.interval should show Arrow as possible type for start and end arguments

1 participant