Skip to content

TST: Use the annual frequency alias that works in every supported pandas - #751

Merged
bashtage merged 2 commits into
mainfrom
ci-matrix-refresh
Oct 9, 2026
Merged

bashtage merged 2 commits into
mainfrom
ci-matrix-refresh

Conversation

@bashtage

@bashtage bashtage commented Oct 9, 2026

Copy link
Copy Markdown
Owner

test_input_alignment.py builds its dates with freq="YE", an alias that
pandas added in 2.2. With pandas 1.4 through 2.1, which linearmodels
supports, the date index cannot be built so 3 tests fail and the 120 tests
that use the fixture error in setup.

Use ANNUAL_FREQ from linearmodels.compat.pandas, as the other tests that
need annual dates do. All of the tests in the module pass with pandas 1.4.0,
numpy 1.22.3, scipy 1.8.0 and statsmodels 0.13.1.

This was not found earlier because the CI job that was meant to test the
oldest versions did not: its pin for pandas (1.3.0) was below the minimum
that linearmodels declares (1.4.0), so installing linearmodels replaced it
by the newest pandas.

test_input_alignment.py builds its dates with freq="YE", an alias that
pandas added in 2.2. With pandas 1.4 through 2.1, which linearmodels
supports, the date index cannot be built so 3 tests fail and the 120 tests
that use the fixture error in setup.

Use ANNUAL_FREQ from linearmodels.compat.pandas, as the other tests that
need annual dates do. All of the tests in the module pass with pandas 1.4.0,
numpy 1.22.3, scipy 1.8.0 and statsmodels 0.13.1.

This was not found earlier because the CI job that was meant to test the
oldest versions did not: its pin for pandas (1.3.0) was below the minimum
that linearmodels declares (1.4.0), so installing linearmodels replaced it
by the newest pandas.
Azure ran 15 test jobs on Python 3.10-3.13 (11 on Linux, 4 on Windows) and
Python 3.14 was only tested by the wheel workflow. Build the matrix around
3.14 instead, with 10 jobs.

| OS | Job | Python | numpy | scipy | pandas | statsmodels | Also |
|---|---|---|---|---|---|---|---|
| Linux | python314_latest | 3.14 | latest | latest | 3.0 | latest | slow tests, style |
| Linux | python314_no_binary | 3.14 | latest | latest | 3.0 | latest | no Cython extension |
| Linux | python313_recent_wheel | 3.13 | 2.2.6 | 1.15.3 | 2.3.3 | 0.14.5 | wheel, copy-on-write |
| Linux | python312_cython_coverage | 3.12 | 2.0.2 | 1.13.1 | 2.2.3 | 0.14.4 | Cython coverage |
| Linux | python311_mid_sdist | 3.11 | 1.24.4 | 1.10.1 | 2.0.3 | 0.14.0 | sdist |
| Linux | python310_minimums | 3.10 | 1.22.3 | 1.8.0 | 1.4.0 | 0.13.1 | slow tests |
| Windows | python314_win_latest | 3.14 | latest | latest | 3.0 | latest | |
| Windows | python310_win_numpy126 | 3.10 | 1.26.4 | 1.11.4 | 2.1.4 | 0.14.1 | |
| Linux | python314_pre | 3.14 | nightly | nightly | nightly | latest | tests may fail |
| Linux | python315_latest | 3.15 | latest | latest | 3.0 | latest | tests may fail |

The pins go from the oldest supported versions on 3.10 to the last releases
before the newest on 3.13. Together they run linearmodels with numpy 1.x and
2.x, with pandas 1.x, 2.x and 3.x and on both sides of the pandas 2.1 and 2.2
checks in linearmodels/compat. The nightly builds are the only way to run
with scipy 2.0. The sdist and the wheel are built with the newest numpy and
tested with an older one, as users of the wheels on PyPI do.

The old pins did not do what they said. python310_minimums asked for
pandas~=1.3.0, which is below the pandas>=1.4.0 that linearmodels declares, so
installing linearmodels replaced it by pandas 2.3.3. The `~=` pins also select
the newest patch release (numpy 1.22.4, statsmodels 0.13.5) and the versions
of matplotlib, xarray, ... that were installed first were not chosen to work
with them. Now a PACKAGES variable lists the exact versions and is installed
with requirements.txt and requirements-test.txt in one pip command, after
requirements-dev.txt, so that pip chooses compatible versions of everything
else. It replaces NUMPY, SCIPY, ... and ci/install-posix.sh, and is used in
the same way on Windows.

Other changes:
- pip list runs after linearmodels is installed rather than before, so that
  it shows what is tested.
- requirements-test.txt is now installed after requirements-dev.txt, so the
  Linux jobs run pytest 9 as the Windows jobs do, not pytest 8.
- The nightly builds are installed over the normal ones, and with retries,
  instead of uninstalling numpy, scipy and pandas first, which left the job
  with nothing to test when the nightly index timed out. The variable is
  nightly, not pip.pre, because pip reads PIP_PRE as --pre for every command.
- The tests of the nightly builds and of 3.15 can fail without failing the
  job and do not upload coverage. '3.15-dev' is the newest 3.15, release
  candidates included, which UsePythonVersion only downloads with allowUnstable.
- Cython coverage is collected by the 3.12 job. With Cython 3.3 and coverage
  7.16 nothing is reported for the Cython code on 3.13 and 3.14, and coverage
  needs its C tracer for it, which is no longer the default on 3.14.
- The style checks run in one job, python314_latest, rather than in all of them.
- The wheel is built with --no-deps and the second install of
  requirements-dev.txt on Windows is gone.

The commands of each job were run on Ubuntu 24.04 (Linux) or Windows with the
Python version and pins above, and the tests pass. The pipeline itself has not
been run on Azure.
@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.58%. Comparing base (ffe6369) to head (5b89450).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #751   +/-   ##
=======================================
  Coverage   99.58%   99.58%           
=======================================
  Files         110      110           
  Lines       20327    20328    +1     
  Branches     1600     1600           
=======================================
+ Hits        20243    20244    +1     
  Misses         31       31           
  Partials       53       53           
Flag Coverage Δ
adder 99.57% <100.00%> (+<0.01%) ⬆️
subtractor 99.57% <100.00%> (+<0.01%) ⬆️

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.

@bashtage
bashtage merged commit 208845b into main Oct 9, 2026
19 of 20 checks passed
@bashtage
bashtage deleted the ci-matrix-refresh branch October 9, 2026 15:56
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