Repository navigation
CI: Run fewer, leaner Azure jobs - #11324
Merged
Merged
Conversation
Tweedie.loglike_obs, and so the llf of a GLM with the Tweedie family, used scipy.special.log_wright_bessel with SciPy 1.14 and later. In SciPy 1.14.0 and 1.14.1 it is wrong for some arguments: log_wright_bessel(1, 0, 2) is 4.7897, while log(wright_bessel(1, 0, 2)) and SciPy 1.15.0 give 1.5665. With SciPy 1.14 the density of the Tweedie family did not integrate to 1 (1.25, 2.09 and 1.01 for var_power 1.9, 1.5 and 1.1 in test_tweedie_loglike_obs), and the llf in TestGlmTweedieAwNr was -8504.98 instead of the reference value from R, -8669.18. With SciPy < 1.15 loglike_obs uses wright_bessel, as it did with SciPy < 1.14, and test_tweedie_log_wright_bessel, which checks the values of the log path, is skipped. No CI job uses SciPy 1.14, so the tests only fail on main with SciPy 1.14 installed: with SciPy 1.14.0, test_tweedie_loglike_obs (3 cases) and TestGlmTweedieAwNr::test_basic fail without this change and pass with it.
Raise the minimum supported versions further than statsmodels#11316 did: - Python: 3.10 -> 3.11 - SciPy: 1.13 -> 1.14 (released June 2024) - pandas: 2.2.2 -> 2.2.3 (released September 2024) SciPy 1.14.0 and pandas 2.2.3 are the first releases of each after NumPy 2.0.0. The build requirement on SciPy is raised to 1.14 as well, so that the build and runtime floors agree. The Python 3.10 classifier is removed, and ruff and black target Python 3.11 (ruff finds nothing new). CI: the jobs on Python 3.10, which can no longer install statsmodels, move to Python 3.11 (python_311, python_311_legacy_blas, python311_macos_compat and python311_win_compat). python_311, which tests the oldest supported Python with the minimum dependencies, pins NumPy 2.0.0, SciPy 1.14.0 and pandas 2.2.3.
Azure runs are queued for many hours: a run of the pipeline used about
300 job-minutes in 15 jobs, and every merge into main started its own
run. This reduces both.
- Batch the runs of main. Merges that arrive while a run of main is in
progress are built together in one run when it finishes, which is what
the queued merge runs were reduced to by hand.
- 15 -> 10 jobs, so that a run fits in the 10 parallel jobs at once:
- Drop python_311_legacy_blas. With NumPy 2.0.0, SciPy 1.14.0 and
pandas 2.2.3 as the minimums, python_311 tests the same versions;
the conda-forge OpenBLAS it used is what the PyPI wheels use too.
The Miniforge step, the conda list step and the conda code of
install-posix.sh are removed with it.
- Drop python_311_wheel. python_312_sdist builds a wheel from the sdist
and tests the installed package, and the wheel build of GitHub
Actions tests installed wheels on Linux and Windows.
- Merge python_314t_parallel into python_314t_latest, which runs the
pytest-run-parallel check after its tests.
- Drop python313_win_latest (Windows). The wheel build of GitHub
Actions tests the newest Python with the GIL on Windows on every PR.
- Keep one macOS job, an editable install on Python 3.14.
- python_311 also pins patsy 0.5.6 and formulaic 1.1.0, so it tests
every declared runtime minimum except packaging 21.3, which is too
old for meson-python and so cannot be installed for the editable
build.
- Slow tests run in the oldest and the newest job only, not also in
python_313_copy_on_write.
- Coverage is measured on Python 3.14+ only (python_315_no_formulaic and
python_314t_latest), where coverage.py uses sys.monitoring. On Python
3.13 it used a trace function and the job needed about 45% longer
than the other jobs that run the full suite. The X-13 tests move with
the coverage to python_315_no_formulaic.
Fixes found on the way:
- python_314t_latest pinned PANDAS_VERSION: 3, which pip reads as
pandas==3.0.0, so the "latest" job tested pandas 3.0.0 while 3.1.1 is
out. It now installs the latest pandas.
- install-posix.sh ended with the PIP_PRE block, so a failed install of
the pinned versions did not fail the step and the editable install
then pulled newer versions. It now exits on that failure.
- The parallel run wrote junit/test-results.xml over the results of the
main run. It now writes junit/parallel/test-results.xml.
- The wheel build workflow set OPENLAS_NUM_THREADS instead of
OPENBLAS_NUM_THREADS, and it now cancels the running build of a pull
request when a new commit is pushed, as the other workflows do.
|
Thanks for the pull request! Neither box in the AI Disclosure section is ticked. Please tick the one that applies. Per the AI Policy, every pull request must state whether AI tools were used. Please edit the PR description so it includes the section below, tick exactly one box, and, if AI tools were used, replace the placeholders with the tool name(s) and how they were used. #### AI Disclosure
Contributions must comply with the statsmodels [AI Policy](https://www.statsmodels.org/devel/dev/ai-policy.html).
- [ ] No AI tools were used to develop this pull request.
- [ ] AI tools were used.
Tool(s): `<name(s), e.g. Copilot, Claude, ChatGPT>`.
Used for: `<e.g. drafting an implementation, writing tests, debugging, editing docstrings>`.
I have personally read, understood, and can explain every line of this diff, and
have verified the statistical/numerical correctness of the change.This check re-runs automatically when the description is edited. |
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.
Azure runs are queued for many hours: a run of the pipeline used about
300 job-minutes in 15 jobs, and every merge into main started its own
run. This reduces both.
progress are built together in one run when it finishes, which is what
the queued merge runs were reduced to by hand.
pandas 2.2.3 as the minimums, python_311 tests the same versions;
the conda-forge OpenBLAS it used is what the PyPI wheels use too.
The Miniforge step, the conda list step and the conda code of
install-posix.sh are removed with it.
and tests the installed package, and the wheel build of GitHub
Actions tests installed wheels on Linux and Windows.
pytest-run-parallel check after its tests.
Actions tests the newest Python with the GIL on Windows on every PR.
every declared runtime minimum except packaging 21.3, which is too
old for meson-python and so cannot be installed for the editable
build.
python_313_copy_on_write.
python_314t_latest), where coverage.py uses sys.monitoring. On Python
3.13 it used a trace function and the job needed about 45% longer
than the other jobs that run the full suite. The X-13 tests move with
the coverage to python_315_no_formulaic.
Fixes found on the way:
pandas==3.0.0, so the "latest" job tested pandas 3.0.0 while 3.1.1 is
out. It now installs the latest pandas.
the pinned versions did not fail the step and the editable install
then pulled newer versions. It now exits on that failure.
main run. It now writes junit/parallel/test-results.xml.
OPENBLAS_NUM_THREADS, and it now cancels the running build of a pull
request when a new commit is pushed, as the other workflows do.
Stacked on #11321 (and so on #11320), whose commits this PR includes; the last
commit is the one to review.
Expected effect
From the median job durations of the last 8 runs of main: the jobs that are
dropped or merged used about 75 job-minutes, and python_313_copy_on_write
should need about 17 fewer without the slow tests and the coverage by trace
function. A run should use about 205 job-minutes instead of about 300, in 10
jobs, so it fits in the 10 parallel jobs. Batching the runs of main removes
most of the queued merge runs: on 2026-11-28, 13 runs of main were queued.
Neither number can be measured before this is merged and has run on Azure.
Verification
The changed Linux legs were run as Azure runs them (the expanded variables,
each
script:step withbash --noprofile --norc, Ubuntu 24.04):python_311(NumPy 2.0.0, SciPy 1.14.0, pandas 2.2.3, Cython 3.0.10,patsy 0.5.6, formulaic 1.1.0, installed by the new
PATSY_VERSIONandFORMULAIC_VERSION), without the slow tests: 33558 passed, 1108 skipped,139 xfailed. The full suite of this leg without the patsy and formulaic
pins passed in MAINT: Require Python 3.11, SciPy 1.14 and pandas 2.2.3 #11321.
python_315_no_formulaicwith coverage and the X-13 step: 33767 passed,519 skipped, 144 xfailed, 95% coverage; the X-13 tests, which ran with
pandas 2.3.3 before and now run with pandas 3.1.1: 137 passed.
Coverage cost, measured on Python 3.15 with
statsmodels/tsa(19292 tests,12 workers, one run after the other on an idle machine): 131 to 141 s
without coverage, 136 s with coverage.py's
sys.monitoringcore (itsdefault on 3.14+), and 210 s with its trace function, the core used on
Python 3.13.
Not run locally: the Windows and macOS jobs (only jobs removed, and a
comment) and python_314t_latest, whose steps only changed conditions and the
path of the parallel run's JUnit file. Azure runs them on this PR.
AI Disclosure
Contributions must comply with the statsmodels AI Policy.
Tick exactly one of the following. If AI tools were used, replace the
<...>placeholders in the second option with the tool name(s) and how the tool's output was
used.
Tool(s): Claude Code.
Used for: analysing the Azure run times, reconfiguring the jobs, running the changed jobs locally and measuring the cost of coverage.
I have personally read, understood, and can explain every line of this diff, and
have verified the statistical/numerical correctness of the change.