Repository navigation
TST: Use the annual frequency alias that works in every supported pandas - #751
Merged
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.