Skip to content

Update/dash 3d image partitioning - #802

Open
budescode wants to merge 4 commits into
plotly:mainfrom
budescode:update/dash-3d-image-partitioning
Open

Update/dash 3d image partitioning#802
budescode wants to merge 4 commits into
plotly:mainfrom
budescode:update/dash-3d-image-partitioning

Conversation

@budescode

Copy link
Copy Markdown

Issue for app: none (dependency update, no linked issue)

App pull request

  • This is a new app
  • I am improving an existing app (redesigns/code "makeovers")

About

Brings dash-3d-image-partitioning from its 2020 dependencies to current
versions and makes it installable with uv or pip from a fresh clone.

  • Declares the direct dependencies in pyproject.toml, locks with uv, and
    regenerates requirements.txt from uv.lock. Python 3.12 or newer.
  • Bumps dash 1.14.0 -> 4.4.1, plotly 4.8.2 -> 7.0.0, numpy 1.18.5 -> 2.5.2,
    scikit-image 0.17.2 -> 0.26.0, nilearn 0.6.2 -> 0.14.1,
    nibabel 3.1.0 -> 5.4.2, cairosvg 2.4.2 -> 2.9.0, Pillow 8.2.0 -> 12.3.0
    and gunicorn 20.0.4 -> 26.2.0.
  • Adapts the code to the new APIs: from dash import html, dcc,
    app.run, nibabel get_fdata, scikit-image channel_axis, and the new
    location of plotly's ImageUriValidator.
  • Installs the plotly-common helper modules as part of the project so
    PYTHONPATH is no longer needed.
  • Adds run_dev.py, a cross-platform launcher that sets LOAD_SUPERPIXEL
    and, on Apple Silicon, the Homebrew library path cairosvg needs.
  • Makes run_app.sh set the same path and start gunicorn via python -m.
  • Fixes ./setup: installs the cairo system library, uses the built-in
    venv module in .venv, checks the Python version, and actually aborts
    when it says it will.
  • Updates the README to match.

Cairo remains a native dependency. It is installed by ./setup on macOS,
Debian/Ubuntu and Fedora. Windows is not covered.

  • Playground deployment URL (new version):
  • Current gallery app URL: (delete this line if inapplicable)

Workflow

  • I have created a branch in the appropriate monorepo, and the
    elements necessary for successful deployment are in place.
  • If the app is a redesigned and/or restyled version of an
    existing gallery app, I've summarized the changes requested in the
    appropriate Streambed issue and confirm that they have been applied.
  • If the app is on the Dash Gallery portal, I have added a link to
    the GitHub repository for the source code in the portal description.
  • If the app is a reimplementation of a Python gallery app for the
    DashR gallery, the app in this PR mimics, as closely as possible,
    the style and functionality of the existing app.
  • I have removed all Google Analytics code from the app's
    assets/ folder.

The pre-review review

I have addressed all of the following questions:

  • Does everything in my code serve some purpose? (I have removed
    any dead and/or irrelevant code.)
  • Does everything in my code have a clear purpose? (My code is
    readable and, where it isn't, it has been commented appropriately.)
  • Am I reinventing the wheel? (I have used appropriate packages to
    lessen the volume of code that needs to be maintained.)

Post PR (at merge time)

  • When you are merging, make sure to write one of the following tags in the commit message (or it will default to patch):
    • #patch - An app has been updated or fixed
    • #minor - A new app has been added, or an app has been significantly reworked
    • #major - Breaking changes, make sure to discuss with dash-core before using this tag

Declare the ten direct dependencies in pyproject.toml, lock with uv and
regenerate requirements.txt from uv.lock so pip users still work.
Bump dash 1.14.0 -> 4.4.1, plotly 4.8.2 -> 7.0.0, numpy 1.18.5 ->
2.5.2, scikit-image 0.17.2 -> 0.26.0, nilearn 0.6.2 -> 0.14.1, nibabel
3.1.0 -> 5.4.2, cairosvg 2.4.2 -> 2.9.0, Pillow 8.2.0 -> 12.3.0 and
gunicorn 20.0.4 -> 26.2.0. Python 3.12 or newer is required.

Install the plotly-common helper modules as part of the project so
PYTHONPATH is no longer needed. Ignore .venv.
Import html and dcc from dash, call app.run instead of the removed
app.run_server, use nibabel's get_fdata in place of the removed
get_data, pass channel_axis=None to slic instead of the removed
multichannel argument, and import ImageUriValidator from its new
location in _plotly_utils.
run_dev.py starts the dev server with LOAD_SUPERPIXEL set and, on
Apple Silicon, the Homebrew library path cairosvg needs. It works the
same on any OS.

run_app.sh sets the same library path and starts gunicorn via
python -m, because the venv's gunicorn wrapper is a /bin/sh script
when the path contains spaces and macOS strips DYLD_* variables when
launching system binaries.
Install the cairo system library via brew, apt or dnf, create the
environment in .venv with the built-in venv module instead of
virtualenv, require Python 3.12 or newer, run pip as python -m pip so
it cannot fall through to a global install, and make the abort guards
actually exit.

Update the README setup and run instructions to match.
@budescode

Copy link
Copy Markdown
Author

@robertclaus Please can you review?

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.

1 participant