Skip to content

feat: add scoped material bridge helpers - #354

Closed
VsevolodX wants to merge 1 commit into
mainfrom
fix/solid-solution
Closed

feat: add scoped material bridge helpers#354
VsevolodX wants to merge 1 commit into
mainfrom
fix/solid-solution

Conversation

@VsevolodX

@VsevolodX VsevolodX commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

  • add generic Pyodide host data sending with a JupyterLite-compatible fallback
  • add scoped material synchronization for Python REPL sessions
  • add package-owned material preamble and unit coverage

Validation

  • 26 Python unit tests passed
  • Ruff, Black, isort, mypy, and repository pre-commit checks passed

Related

Summary by CodeRabbit

  • New Features
    • Added automatic synchronization of materials created in interactive Python notebooks.
    • Added support for sending notebook data through Pyodide and JupyterLite environments.
    • Added a ready-to-use material setup for interactive Python sessions, including material types, defect and nanoparticle options, and coordinate utilities.
  • Bug Fixes
    • Improved data delivery across supported notebook environments, including fallback handling when direct browser communication is unavailable.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 08abdea6-bba2-4ece-8c64-f3720ecdd74b

📥 Commits

Reviewing files that changed from the base of the PR and between fd8fc52 and 786bb15.

📒 Files selected for processing (7)
  • src/py/mat3ra/notebooks_utils/core/entity/material/io.py
  • src/py/mat3ra/notebooks_utils/io.py
  • src/py/mat3ra/notebooks_utils/preamble/__init__.py
  • src/py/mat3ra/notebooks_utils/preamble/material.py
  • src/py/mat3ra/notebooks_utils/pyodide/io.py
  • tests/py/unit/core/entity/test_material_io.py
  • tests/py/unit/test_pyodide_io.py

📝 Walkthrough

Walkthrough

Changes

Material synchronization

Layer / File(s) Summary
Pyodide payload transport
src/py/mat3ra/notebooks_utils/io.py, src/py/mat3ra/notebooks_utils/pyodide/io.py, tests/py/unit/test_pyodide_io.py
Adds the public send_data wrapper and Pyodide transport. The transport uses the JavaScript bridge when available and a lazy-loaded display fallback otherwise.
Material collection and REPL preamble
src/py/mat3ra/notebooks_utils/core/entity/material/io.py, src/py/mat3ra/notebooks_utils/preamble/*, tests/py/unit/core/entity/test_material_io.py
Adds sync_materials, which collects public direct and one-level nested Material values, excludes reserved bindings, and sends scoped entities. Adds material preamble exports and tests.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Notebook as Notebook code
  participant Sync as sync_materials
  participant PublicIO as send_data
  participant PyodideIO as send_data_pyodide
  participant Bridge as JavaScript bridge
  Notebook->>Sync: provide globals_dict
  Sync->>Sync: collect and serialize Material values
  Sync->>PublicIO: send synchronization payload
  PublicIO->>PyodideIO: forward payload in Pyodide
  PyodideIO->>Bridge: send serialized payload
Loading

Possibly related PRs

Suggested reviewers: timurbazhirov

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the addition of scoped material synchronization and bridge helper functionality.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/solid-solution

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@VsevolodX

Copy link
Copy Markdown
Member Author

Superseded by #355, opened from the correct feature/SOF-7961 branch. The commit and file contents are unchanged.

@VsevolodX VsevolodX closed this Aug 6, 2026
@VsevolodX
VsevolodX deleted the fix/solid-solution branch August 6, 2026 02:27
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