Repository navigation
MAINT: Use dependency groups instead of requirements files - #11325
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.
Move the development dependencies into PEP 735 dependency groups in pyproject.toml, and remove the files from the repository root that pyproject.toml or the documentation make unnecessary. Dependency groups ([dependency-groups]), installed with `python -m pip install --group <name>` (pip 25.1 or later): - build: the build requirements, for an editable install with --no-build-isolation (the same as [build-system]). - test: pytest and its plugins, and the optional dependencies that the tests use (matplotlib, joblib, colorama, jinja2, polars, pyarrow). - lint: ruff. - doc: the documentation build. - dev: build, test and lint. They replace requirements-dev.txt and requirements-doc.txt, and the test, doc and dev extras, which were published in the package metadata although only developers need them. requirements.txt repeated the runtime dependencies of [project], which installing statsmodels installs. The polars extra stays, since it is for users. Other changes to pyproject.toml: - license-files includes COPYRIGHTS.txt, the copyright notices of the code from other packages that statsmodels contains, so wheels ship it. - The project URLs use the well-known labels of PEP 753, and the changelog, which pointed at the changes of arch, is now the release notes of statsmodels. - A Python 3.15 classifier (CI tests 3.15 and the installation guide lists it). - pytest no longer writes test-data.xml in the repository root on every run; CI passes --junitxml itself. Repository root: - Remove requirements.txt, requirements-dev.txt and requirements-doc.txt. - Remove MANIFEST.in: meson-python builds the sdist from the files in git and does not read it. - Remove INSTALL.txt, an outdated copy of docs/source/install.rst; the README links the installation guide. - Remove CHANGES.md, a link to the release notes, which the project URLs give now. - Move L1_ADDITION.txt, notes on the l1 demo, next to the demo as archive/examples/l1_demo/README.txt. - Move codecov.yml to .github/codecov.yml, where Codecov also reads it. CI and the documentation install the groups: the Azure jobs and the GitHub workflows for the documentation, lint and public API coverage, whose pip cache now keys on pyproject.toml. The Windows job lists the packages after the editable install, which installs pandas and patsy. The installation guide, the testing notes, docs/README.md, AGENTS.md, CONTRIBUTING.md and the README describe the groups, replacing instructions for extras that did not exist (.[develop], .[docs]).
bashtage
force-pushed
the
wip-dependency-groups
branch
from
November 28, 2026 20:45
4713b12 to
074f81f
Compare
bashtage
added a commit
to bashtage/statsmodels
that referenced
this pull request
Nov 28, 2026
Update the documentation for the minimum versions of statsmodels#11316 and statsmodels#11321, now Python 3.11, NumPy 2.0, SciPy 1.14 and pandas 2.2.3: - The release summary and "Minimum dependency versions raised" in the 0.16.0 release notes, which also say that SciPy 1.14.0 and pandas 2.2.3 are the first releases of each after NumPy 2.0.0 and that building from source requires SciPy 1.14. - The supported Python versions and the minimum dependencies in docs/source/install.rst. INSTALL.txt is left alone, since statsmodels#11325 removes it. - The target Python version for ruff in AGENTS.md.
2 tasks
bashtage
marked this pull request as ready for review
November 28, 2026 20:47
|
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.
Move the development dependencies into PEP 735 dependency groups in
pyproject.toml, and remove the files from the repository root that
pyproject.toml or the documentation make unnecessary.
Dependency groups ([dependency-groups]), installed with
python -m pip install --group <name>(pip 25.1 or later):--no-build-isolation (the same as [build-system]).
tests use (matplotlib, joblib, colorama, jinja2, polars, pyarrow).
They replace requirements-dev.txt and requirements-doc.txt, and the
test, doc and dev extras, which were published in the package metadata
although only developers need them. requirements.txt repeated the runtime
dependencies of [project], which installing statsmodels installs. The
polars extra stays, since it is for users.
Other changes to pyproject.toml:
code from other packages that statsmodels contains, so wheels ship it.
changelog, which pointed at the changes of arch, is now the release
notes of statsmodels.
lists it).
run; CI passes --junitxml itself.
Repository root:
git and does not read it.
README links the installation guide.
give now.
archive/examples/l1_demo/README.txt.
CI and the documentation install the groups: the Azure jobs and the
GitHub workflows for the documentation, lint and public API coverage,
whose pip cache now keys on pyproject.toml. The Windows job lists the
packages after the editable install, which installs pandas and patsy.
The installation guide, the testing notes, docs/README.md, AGENTS.md,
CONTRIBUTING.md and the README describe the groups, replacing
instructions for extras that did not exist (.[develop], .[docs]).
Stacked on #11324 (and so on #11321 and #11320), whose commits this PR
includes; the last commit is the one to review. #11322 leaves INSTALL.txt
alone, so the two do not conflict.
Verification
files (2691 -> 2685 files), so MANIFEST.in had no effect.
License-FileLICENSE.txt and COPYRIGHTS.txt,the five
Project-URLs,Provides-Extra: polarsonly, classifiers 3.11to 3.15.
--group dev --group doc(the documentation workflow)resolves, and
--group lintinstalls ruff, which passes.python_311Azure leg, run as Azure runs it withpip install --group devin install-posix.sh (NumPy 2.0.0, SciPy 1.14.0,pandas 2.2.3, Cython 3.0.10, patsy 0.5.6, formulaic 1.1.0), without the
slow tests: 33558 passed, 1108 skipped, 139 xfailed, the same as with the
requirements files.
Not run locally: the Windows job and the GitHub workflows; CI 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: moving the dependencies into dependency groups, finding the files and documentation that referred to them, and checking the sdist, the metadata and the CI install.
I have personally read, understood, and can explain every line of this diff, and
have verified the statistical/numerical correctness of the change.