Skip to content

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

Open
juliosuas wants to merge 2 commits into
arrow-py:masterfrom
juliosuas:fix/span-range-interval-type-hints
Open

juliosuas wants to merge 2 commits into
arrow-py:masterfrom
juliosuas:fix/span-range-interval-type-hints

Conversation

@juliosuas

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

Restored after an accidental fork deletion. Same commits as #1267.

The windows-latest (pypy-3.11) job has failed since May 2026 with
"OSError: Connection broken: IncompleteRead" during the first pip
install, while every other job passes.

Two things in the workflow make that job fragile:

- The pip cache key only depends on the OS, so the PyPy job restores
  an HTTP cache written by the CPython jobs (and by newer pip
  versions) on the same OS.
- setup-python leaves PyPy on Windows with a mixed pip install
  (pip 24.0 metadata over newer pip code, actions/setup-python#1348),
  and the bare "pip" launcher is then used to upgrade pip in place.

Key the cache per interpreter and invoke pip as "python -m pip", which
is the workaround recommended in actions/setup-python#1348.
@codecov

codecov Bot commented Sep 30, 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 (aed2194).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #1342   +/-   ##
=========================================
  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.

This branch has not been deployed

No deployments
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