Skip to content

Auto backend Selection#195

Merged
HugoPerrier merged 39 commits into
masterfrom
auto_backend
Feb 19, 2026
Merged

Auto backend Selection#195
HugoPerrier merged 39 commits into
masterfrom
auto_backend

Conversation

@HugoPerrier
Copy link
Copy Markdown
Contributor

This pull request introduces improvements to the backend management system in Melusine with dynamic backend selection based on data type. It also updates documentation and tests to reflect these changes, and adds minor features and fixes.

Backend system improvements:

  • Refactored ActiveBackend to support a list of backends (backend_list) instead of a single backend, allowing multiple backends to be registered and prioritized. The backend is now automatically selected based on the data type using a new select_backend method. Added methods to add and reset backends, and updated all backend operations to use the selected backend. (melusine/backend/active_backend.py)
  • Introduced a supported_types property in the BaseTransformerBackend abstract class and implemented it in DictBackend and PandasBackend to declare supported data types for each backend. (melusine/backend/base_backend.py, melusine/backend/dict_backend.py, melusine/backend/pandas_backend.py)

Debug mode documentation:

  • Updated code examples and documentation for debug_mode activation. (docs/tutorials/05b_MelusineDetectorsAdvanced.md, docs/docs_src/BasicClassification/tutorial001.py, docs/docs_src/GettingStarted/tutorial002.py, docs/docs_src/MelusineDetectors/tutorial003.py)

Other improvements and fixes:

  • Added new keywords ("Copie", "Attachments") to the segmentation regex list for improved email segmentation. (melusine/processors.py)
  • Exported MelusinePipeline in the top-level package. (melusine/__init__.py)

…date_sklearn_pipeline

# Conflicts:
#	melusine/pipeline.py
Copy link
Copy Markdown

Copilot AI left a comment

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 refactors Melusine’s backend management to support multiple registered backends and automatic backend selection based on input data type, while updating tests and documentation to reflect the new debug-mode usage and adding a small email-segmentation enhancement.

Changes:

  • Refactor ActiveBackend to maintain a prioritized backend list and auto-select a backend via select_backend() based on supported_types.
  • Add supported_types to the backend interface and implement it for dict/pandas backends.
  • Update tests/docs for backend behavior and debug-mode usage; extend segmentation keywords.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
melusine/backend/active_backend.py Introduces backend list management, backend auto-selection, and updates backend operations to route through selected backend.
melusine/backend/base_backend.py Extends backend interface with supported_types.
melusine/backend/dict_backend.py Declares dict support via supported_types.
melusine/backend/pandas_backend.py Declares DataFrame support via supported_types.
melusine/processors.py Adds segmentation keywords (“Copie”, “Attachments”).
melusine/utils/show_versions.py Adjusts coverage pragmas in dependency version probing.
melusine/__init__.py Exports MelusinePipeline at top-level and bumps version to 3.3.1.
tests/conftest.py Replaces dict-backend fixture with a backend reset fixture.
tests/backend/test_backends.py Adds coverage for backend selection and backend list behaviors.
tests/processors/test_processors.py Updates processor test to call fit() before use.
tests/pipeline/test_pipeline_basic.py Adds debug-mode test coverage and adjusts basic pipeline flow.
tests/pipeline/test_pipeline_testing.py Removes explicit dict-backend fixture usage.
tests/io_mixin/test_io_mixin.py Removes explicit dict-backend fixture usage.
tests/functional/test_emails_generic.py Removes explicit dict-backend fixture usage.
tests/detectors/test_thanks_detector.py Removes explicit dict-backend fixture usage.
tests/detectors/test_basic_detector.py Adjusts dict-based detector test to call fit().
tests/detectors/test_emergency_detector.py Adds a new detector test focusing on debug output.
docs/tutorials/05b_MelusineDetectorsAdvanced.md Updates debug-mode documentation to emphasize debug_mode argument.
docs/docs_src/BasicClassification/tutorial001.py Updates example to use debug_mode=True instead of df.debug.
docs/docs_src/GettingStarted/tutorial002.py Updates example to use debug_mode=True instead of df.debug.
docs/docs_src/MelusineDetectors/tutorial003.py Updates example to use debug_mode=True instead of df.debug.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread melusine/backend/active_backend.py
Comment thread melusine/backend/active_backend.py Outdated
Comment thread tests/pipeline/test_pipeline_basic.py
Comment thread docs/tutorials/05b_MelusineDetectorsAdvanced.md Outdated
Comment thread tests/detectors/test_emergency_detector.py Outdated
Comment thread tests/conftest.py Outdated
Comment thread melusine/backend/dict_backend.py Outdated
Comment thread melusine/backend/pandas_backend.py Outdated
@HugoPerrier HugoPerrier changed the title Auto backend Auto backend Selection Feb 19, 2026
@HugoPerrier HugoPerrier merged commit 7204bc3 into master Feb 19, 2026
12 checks passed
@HugoPerrier HugoPerrier deleted the auto_backend branch February 19, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants