SainsburyWellcomeCentre / aeon_mecha

Project Aeon's main library for interfacing with acquired data. Contains modules for raw data file io, data querying, data processing, data qc, database ingestion, and building computational data pipelines.
BSD 3-Clause "New" or "Revised" License
6 stars 6 forks source link

Clear all CI checks on all platforms #402

Closed glopesdev closed 2 months ago

glopesdev commented 2 months ago

We have failing CI checks for a long time now purely because of ruff linting and pyright warnings. This PR clears all these warnings, either by addressing the suggestions, or ignoring the warnings where reasonable, e.g. docstrings on magic methods, etc.

The current PR is taking us from ~250 errors to zero errors. The final errors were grouped into the below 4 types and have all been resolved:

To reproduce the required checks: run pre-commit install and pre-commit run --all-files or see Workflow run

In the process we have also now enabled resolving all checks for all platforms, including resolving an outstanding issue for datajoint macOS wheels (see #406)

Fixes #411 Fixes #412 Fixes #344 Fixes #249

@coderabbitai: ignore

Summary by CodeRabbit

github-actions[bot] commented 2 months ago

Image description CodeRabbit

Walkthrough

The proposed changes primarily focus on improving code readability, maintainability, and consistency. This is achieved through addressing linting warnings, updating docstrings, refactoring some parts of the code, and making minor adjustments in variable assignments and dictionary usage. Some changes also involve function signatures and import statements that may impact module resolution and external interfaces. The CI workflow and pre-commit hooks configurations have been updated as well.

Changes

Files Summary
aeon/analysis/block_plotting.py, aeon/analysis/movies.py, aeon/analysis/plotting.py, aeon/dj_pipeline/tracking.py, aeon/io/device.py, aeon/analysis/utils.py, aeon/dj_pipeline/init.py, aeon/dj_pipeline/acquisition.py, aeon/dj_pipeline/utils/load_metadata.py, aeon/io/api.py, aeon/io/reader.py, aeon/dj_pipeline/scripts/clone_and_freeze_exp01.py, aeon/dj_pipeline/scripts/update_timestamps_longblob.py, aeon/util.py, aeon/dj_pipeline/create_experiments/insert_experiment_directory.ipynb, aeon/dj_pipeline/docs/notebooks/diagram.ipynb, aeon/dj_pipeline/docs/notebooks/social_experiments_block_analysis.ipynb, docs/examples/dj_example_octagon1_experiment.ipynb, aeon/dj_pipeline/populate/worker.py, tests/conftest.py Improved code readability and maintainability by addressing linting warnings, updating docstrings, refactoring some parts of the code, and making minor adjustments in variable assignments and dictionary usage.
aeon/dj_pipeline/qc.py, aeon/io/video.py, aeon/qc/video.py, aeon/dj_pipeline/scripts/clone_and_freeze_exp02.py, aeon/schema/core.py, aeon/schema/dataset.py, aeon/schema/foraging.py, aeon/schema/schemas.py, aeon/schema/social_02.py, aeon/schema/streams.py Changes in function signatures and import statements that may impact module resolution and external interfaces.
tests/dj_pipeline/test_acquisition.py, tests/dj_pipeline/test_pipeline_instantiation.py, tests/dj_pipeline/test_tracking.py, tests/io/test_api.py, aeon/init.py, aeon/dj_pipeline/utils/load_metadata.py, tests/dj_pipeline/test_tracking.py, tests/io/test_api.py Modifications in test functions to improve code readability and consistency.
.github/workflows/build_env_run_tests.yml, .pre-commit-config.yaml Updated the CI workflow and pre-commit hooks configurations.
aeon/dj_pipeline/webapps/sciviz/apk_requirements.txt Minor change related to adding a newline at the end of the file in the git bash script.
aeon/dj_pipeline/analysis/block_analysis.py Optimized code by addressing linting warnings, improving variable assignments, and enhancing dictionary usage.
aeon/dj_pipeline/populate/worker.py Removed a function and added a new one with minor adjustments in the code.
aeon/dj_pipeline/utils/streams_maker.py Updated variable name in a loop within a function.
aeon/io/reader.py Improved code readability and maintainability by addressing linting warnings, updating docstrings, using constant variables, and refactoring some parts of the code.
tests/dj_pipeline/test_pipeline_instantiation.py Changes in test functions related to pipeline instantiation and experiment creation.
tests/dj_pipeline/test_qc.py Removed extraneous whitespace in a test function.
tests/io/test_api.py Modified test assertions related to data indexing and timestamps, introducing a constant variable for downsampling period.

Uplevel your code reviews with CodeRabbit Pro ### CodeRabbit Pro If you like this project, please support us by purchasing the [Pro version](https://coderabbit.ai). The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.
ttngu207 commented 2 months ago

@glopesdev Thanks I'll go back and apply the fixes suggested here to clear as much of the Ruff rules as possible

lochhh commented 2 months ago

I opened a separate PR #409 that adds on to the current PR and reduces the ruff errors down to 9 - could use some input from @ttngu207 as most of those are in dj_pipeline. The remaining 16 pyright errors can be addressed in a separate PR.

codecov[bot] commented 2 months ago

Welcome to Codecov :tada:

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered :open_umbrella: