Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ numpy = "==1.26.3"
dash-iconify = "*"
scipy = "==1.12.0"
kgcpy = "*"
dash-leaflet = "*"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

What is the latest stable dash-leaflet release, and which versions are compatible with Dash 3.x?

💡 Result:

Latest stable dash-leaflet release: 1.1.3 [1][2]. Dash 3.x compatibility: - dash-leaflet 1.1.3 declares a dependency constraint of dash >=3.0.0, so it is compatible with Dash 3.x releases [1][2]. - The dash-leaflet project also documents that versions 1.1.1+ were released as “Dash 3 compatible” and notes a specific incompatibility issue related to Dash 3 / React 18.3 that was addressed via updates [3]. Practical takeaways: - Use dash-leaflet==1.1.3 with Dash 3.x (>=3.0.0) [1][2].

Citations:


🏁 Script executed:

rg -n "dash-leaflet\s*=|\[packages\]|\[dev-packages\]|^dash\s*=" -S .

Repository: CenterForTheBuiltEnvironment/clima

Length of output: 188


🌐 Web query:

dash-leaflet latest version PyPI and compatibility with dash 3.x

💡 Result:

Latest dash-leaflet version on PyPI (as of 2026-05-26): 1.1.3 [1]. Compatibility with Dash 3.x: - dash-leaflet 1.1.3 declares a dependency on dash >= 3.0.0, so it is intended to work with Dash 3.x (and will not allow Dash 2.x) [1][2]. - The dash-leaflet 1.1.3 metadata also indicates Python >= 3.11 [1][2]. - Dash 3.0 is documented by Plotly as removing/altering some older component stubs and includes breaking changes; if your app uses any libraries/components that Dash 3 requires to be updated, you may need to update those libraries too [3]. Recommended install (to match the intended constraints): - pip install "dash>=3" "dash-leaflet==1.1.3" [1][2].

Citations:


🏁 Script executed:

ls -la

Repository: CenterForTheBuiltEnvironment/clima

Length of output: 1897


🏁 Script executed:

rg -n "dash-leaflet" -S .

Repository: CenterForTheBuiltEnvironment/clima

Length of output: 155


🏁 Script executed:

python3 - <<'PY'
import itertools, re, sys
path="Pipfile.lock"
start=200
end=260
with open(path,'r',encoding='utf-8') as f:
    for i,line in enumerate(f,1):
        if start<=i<=end:
            print(f"{i}:{line.rstrip()}")
PY

Repository: CenterForTheBuiltEnvironment/clima

Length of output: 2832


🌐 Web query:

dash-leaflet 1.0.15 dependency on dash (Dash >=?) PyPI

💡 Result:

dash-leaflet 1.0.15 declares a dependency on Dash with the constraint dash >=2.13.0 on PyPI. [1] So the answer to “Dash >=?” is: Dash >= 2.13.0. [1]

Citations:


🌐 Web query:

dash-leaflet 1.0.15 Dash 3 compatibility

💡 Result:

Dash-leaflet 1.0.15 is not considered “Dash 3 compatible” on its own. Instead, Dash 3 compatibility was implemented starting from dash-leaflet 1.1.0 (and related 1.1.x releases), while 1.0.15 only declares compatibility with Dash >=2.13.0. Evidence: - The PyPI page for dash-leaflet 1.0.15 shows a dependency constraint of dash >=2.13.0 (no Dash 3-specific minimum is stated for 1.0.15). [1] - The project changelog/compare history between 1.0.15 and 1.1.0 explicitly notes “Working in Dash 3 compatibility” and “Update dependency to Dash 3.0.0” as part of the 1.1.0 change. [2] - There is a GitHub issue reporting incompatibility when using dash=3 with dash-leaflet (and discussing fixes that were released in later 1.1.x versions), indicating that older 1.0.x builds can be problematic with Dash 3. [3] Practical takeaway: - If you need Dash 3 compatibility, use dash-leaflet 1.1.0 or later (for example, 1.1.3). [2][4] Install guidance: - pip install dash>=3 dash-leaflet>=1.1.0

Citations:


