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 config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,4 @@ notebooks:
- requests
- mat3ra-ade
- mat3ra-wode
- mat3ra-prode
28 changes: 7 additions & 21 deletions other/materials_designer/workflows/band_gap.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@
"\n",
"job_dict = job_response[0]\n",
"job = dict_to_namespace(job_dict)\n",
"\n",
"job_id = job._id\n",
"print(\"✅ Job created successfully!\")\n",
"display_JSON(job_response)"
]
Expand All @@ -558,7 +558,7 @@
"metadata": {},
"outputs": [],
"source": [
"client.jobs.submit(job._id)"
"client.jobs.submit(job_id)"
]
},
{
Expand All @@ -570,7 +570,7 @@
"source": [
"from utils.api import wait_for_jobs_to_finish\n",
"\n",
"wait_for_jobs_to_finish(client.jobs, [job._id], poll_interval=POLL_INTERVAL)"
"wait_for_jobs_to_finish(client.jobs, [job_id], poll_interval=POLL_INTERVAL)"
]
},
{
Expand All @@ -588,25 +588,11 @@
"metadata": {},
"outputs": [],
"source": [
"from utils.visualize import render_prove\n",
"\n",
"property_endpoints = client.properties\n",
"\n",
"workflow = Workflow.create(job_dict[\"workflow\"])\n",
"unit_flowchart_id = workflow.subworkflows[BAND_GAP_SWF_INDEX].get_unit_by_name(name=\"pw_nscf\").flowchart_id\n",
"band_gap_direct = property_endpoints.get_direct_band_gap(job._id, unit_flowchart_id)\n",
"band_gap_indirect = property_endpoints.get_indirect_band_gap(job._id, unit_flowchart_id)\n",
"\n",
"# Minimal ProDe-like property JSON for Prove MVP\n",
"band_gaps_property = {\n",
" \"name\": \"band_gaps\",\n",
" \"values\": [\n",
" {\"type\": \"direct\", \"value\": float(band_gap_direct), \"units\": \"eV\"},\n",
" {\"type\": \"indirect\", \"value\": float(band_gap_indirect), \"units\": \"eV\"},\n",
" ],\n",
"}\n",
"from utils.visualize import visualize_properties\n",
"from mat3ra.prode import PropertyName\n",
"\n",
"render_prove([band_gaps_property], title=\"Band Gaps\")"
"band_gaps_property = client.properties.get_for_job(job_id, property_name=PropertyName.non_scalar.band_gaps)\n",
"visualize_properties(band_gaps_property, title=\"Band Gaps\")"
]
},
{
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ dependencies = [
# ase >=3.25.0 is required for supercell to be generated,
# otherwise on 3.21.1 we encountered negative number of atoms during supercell generation
"ase>=3.25.0",
"mat3ra-api-client>=2026.1.23.post0",
# Use a valid PEP 508 URL for a local file dependency: file URIs must be absolute and include three slashes
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Misleading comment — references file:// URIs but the dependency is a VCS URL

The comment on Line 11 says "file URIs must be absolute and include three slashes", which describes file:/// local-path dependencies. The actual dependency on Line 12 is a git+https:// VCS URL — a completely different PEP 508 specifier type. The comment is inaccurate and could confuse future editors.

✏️ Suggested fix
-  # Use a valid PEP 508 URL for a local file dependency: file URIs must be absolute and include three slashes
-  "mat3ra-api-client @ git+https://github.com/Exabyte-io/api-client.git@a329f363893ee96832b5c1a3c514ade28f0839cb",
+  # Pinned to a specific commit until a new PyPI release is available; replace once mat3ra-api-client >= <target_version> is published
+  "mat3ra-api-client @ git+https://github.com/Exabyte-io/api-client.git@a329f363893ee96832b5c1a3c514ade28f0839cb",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pyproject.toml` at line 11, The comment on the pyproject.toml line references
file:// file URIs but the actual dependency is a VCS specifier using
git+https://; update or remove the misleading comment so it accurately describes
the dependency type (e.g., mention PEP 508 VCS specifiers or the git+https://
URL) and ensure any guidance matches the dependency string git+https:// rather
than file:/// URIs.

"mat3ra-api-client @ git+https://github.com/Exabyte-io/api-client.git@a329f363893ee96832b5c1a3c514ade28f0839cb",
"matplotlib>=3.4.1",
"pandas>=1.5.3",
"pymatgen==2024.4.13",
"mat3ra-made>=2025.8.13.post0",
"mat3ra-utils>=2024.6.11.post0",
"mat3ra-wode"
"mat3ra-wode",
"mat3ra-prode @ git+https://github.com/Exabyte-io/prode.git@5b2e02ddbaf5dd473f0acaf1e1d76ddadc6bb184"
]

[project.optional-dependencies]
Expand Down
7 changes: 5 additions & 2 deletions utils/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,9 @@ def visualize_workflow(workflow, level: int = 2) -> None:
display_JSON(workflow_config, level=level)


def render_prove(results, width=900, title="Properties", extra_config=None):
def visualize_properties(results, width=900, title="Properties", extra_config=None):
"""
Render Prove results viewer in a notebook (Jupyter / Colab / Pyodide).
Visualize properties using a Prove viewer.

Args:
results: List[dict] of property JSON objects (or a single dict).
Expand All @@ -403,6 +403,9 @@ def render_prove(results, width=900, title="Properties", extra_config=None):
if isinstance(results, dict):
results = [results]

# Only keep the properties we can display
results = [r for r in results if "value" in r or "values" in r]

Comment on lines +406 to +408
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add an early-return guard and a warning for the empty-after-filter case.

Items without "value" or "values" are silently dropped. If all results are filtered out the viewer still renders (displaying an empty panel), giving the caller no feedback. This is easy to hit when prototyping: passing a freshly-fetched property dict that uses a different key name (e.g. "data") produces a blank viewer with no diagnostic output.

🛡️ Proposed fix
     # Only keep the properties we can display
     results = [r for r in results if "value" in r or "values" in r]
+
+    if not results:
+        print("render_prove: no displayable properties found (each item must contain 'value' or 'values').")
+        return
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Only keep the properties we can display
results = [r for r in results if "value" in r or "values" in r]
# Only keep the properties we can display
results = [r for r in results if "value" in r or "values" in r]
if not results:
print("render_prove: no displayable properties found (each item must contain 'value' or 'values').")
return
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@utils/visualize.py` around lines 406 - 408, After filtering with results = [r
for r in results if "value" in r or "values" in r], add an early-return guard
that checks if the filtered results list is empty; if so emit a clear warning
(using the module logger or warnings.warn) explaining that all items were
dropped because they lacked "value"/"values" and return early (e.g., None or an
empty display structure) to avoid rendering an empty panel. Locate the filter
using the variable name results and implement the warning + return immediately
after that list comprehension.

timestamp = time.time()
div_id = f"prove-{timestamp}"
results_json = json.dumps(results)
Expand Down