Skip to content

Update/codecarbon demo - #801

Open
budescode wants to merge 3 commits into
plotly:mainfrom
budescode:update/codecarbon-demo
Open

Update/codecarbon demo#801
budescode wants to merge 3 commits into
plotly:mainfrom
budescode:update/codecarbon-demo

Conversation

@budescode

@budescode budescode commented Sep 4, 2026

Copy link
Copy Markdown

Issue for app: N/A

App pull request

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

About

Summary

Updates codecarbon-demo from its 2021 dependency set to current releases
and fixes the two things that broke along the way.

Dependencies

  • codecarbon 1.2.0 -> 3.3.0 (dashboard now comes from the codecarbon[carbonboard] extra)
  • dash 1.21.0 -> 4.4.1, dropping dash-core-components, dash-html-components
    and dash-table, which were merged into dash in 2.0
  • pandas 1.3.2 -> 3.0.5, plotly 5.3.0 -> 7.0.0, Flask 2.0.1 -> 3.1.3,
    gunicorn 20.1.0 -> 26.2.0
  • Python runtime 3.8.2 -> 3.11, the minimum pandas 3 supports
  • Direct dependencies are declared in a new pyproject.toml; requirements.txt
    is regenerated from uv.lock so the two stay in sync

Fixes

  • app.run_server was removed in Dash 3; the app now calls app.run
  • codecarbon 3.3.0 opens its Canada provinces geojson with a path relative
    to the working directory, so selecting Canada raised FileNotFoundError.
    app.py redirects that one path to the installed package. The bug is still
    present on codecarbon master; the workaround can be removed once it is
    fixed upstream.

Tested on Python 3.11.13: index, layout and callback registration all
return 200, and the regional choropleth callback renders for both Canada
and USA.

Merge tag: #patch

Workflow

  • I have created a branch in the appropriate monorepo, and the
    elements necessary for successful deployment are in place.
  • 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

… 3.0.5,

plotly 5.3.0 -> 7.0.0, Flask 2.0.1 -> 3.1.3 and gunicorn 20.1.0 -> 26.2.0.

Drop dash-core-components, dash-html-components and dash-table, which were
merged into dash in 2.0. The dashboard now lives behind the
codecarbon[carbonboard] extra.

Declare the three direct dependencies in pyproject.toml and regenerate
requirements.txt from uv.lock. Raise the Python runtime to 3.11, the
minimum supported by pandas 3
Dash 3 removed app.run_server; use app.run.
codecarbon 3.3.0 opens codecarbon/data/canada_provinces.geojson relative
to the working directory, so selecting Canada raises FileNotFoundError
unless the app is launched from site-packages. The bug is still present
on upstream master.

Redirect that one relative path to the installed package. The patch can be
removed once codecarbon resolves the path itself.
@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