Pin dash-leaflet and align it with Dash 3.2.

  • Pipfile uses dash-leaflet = "*" (drift risk); Pipfile.lock currently pins dash-leaflet==1.0.15.
  • dash-leaflet==1.0.15 is not the Dash 3–compatible line (Dash 3 compatibility started in dash-leaflet 1.1.0+). Upgrade to a Dash 3–compatible version (e.g., dash-leaflet==1.1.3) and regenerate Pipfile.lock.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Pipfile` at line 20, Update the Pipfile to pin dash-leaflet to a Dash
3–compatible release (replace dash-leaflet = "*" with dash-leaflet == "1.1.3" or
another 1.1.x+ version) and then regenerate Pipfile.lock so the lockfile and
Pipfile agree (current Pipfile.lock uses 1.0.15 which is pre-Dash-3); target
dash-leaflet 1.1.3 to align with Dash 3 compatibility and run pipenv lock to
produce an updated lockfile.


[dev-packages]
cleanpy = "*"
Expand Down
44 changes: 26 additions & 18 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import dash_bootstrap_components as dbc
from dash_extensions.enrich import DashProxy, ServersideOutputTransform
from flask import send_file

app = DashProxy(
__name__,
Expand All @@ -10,6 +11,22 @@
)
TIMEOUT = 600


@app.server.route("/geojson/locations")
def serve_locations_geojson():
return (
send_file(
"assets/data/locations.geojson.gz",
mimetype="application/json",
as_attachment=False,
download_name="locations.geojson",
conditional=True,
),
200,
{"Content-Encoding": "gzip", "Cache-Control": "no-cache"},
)
Comment on lines +15 to +27
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use cache-friendly headers for the GeoJSON endpoint.

Line 26 sets Cache-Control: no-cache, which forces revalidation and undercuts the map-load performance gain from serving a static gzipped asset with versioned URLs.

💡 Suggested change
 `@app.server.route`("/geojson/locations")
 def serve_locations_geojson():
     return (
         send_file(
             "assets/data/locations.geojson.gz",
             mimetype="application/json",
             as_attachment=False,
             download_name="locations.geojson",
             conditional=True,
         ),
         200,
-        {"Content-Encoding": "gzip", "Cache-Control": "no-cache"},
+        {
+            "Content-Encoding": "gzip",
+            "Cache-Control": "public, max-age=31536000, immutable",
+        },
     )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app.py` around lines 15 - 27, The endpoint serve_locations_geojson currently
returns Cache-Control: no-cache which forces revalidation; update the response
headers returned by serve_locations_geojson to use cache-friendly directives for
a static, versioned gzipped asset (e.g., "Cache-Control": "public,
max-age=31536000, immutable") while keeping "Content-Encoding": "gzip" (and
leave conditional send_file behavior as-is) so browsers/CDNs can aggressively
cache the file.



app.index_string = """<!DOCTYPE html>
<html lang="en-US">
<head>
Expand Down
2,850 changes: 2,849 additions & 1 deletion assets/animations/page_not_found.json

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions assets/cluster.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.marker-cluster-small {
background-color: rgba(248, 249, 250, 0.6);
}
.marker-cluster-medium {
background-color: rgba(172, 227, 251, 0.6);
}
.marker-cluster-large {
background-color: rgba(35, 139, 230, 0.6);
}
.marker-cluster-small div {
background-color: rgba(240, 247, 249, 0.8);
}
.marker-cluster-medium div {
background-color: rgba(172, 227, 251, 0.8);
}
.marker-cluster-large div {
background-color: rgba(35, 139, 230, 0.8);
}
51 changes: 51 additions & 0 deletions assets/dashExtensions_default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
window.dashExtensions = Object.assign({}, window.dashExtensions, {
default: {
function0: function (feature, latlng, ctx) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

function0 is not used and can be removed.

const p = feature.properties;
const color = p.source === "ep" ? "#3a0ca3" : "#4895ef";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Checking that the source is equal to "ep" which is a string, it is quite dangerous because we may miss this in the future, can we find a more elegant solution? for example to define a class with the two different sources.

const marker = L.circleMarker(latlng, {
radius: 5,
color: color,
fillColor: color,
fillOpacity: 0.8,
weight: 1,
});

let html =
"<b>" +
(p.title || "") +
"</b><br/>" +
"Lat: " +
latlng.lat.toFixed(2) +
", Lon: " +
latlng.lng.toFixed(2) +
"<br/>";
if (p.source === "ob") {
html +=
"Period: " +
(p.period || "N/A") +
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PyCharm is complaining that this may not be defined, the same for the other attributes of p. Can we give a more meaningful name to P? Perhaps we can call it "Properties of XXX"

"<br/>" +
"Elevation: " +
(p.elev || "N/A") +
" m<br/>" +
"Time zone: GMT" +
(p.tz || "N/A") +
"<br/>" +
"99% Heating DB: " +
(p.heat99 || "N/A") +
"<br/>" +
"1% Cooling DB: " +
(p.cool1 || "N/A") +
"<br/>" +
"Source: Climate.OneBuilding.Org";
} else {
html += "Source: EnergyPlus";
}
marker.bindTooltip(html, {
sticky: true,
opacity: 0.9,
});
return marker;
},
},
});
Loading
Loading