Update to Python 3.10 and SLEAP v1.5.0
- In #1989 we fixed several segfaults and threading issues through better thread management and import ordering fixes.
- There is no GPU support on native-windows for TensorFlow >= 2.11.0 see tensorflow documentation
Old Description
- The conda package for Windows and Linux currently uses Python 3.7.12 which is at its end-of-life. We would like to use the latest Python version possible for our conda build.
- TensorFlow 2.7.0 is the current working version of TensorFlow in SLEAP for Windows and Linux. TensorFlow 2.7.0 is compatible with Python 3.7 - 3.9. TensorFlow 2.7.0 cannot be pip installed with Python 3.10.
- We are currently using PySide 2 in both the Windows/Linux and Mac conda packages. We would like to upgrade this to PySide 6.
- PySide 6 is dependent on SciPy which is dependent on numpy.
- The Mac conda package uses
tensorflow-macos==2.9.2, is not compatible with Python 3.11 and 3.12. - We will update the PyPI build dependencies as well.
- scikit-video is replaced with imageio.v2. Code will be refactored for
VideoWriterand tests will be made for newVideoWriterusingimageio.v2in a new PR. #1900 ✅ - QtCharts is problematic. We are removing it and using matplotlib instead. Code will be refactored for
LossViewerto useMplCanvaswith added functionality for plotting and tests will be made in a future PR. The QT backend for matplotlib will be updated as well. #1899 ✅
Types of changes
- [ ] Bugfix
- [ ] New feature
- [ ] Refactor / Code style update (no logical changes)
- [X] Build / CI changes
- [ ] Documentation Update
- [ ] Other (explain)
Does this address any currently open issues?
- The Mac GUI is breaking in the latest pre-release #1803, #1802.
- This is following up many dependency updates in pre-release v1.4.1a1.
Outside contributors checklist
- [X] Review the guidelines for contributing to this repository
- [ ] Read and sign the CLA and add yourself to the authors list
- [X] Make sure you are making a pull request against the develop branch (not main). Also you should start your branch off develop
- [ ] Add tests that prove your fix is effective or that your feature works
- [ ] Add necessary documentation (if appropriate)
Thank you for contributing to SLEAP!
:heart:
Summary by CodeRabbit
-
New Features
- Added a new channel
sleap-depsfor package management. - Enhanced lazy loading for OpenCV to improve performance.
- Introduced a confirmation step for replacing missing file paths in dialogs.
- Added new command-line arguments for training configuration.
- Improved video management with additional assertions in tests.
- Added a new channel
-
Bug Fixes
- Improved handling of unsaved changes when closing the application.
-
Documentation
- Updated version numbers in installation instructions and documentation files.
-
Refactor
- Updated TensorFlow API usage for parallel processing across various classes.
- Restructured instance and image management in the tracking process.
-
Version Updates
- Updated package version from
1.4.1a2to1.4.1a3.
- Updated package version from
Walkthrough
This pull request updates multiple configuration and dependency files, GitHub workflows, environment activation/deactivation scripts, and tests. It revises dependency channels and version constraints, updates Python versions to 3.10, and refactors scripts to set and restore environment variables. Additionally, many modules now use lazy loading for libraries such as OpenCV, and several GUI control flows—such as close event handling—have been refined with added confirmation dialogs. Various test assertions were also updated for consistency.
Changes
| File(s) | Change Summary |
|---|---|
.conda_mac/condarc.yaml, .conda/condarc.yaml |
Updated channel configuration: added sleap-deps, removed/re-ordered channels. |
environment.yml, environment_mac.yml, environment_no_cuda.yml, .conda/meta.yaml, .conda_mac/meta.yaml, pypi_requirements.txt, dev_requirements.txt, requirements.txt |
Revised dependency channels and version constraints; updated library versions (e.g., Python, TensorFlow, numpy, pyside); added new dependencies and adjusted formatting. |
.github/workflows/*.yml (e.g. build_manual.yml, ci.yml, build.yml, build_pypi_ci.yml, website.yml) |
Updated Python version to 3.10; restructured job steps, added dependency installation (e.g., OpenGL libraries, ffmpeg); expanded trigger paths and OS matrices. |
.conda/sleap_activate.*, .conda/sleap_deactivate.*, .conda_mac/sleap_activate.sh, .conda_mac/sleap_deactivate.sh, .conda/bld.bat |
Enhanced activation/deactivation scripts to set and restore environment variables (e.g., XLA_FLAGS, NO_ALBUMENTATIONS_UPDATE) and copy scripts for proper environment setup. |
sleap/io/videowriter.py, sleap/gui/dialogs/importvideos.py, sleap/nn/tracking.py, sleap/io/video.py, tests/io/test_videowriter.py, tests/io/test_visuals.py |
Replaced direct cv2 (and other module) imports with lazy loading via lazy_loader to defer heavy imports. |
Various sleap/* modules (e.g., __init__.py, gui/app.py, gui/commands.py, gui/dialogs/missingfiles.py, gui/widgets/video.py, sleap/skeleton.py) |
Reorganized import orders, enhanced control flows (e.g., confirmation dialogs on close events), and updated error handling and cleanup procedures. |
Multiple files under sleap/nn/data/* (e.g., confidence_maps.py, dataset_ops.py, edge_maps.py, general.py, grouping.py, identity.py, inference.py, instance_centroids.py, instance_cropping.py, normalization.py, resizing.py) |
Updated num_parallel_calls in tf.data.Dataset.map calls from tf.data.experimental.AUTOTUNE to tf.data.AUTOTUNE per TensorFlow API updates. |
Test files under tests/* (e.g., test_skeleton.py, test_video.py, tests/gui/test_app.py) |
Adjusted test assertions (e.g., replacing np.alltrue with np.all), updated lazy loading usage, and expanded test coverage for new GUI workflows. |
Sequence Diagram(s)
sequenceDiagram
participant U as User
participant MW as MainWindow
participant MB as QMessageBox
U->>MW: Initiates close event
MW->>MW: Check for unsaved changes
alt Unsaved changes exist
MW->>MB: Prompt user (Save / Discard / Cancel)
MB-->>MW: User selection
alt User selects Save
MW->>MW: Save project
MW->>MW: Proceed with cleanup
else if User selects Discard
MW->>MW: Proceed with cleanup
else if User selects Cancel
MW->>MW: Abort close event
end
else
MW->>MW: Accept close event
end
MW->>MW: Call cleanup methods
MW->>U: Close application
Suggested labels
MultiView Stack
Suggested reviewers
- roomrys
- talmo
Poem
Oh, how I hop with joyful code,
As channels shift in every node.
My lazy loads make modules glide,
In workflows where new steps reside.
With each refactor, bugs take flight –
A rabbit’s cheer in bytes so bright!
🐰 Happy coding through the night!
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai planto trigger planning for file edits and PR creation.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 75.62%. Comparing base (
7ed1229) to head (c5e3ce8). Report is 56 commits behind head on develop.
Additional details and impacted files
@@ Coverage Diff @@
## develop #1841 +/- ##
===========================================
+ Coverage 73.30% 75.62% +2.31%
===========================================
Files 134 133 -1
Lines 24087 24626 +539
===========================================
+ Hits 17658 18624 +966
+ Misses 6429 6002 -427
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.