Skip to content

Refactor and update modules for improved organization and functionality - #728

Merged
bruAristimunha merged 68 commits into
braindecode:masterfrom
bruAristimunha:modules-moving
Apr 22, 2025
Merged

bruAristimunha merged 68 commits into
braindecode:masterfrom
bruAristimunha:modules-moving

Conversation

@bruAristimunha

@bruAristimunha bruAristimunha commented Apr 20, 2025 •

Copy link
Copy Markdown
Collaborator

This update reorganizes various modules, resolves import issues, and enhances the overall structure of the codebase. It includes moving functions, updating configurations, and refining documentation to ensure better maintainability and clarity.

closed: #585, #577

@bruAristimunha

Copy link
Copy Markdown
Collaborator Author

@lucas-heck, can you review?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 the module structure by reordering and standardizing imports across various dataset and augmentation files and updates configuration in the pre-commit settings for consistent code formatting. Key changes include:

  • Reordering of imports (e.g. switching the order of BaseDataset and BaseConcatDataset) across multiple files.
  • Standardization of import ordering to avoid circular dependencies.
  • Updates to the .pre-commit-config.yaml to improve linter configuration and file matching.

Reviewed Changes

Copilot reviewed 154 out of 154 changed files in this pull request and generated no comments.

Show a summary per file
File Description
braindecode/datasets/xy.py Reordered numpy/pandas imports and base module imports.
braindecode/datasets/tuh.py Adjusted import ordering and moved import statements.
braindecode/datasets/sleep_physionet.py Updated import order and removed redundant mne import.
braindecode/datasets/sleep_physio_challe_18.py Standardized import order for mne and preprocessing function.
braindecode/datasets/nmt.py Reordered imports; now includes pathlib and mock earlier.
braindecode/datasets/moabb.py Adjusted import order of pandas and base module imports.
braindecode/datasets/mne.py Removed duplicate mne import and reorders base module imports.
braindecode/datasets/bids.py Updated import order and base module import; note typo in helper name.
braindecode/datasets/bcicomp.py Reordered base module import order.
braindecode/datasets/bbci.py Added a newline after future import for clarity.
braindecode/datasets/base.py Adjusted imports to avoid circular import; consistent ordering.
braindecode/datasets/init.py Reordered exports for better organization.
braindecode/classifier.py Moved import statement to group similar imports together.
braindecode/augmentation/transforms.py Consolidated functional imports into a single grouped import.
braindecode/augmentation/functional.py Reordered imports to group torch-related imports together.
braindecode/augmentation/base.py Reordered typing imports for consistency.
braindecode/augmentation/init.py Updated linter and file matching configuration for imports.
braindecode/init.py Rearranged import order to import version after classifier.
benchmark_filterbank.py New benchmark file added for parallelized evaluation.
.pre-commit-config.yaml Updated linter configurations and added isort hook.
Comments suppressed due to low confidence (1)

braindecode/datasets/bids.py:25

  • There is a spelling mistake in the function name '_descriptiion_from_bids_path'; consider renaming it to '_description_from_bids_path' for clarity.
def _descriptiion_from_bids_path(bids_path: mne_bids.BIDSPath) -> dict[str, Any]:

@codecov

codecov Bot commented Apr 20, 2025 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 96.44495% with 31 lines in your changes missing coverage. Please review.

Project coverage is 87.67%. Comparing base (65d8aa3) to head (a4ebcb5).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #728   +/-   ##
=======================================
  Coverage   87.66%   87.67%           
=======================================
  Files          82       93   +11     
  Lines        7558     7546   -12     
=======================================
- Hits         6626     6616   -10     
+ Misses        932      930    -2     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bruAristimunha

Copy link
Copy Markdown
Collaborator Author

@agramfort, if you have some time to look at the new API doc structure here: https://output.circle-artifacts.com/output/job/d7023a3b-e9f5-46d2-a29e-af7af5756c0c/artifacts/0/dev/api.html

I would appreciate it, but no problem if not.

@PierreGtch PierreGtch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Mayn public functions/classes were moved. Should we also keep the old import paths with deprecated warnings? Or should we make a new major version?

Comment thread braindecode/functional/functions.py Resolved
Comment thread docs/sg_execution_times.rst Resolved
Comment thread braindecode/modules/util.py Resolved
@bruAristimunha

Copy link
Copy Markdown
Collaborator Author

Major release is the way to go, the what's new file is too big at the moment. Let's sync with the competition timeline, it's time for us to refine the press release material.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request refactors several modules to improve code organization, resolve import issues, and enhance maintainability. Key changes include:

  • Reordering and standardizing import statements across multiple modules.
  • Fixing a typo in a function name (_descriptiion → _description) to improve clarity.
  • Updating pre-commit hooks with new linting and formatting configurations.

Reviewed Changes

Copilot reviewed 149 out of 149 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
braindecode/datautil/init.py Reordered import list for serialization functions.
braindecode/datasets/xy.py Standardized import ordering for dataset functionality.
braindecode/datasets/tuh.py Reorganized imports for clarity and consistency.
braindecode/datasets/sleep_physionet.py Reordered imports and updated base dataset imports.
braindecode/datasets/sleep_physio_challe_18.py Reorganized import statements and dependency ordering.
braindecode/datasets/nmt.py Standardized and reordered import sections.
braindecode/datasets/moabb.py Adjusted import order for consistency.
braindecode/datasets/mne.py Updated import order and dependency groupings.
braindecode/datasets/bids.py Fixed typo in function name and standardized import order.
braindecode/datasets/bcicomp.py Minor import order modifications for consistency.
braindecode/datasets/bbci.py Adjusted imports with no functional changes.
braindecode/datasets/base.py Updated import order and clarified inline import comments.
braindecode/datasets/init.py Standardized module re-exports and import order.
braindecode/classifier.py Revised import sequence for classifier modules.
braindecode/augmentation/transforms.py Consolidated individual functional imports into a grouped format.
braindecode/augmentation/functional.py Adjusted import order to align torch and mne dependencies.
braindecode/augmentation/base.py Reordered typing and dependency imports for clarity.
braindecode/augmentation/init.py Reordered and re-exported transform imports for consistency.
braindecode/init.py Revised import order, including version and classifier modules.
.pre-commit-config.yaml Added new linting and formatting hooks with ruff and isort.

Comment thread .pre-commit-config.yaml Resolved
@PierreGtch

Copy link
Copy Markdown
Collaborator

@bruAristimunha Indeed the change log is becoming super large. We could create more subsections in the log for better clarity, for this release at least. Something like

  • New models
  • New datasets
  • Api changes
  • doc changes
  • tests improvements and code quality
  • major bug fixes
  • Minor bug fixes

@PierreGtch PierreGtch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Allright, then we will make a major version so it's fine to change the API. Nice reorganisation @bruAristimunha :) Code is much more clear now and it should promote re-using modules between models

@bruAristimunha
bruAristimunha merged commit e6d0dea into braindecode:master Apr 22, 2025
@bruAristimunha
bruAristimunha deleted the modules-moving branch April 22, 2025 12:26
@bruAristimunha

Copy link
Copy Markdown
Collaborator Author

thank you @PierreGtch ;)

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.

Create a braindecode functional

4 participants