Skip to content

Conversation

@YijieZhu15
Copy link
Collaborator

Trying to update example notebook 06.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@shaneahmed shaneahmed changed the title Update example notebook06 📝 Update 06-semantic-segmentation notebook for the New API Dec 17, 2025
@shaneahmed shaneahmed marked this pull request as draft December 17, 2025 15:32
@shaneahmed shaneahmed added this to the Release v2.0.0 milestone Dec 19, 2025
@shaneahmed shaneahmed added the documentation Improvements or additions to documentation label Dec 19, 2025
shaneahmed and others added 5 commits December 22, 2025 14:59
- Update `.readthedocs.yml` to Install CPU Version only for speed up readthedocs build
## Overview
This PR addresses **issue #975** and introduces two major improvements:

---

### 1. Improved Index Usage Warning in `SQLiteStore`
**Problem:**  
The previous logic for detecting index usage relied only on the first row of `EXPLAIN QUERY PLAN`. On macOS, this often corresponds to the `rtree` virtual table, so the check missed actual indexes and always warned.

**Solution:**  
- Added a new helper method `_warn_if_query_not_using_index` that inspects **all rows** of the query plan.
- The method now looks for any row containing `USING INDEX` or `USING COVERING INDEX` (macOS phrasing).
- If no index is detected, a warning is logged; otherwise, it remains silent.

**Impact:**  
More accurate performance warnings and better developer guidance for adding indexes.

---

### 2. Dynamic Port Allocation for Tile Server in Bokeh Tests
**Problem:**  
macOS runs multiple daemons on well-known ports (e.g., `5000`). Tests hardcoded to `http://127.0.0.1:5000/...` often collided with other services, causing `HTML/403` responses and subsequent `JSONDecodeError` or `KeyError`.

**Solution:**  
- Introduced dynamic port binding for the tile server:
  - At test session start, a free loopback port is reserved and exported as `TIATOOLBOX_TILESERVER_PORT`.
  - Both the Flask tile server and Bokeh client read this environment variable, ensuring consistent communication.
- Updated all relevant tests (`test_app_bokeh.py`, `test_json_config_bokeh.py`, `test_server_bokeh.py`) and CLI launcher to use the dynamic port.
- Added proxy bypass (`trust_env=False`) for local requests to avoid interference from system proxies.

**Impact:**  
Eliminates port conflicts, stabilizes UI tests, and improves cross-platform reliability.

---

### Additional Changes
- Updated Bokeh app hooks and main logic to respect dynamic port configuration.
- Minor refactoring for clarity and maintainability.

---

✅ **Benefits:**
- More robust query performance checks.
- Reliable test execution across macOS and CI environments.
- Cleaner integration between CLI, Bokeh app, and test harness.

---

**Closes:** #975


---------

Co-authored-by: Jiaqi Lv <jiaqilv@Jiaqis-MacBook-Pro.local>
Co-authored-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Dec 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.18%. Comparing base (39ae9cb) to head (dc074df).

Additional details and impacted files
@@                   Coverage Diff                   @@
##           dev-define-engines-abc     #978   +/-   ##
=======================================================
  Coverage                   95.18%   95.18%           
=======================================================
  Files                          77       77           
  Lines                        9689     9689           
  Branches                     1255     1255           
=======================================================
  Hits                         9222     9222           
  Misses                        431      431           
  Partials                       36       36           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

bokeh>=3.1.1, <3.6.0
Click>=8.1.3, <8.2.0
dask>=2025.10.0
dask-image>=2025.11.0
Copy link
Member

Choose a reason for hiding this comment

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

As this is only used in Jupyter Notebook. I would suggest adding it to the bash cell in the notebook.

@review-notebook-app
Copy link

review-notebook-app bot commented Dec 23, 2025

View / edit / reply to this conversation on ReviewNB

shaneahmed commented on 2025-12-23T11:20:34Z
----------------------------------------------------------------

You can add pip install dask_image here


@review-notebook-app
Copy link

review-notebook-app bot commented Dec 23, 2025

View / edit / reply to this conversation on ReviewNB

shaneahmed commented on 2025-12-23T11:20:35Z
----------------------------------------------------------------

Add a cell at the end to visualize the output using TIAViz. See this example

https://app.reviewnb.com/TissueImageAnalytics/tiatoolbox/pull/977/discussion/#comment-3674742370


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants