Skip to content

fix: resolve ruff linting issues and add CI workflow - #133

Merged
pollytur merged 28 commits into
sensorium-competition:mainfrom
binary69:fix/ruff-clean
Mar 19, 2026
Merged

fix: resolve ruff linting issues and add CI workflow#133
pollytur merged 28 commits into
sensorium-competition:mainfrom
binary69:fix/ruff-clean

Conversation

@binary69

@binary69 binary69 commented Mar 15, 2026

Copy link
Copy Markdown
Collaborator

closes #129

Removed 53 unused imports and fixed style issues automatically using ruff --fix
Manually removed unused local variables (start_time, chunk_s, c_eye, c_tread)
Removed redefined DEFAULT_MODALITY_CONFIG in datasets.py
Added .github/workflows/ruff.yml to run ruff automatically on every PR and push
Pinned ruff to v0.15.6 for deterministic CI results
Added trigger guard to avoid duplicate CI runs
All 360 tests passing after changes

The remaining 20 errors are in example notebook files (.ipynb).
These involve shell commands and cross-cell variable references.
that are valid in notebook context but flagged by ruff.
Left untouched to avoid breaking example notebooks.

Copilot AI review requested due to automatic review settings March 15, 2026 10:14
@gitnotebooks

gitnotebooks Bot commented Mar 15, 2026

Copy link
Copy Markdown

Found 3 changed notebooks. Review the changes at https://app.gitnotebooks.com/sensorium-competition/experanto/pull/133

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 primarily focuses on cleanup and lint-readiness across the Experanto codebase by removing unused imports/variables, simplifying a few error strings, and adding a new Ruff CI workflow.

Changes:

  • Remove unused imports/variables across core modules (utils, datasets, dataloaders, experiment, interpolators, configs).
  • Minor string cleanup in error/exception messages.
  • Add a Ruff GitHub Actions workflow and ignore a local environment directory in .gitignore.

Reviewed changes

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

Show a summary per file
File Description
experanto/utils.py Removes unused imports and unused local vars in add_behavior_as_channels.
experanto/intervals.py Simplifies an error return string.
experanto/interpolators.py Removes an unused import and simplifies NotImplementedError message strings.
experanto/experiment.py Removes unused imports/types.
experanto/datasets.py Removes unused imports and a dead local variable; keeps dataset logic intact.
experanto/dataloaders.py Removes unused imports and timing variable.
experanto/configs.py Removes unused Hydra/open_dict imports; keeps YAML-based default config loading.
examples/sensorium/sensorium_min_example.ipynb Removes unused imports in the example notebook.
examples/sensorium/experiment.ipynb Removes unused imports in the example notebook.
examples/sensorium/data.ipynb Removes unused imports in the example notebook.
.gitignore Ignores gsoc_env/.
.github/workflows/ruff.yml Adds a Ruff lint workflow.

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

Comment thread .github/workflows/ruff.yml
Comment thread .github/workflows/ruff.yml Outdated
@codecov

codecov Bot commented Mar 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 24.32432% with 28 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
experanto/datasets.py 0.00% 14 Missing ⚠️
experanto/utils.py 0.00% 7 Missing ⚠️
experanto/dataloaders.py 0.00% 4 Missing ⚠️
experanto/experiment.py 0.00% 2 Missing ⚠️
experanto/configs.py 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@pollytur
pollytur requested a review from reneburghardt March 16, 2026 19:46
Comment thread .gitignore Outdated
Comment thread .github/workflows/ruff.yml Outdated
Comment thread experanto/datasets.py Outdated
Comment thread experanto/utils.py
Comment thread experanto/utils.py

@pollytur pollytur 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.

@binary69 Thanks a lot for the clean up!
please clean gitignore and also address a few other minor comments.

@pollytur pollytur 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.

@reneburghardt reneburghardt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @binary69 , thanks for the PR!
It looks pretty good, but I have very few things I am wondering about:

  • I would have expected that ruff is added with a version constraint into pyproject.toml's dev-group
  • I also would have expected that the default configuration of ruff is set in pyproject.toml's tool.ruff section, particularly setting line-length, target-version, exclude, src, lint.select, lint.ignore and possibly others if helpful/necessary. Please try to match the settings with isort and black, so they don't counteract on each other. In another project, we have lint.select = ["E", "F", "B", "UP", "C4"] and lint.ignore = ["E501"] # ignore line length, but I am not fully sure thats correct here as well. With this the command in ruff.yml should also be changed to ruff check only, so that it matches whatever users are running locally as well. It can be frustrating to see different output of ruff locally or in Github workflows.
  • ruff.yml looks good, but different than the other workflows making it hard to parse whats different. If possible, please try to match code style, naming, order of actions, etc. (either changing ruff.yml or the other workflows)
  • I agree that examples folder should be excluded, but if possible, please also solve the linting issues of ruff there as well

Very happy to accept after changes to those things or feedback why it doesn't make sense

@binary69

binary69 commented Mar 18, 2026

Copy link
Copy Markdown
Collaborator Author

I've fixed all the linting issues in examples/ and set up the ruff configuration in pyproject.toml and ruff.yml as mentioned.
Running ruff check . on the full codebase surfaced 23 remaining issues in experanto/ and tests/ (B905, B028, B007, B904, C416, C408). I've auto fixed and left others untouched . Happy to fix in a new PR or this if preferred.

@binary69

Copy link
Copy Markdown
Collaborator Author

The ruff auto-fix converted Union annotation in experanto/ in dataloaders.py, it broke docs build. Should I from __future__ import annotations or revert experanto/ auto fixes.

Comment thread pyproject.toml Outdated
Comment thread examples/sensorium/data.ipynb Outdated
Comment thread examples/sensorium/videos.ipynb Outdated
Comment thread experanto/dataloaders.py Outdated
Comment thread experanto/dataloaders.py Outdated
Comment thread experanto/datasets.py Outdated
Comment thread experanto/interpolators.py Outdated
Comment thread experanto/utils.py Outdated
Comment thread experanto/utils.py Outdated
Comment thread experanto/utils.py Outdated
Comment thread experanto/utils.py Outdated

@pollytur pollytur 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.

please resolve the strict in zip

strict=False is the default behaviour, so I would rather remove it
However in most of the cases (apart from the data loader helpers!) we assume that the lists are equal length and setting strict=True might help

I have made corresponding suggestions.
Lets address and happy to merge afterwards

binary69 and others added 9 commits March 19, 2026 16:12
Co-authored-by: Polina Turishcheva <49938348+pollytur@users.noreply.github.com>
Co-authored-by: Polina Turishcheva <49938348+pollytur@users.noreply.github.com>
Co-authored-by: Polina Turishcheva <49938348+pollytur@users.noreply.github.com>
Co-authored-by: Polina Turishcheva <49938348+pollytur@users.noreply.github.com>
Co-authored-by: Polina Turishcheva <49938348+pollytur@users.noreply.github.com>
Co-authored-by: Polina Turishcheva <49938348+pollytur@users.noreply.github.com>
Co-authored-by: Polina Turishcheva <49938348+pollytur@users.noreply.github.com>
Co-authored-by: Polina Turishcheva <49938348+pollytur@users.noreply.github.com>
@binary69

Copy link
Copy Markdown
Collaborator Author

made the changes as mentioned :)

@pollytur
pollytur merged commit 2a45423 into sensorium-competition:main Mar 19, 2026
5 of 6 checks passed
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.

Resolve current ruff issues and add ruff to CI/CD

5 participants