Skip to content

[MNT] Enhance compatibility with Python 3.13/3.14 and update dependencies - #26

Merged
fkiraly merged 15 commits into
sktime:mainfrom
siddharth7113:py313-314-compat
Aug 9, 2026
Merged

[MNT] Enhance compatibility with Python 3.13/3.14 and update dependencies#26
fkiraly merged 15 commits into
sktime:mainfrom
siddharth7113:py313-314-compat

Conversation

@siddharth7113

@siddharth7113 siddharth7113 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #20.

Note: partially merged with #30, therefore some of the below description is no longer accurate.

Summary

Makes pycaret installable and importable on python 3.13 and 3.14 while keeping 3.9–3.12 working. The full CI matrix now installs on every OS/python combination (on main, every 3.13/3.14 job fails at the install step). Remaining test failures are at parity with main except two items pending direction (see last section).

Dependency changes and why

Dependency Before After Why
requires-python >=3.9,<3.13 >=3.9,<3.15
numpy >=1.21,<1.27 >=1.21,<3 no numpy 1.x wheel exists for cp313 (verified via wheels-only resolution); 2.x is required for 3.13+
scipy >=1.6.1,<=1.11.4 >=1.6.1,<2
matplotlib <3.8.0 <4 no 3.7.x wheel for 3.13; original cap reason (removed stem(use_line_collection)) no longer applies to pycaret core, one issue in plotting, yellowbrick, see below
joblib >=1.2.0,<1.4 >=1.2.0 1.3.x and 1.4.x crash on python 3.14 (Hasher._batch_setitems - cpython 3.14 changed pickle internals); 1.5.0+ verified working; the <1.4 cap protected internal/memory.py, which is now ported (below)
trio >=0.22.0,<0.25.0 removed not imported anywhere in pycaret;
deprecation >=2.1.0 removed not imported anywhere in pycaret
classifiers up to 3.12 + 3.13, 3.14 metadata

Also annotated jinja2 (needed by pandas Styler) and kaleido (needed by plotly's png renderer, which pycaret auto-selects for large time-series plots).

Per-file changes

  • pyproject.toml
  • pycaret/__init__.py
  • pycaret/internal/patches/sklearn.py, pycaret/internal/preprocess/preprocessor.pynp.product to np.prod, np.NaN to np.nan. Both were removed in numpy 2.0; the replacements are identical in behavior and exist on numpy 1.x, so older environments are unaffected.
  • pycaret/utils/_show_versions.py - drop deprecation from the version listing.
  • pycaret/internal/memory.py :
    • This module speeds up joblib caching (xxhash instead of md5, O(1) hashing, only caching calls slower than 0.1s, periodic cache-size reduction) by subclassing joblib's Memory/MemorizedFunc and overriding private joblib internals.
    • joblib 1.4/1.5 no longer have same interface: bytes_limit moved from Memory.__init__ to Memory.reduce_size, and MemorizedFunc._get_output_identifiers was replaced by func_id + _get_args_id with new _before_call/_after_call hooks. With joblib 1.5 (required for 3.14), every setup() call raised TypeError, then AttributeError.
    • Fix: detect the installed API by signature/attribute. FastMemory accepts bytes_limit on both APIs and routes it appropriately. FastMemorizedFunc is now an alias resolved at import time between the untouched legacy implementation (joblib < 1.4) and a new, much smaller implementation for joblib >= 1.4 smaller because upstream fixed the double-hashing the legacy class worked around, so only two overrides remain: _get_args_id (xxhash argument hashing) and _after_call (skip persisting fast calls).
    • FastMemory.__del__ no longer raises during interpreter teardown or after failed construction.

Core is installable on 3.13 and 3.14

  • Resolver, wheels-only, all six versions :
    uv pip install '.[dev,test,mlops]' --dry-run --only-binary :all: --no-binary mljar-scikit-plot resolves successfully on 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 (mljar-scikit-plot is pure-python and ships only an sdist).

  • CI install step is coompleted job of the PR run, including 3.13/3.14 on ubuntu, windows and macOS.

  • Test parity: locally, tests/test_preprocess.py tests/test_pipeline.py tests/test_utils.py on 3.13 and 3.14 both give 15 failed / 71 passed ,identical to failing set as main's CI.

Relax numpy, scipy, matplotlib and joblib bounds that blocked
installation on python 3.13/3.14, widen requires-python and the runtime
version gate to <3.15, add 3.13/3.14 trove classifiers, and remove the
unused trio and deprecation dependencies (trio 0.24 cannot import on
python 3.13; neither package is imported by pycaret).
np.product -> np.prod and np.NaN -> np.nan; both spellings behave
identically on numpy 1.x, so older environments are unaffected.
joblib 1.4 deprecated and 1.5 removed the bytes_limit argument of
Memory.__init__ and reworked the private MemorizedFunc API that
pycaret.internal.memory extends. Detect the installed API and use a
dedicated FastMemorizedFunc implementation for each, preserving the
xxhash argument hashing and min_time_to_cache behaviour. joblib 1.3.2
cannot hash on python 3.14, so the new API path is required there.
@siddharth7113
siddharth7113 marked this pull request as draft August 7, 2026 09:58
@siddharth7113 siddharth7113 changed the title Enhance compatibility with Python 3.13/3.14 and update dependencies [MNT] Enhance compatibility with Python 3.13/3.14 and update dependencies Aug 7, 2026
The previous comment claimed the old use_line_collection cap was fully
obsolete (fixed in shap 0.44).
@fkiraly

fkiraly commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

👀 funny to see you here - are you stalking me 😁

@fkiraly fkiraly linked an issue Aug 7, 2026 that may be closed by this pull request
@siddharth7113

Copy link
Copy Markdown
Contributor Author

👀 funny to see you here - are you stalking me 😁

Maybe 😛, I was looking at pyproject.toml then I got pulled in the rabbit hole.

Verified empirically: joblib 1.4.2 raises the same
Hasher._batch_setitems TypeError on python 3.14 as 1.3.x; the fix
first works in joblib 1.5.0.
@siddharth7113
siddharth7113 marked this pull request as ready for review August 7, 2026 11:32
@fkiraly

fkiraly commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Maybe 😛, I was looking at pyproject.toml then I got pulled in the rabbit hole.

I think this pyproject.toml is not just a rabbit hole but already far past the Tolman-Oppenheimer-Volkoff limit

@fkiraly
fkiraly requested review from amotl and fkiraly as code owners August 9, 2026 09:02
@fkiraly fkiraly added the maintenance Continuous integration, unit testing & package distribution label Aug 9, 2026
@fkiraly

fkiraly commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

FYI, I merged #30 into this. Kindly check if there are any merge accidents - I went through manually and hope not.

@fkiraly
fkiraly merged commit be0d382 into sktime:main Aug 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Continuous integration, unit testing & package distribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MNT] python 3.13 and 3.14 compatibility of dependencies

2 participants