Skip to content

Revert "[MNT] remove unnecessary dependencies - numba" - #35

Merged
fkiraly merged 1 commit into
mainfrom
revert-23-remove-numba
Aug 8, 2026
Merged

Revert "[MNT] remove unnecessary dependencies - numba"#35
fkiraly merged 1 commit into
mainfrom
revert-23-remove-numba

Conversation

@fkiraly

@fkiraly fkiraly commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Reverts #23 - numba seems coupled to tests as well as one specific estimator.

This feels like bad design and too high coupling, but is outside the scope of the initial restoration work. Also see discussion in #30.

Copilot AI lite review requested due to automatic review settings August 8, 2026 15:55
@fkiraly fkiraly added the maintenance Continuous integration, unit testing & package distribution label Aug 8, 2026
@fkiraly
fkiraly merged commit e329402 into main Aug 8, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reverts the earlier removal of numba by reintroducing it as a core dependency, restoring version reporting, and adding a pytest fixture to disable Numba JIT during anomaly model equality tests (to avoid PyOD/Numba failures under pytest).

Changes:

  • Add numba back to core dependencies in pyproject.toml.
  • Add numba to the dependency version report list (pycaret/utils/_show_versions.py).
  • Add a disable_numba pytest fixture and apply it to the anomaly equality test (tests/test_models.py).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/test_models.py Adds a disable_numba fixture and uses it in the anomaly model equality test to avoid JIT-related failures.
pyproject.toml Restores numba as an install-time dependency.
pycaret/utils/_show_versions.py Adds numba to the dependency version reporting list.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/test_models.py
Comment on lines +17 to +22
"""
Forces numba to use the original python functions.

This is required as numba code in pyod (anomaly) seems to not work
correctly leading to exceptions if ran from within pytest.
"""
Comment thread tests/test_models.py
Comment on lines +23 to +35
old = numba.config.DISABLE_JIT
# This will not affect already compiled functions...
numba.config.DISABLE_JIT = True

# ...which is why we force the Numba dispatcher to simply
# call the underlying python function for already compiled
# ones
def pyfunc_call(self, *args, **kwargs):
return self.py_func(*args, **kwargs)

with patch.object(Dispatcher, "__call__", pyfunc_call):
yield
numba.config.DISABLE_JIT = old
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.

2 participants