-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Dependencies:
#992 [M4-P10] ──► #THIS [M4-P11]
Dependencies:
- M4-P10: [M4-P10] Jupytext Migration: Dynamics/Condensation Part 2 + Customization (2 notebooks) #992
Description
Convert 2 long-running notebooks from the Simulations directory to Jupytext paired sync format (.py:percent). This is Phase 11 of the M4 Jupytext Full Migration maintenance plan, covering cloud chamber simulation tutorials.
Important: These are long-running notebooks. Profile execution time and determine appropriate handling (pre-commit exclusion vs CI-only). If any notebooks contain outdated API calls, update them to use the current API.
Context
This is part of the M4 maintenance plan to complete Jupytext paired sync migration for all remaining notebooks in docs/Examples/. Continues from M4-P10 which completed Condensation and Customization notebooks.
Value:
- Enables editing notebooks as plain Python files (better diffs, linting, IDE support)
- Validates notebook content through linting
- Documents execution times for slow notebook handling strategy
- Ensures notebooks use current API (no deprecated calls)
Scope
Estimated Lines of Code: ~50-150 lines (metadata + formatting + any API updates)
Complexity: Medium (long-running execution)
Notebooks to Convert (2) - Long-Running:
docs/Examples/Simulations/Notebooks/Cloud_Chamber_Single_Cycle.ipynbdocs/Examples/Simulations/Notebooks/Cloud_Chamber_Multi_Cycle.ipynb
Files Created:
docs/Examples/Simulations/Notebooks/Cloud_Chamber_Single_Cycle.py(~100-300 LOC)docs/Examples/Simulations/Notebooks/Cloud_Chamber_Multi_Cycle.py(~100-300 LOC)
Acceptance Criteria
Execution Time Profiling
- Profile execution time for Cloud_Chamber_Single_Cycle.ipynb
- Profile execution time for Cloud_Chamber_Multi_Cycle.ipynb
- Document times in PR description for future reference
- Determine handling:
< 60s= pre-commit,60-300s= CI only,> 300s= nightly CI
Conversion
- Both notebooks converted to
.py:percentformat usingvalidate_notebook --convert-to-py - Each
.pyfile has proper Jupytext header withpy:percentformat
API Updates (REQUIRED if outdated)
- Review execution output for deprecation warnings or API errors
- Update any outdated import paths to current API
- Update any deprecated function calls to current equivalents
- Update any changed function signatures (parameters renamed/added/removed)
- Verify updated code produces equivalent results
Linting
- Run
ruff check --fixon all new.pyfiles - Run
ruff formaton all new.pyfiles - Final
ruff checkpasses with no errors
Sync Validation
- Sync
.pychanges back to.ipynbusingvalidate_notebook --sync - Validate sync status with
validate_notebook --check-sync(must pass)
Execution
- Both notebooks execute successfully using
run_notebookwith extended timeout (1200s) - No API deprecation warnings in output
- No errors or exceptions during execution
Technical Notes
Conversion Workflow
For each notebook:
# 1. Convert to .py:percent format
python3 .opencode/tool/validate_notebook.py docs/Examples/Simulations/Notebooks/Cloud_Chamber_Single_Cycle.ipynb --convert-to-py
# 2. Lint the new .py file
ruff check docs/Examples/Simulations/Notebooks/Cloud_Chamber_Single_Cycle.py --fix
ruff format docs/Examples/Simulations/Notebooks/Cloud_Chamber_Single_Cycle.py
# 3. Sync linted .py back to .ipynb
python3 .opencode/tool/validate_notebook.py docs/Examples/Simulations/Notebooks/Cloud_Chamber_Single_Cycle.ipynb --sync
# 4. Execute with extended timeout to profile time
time python3 .opencode/tool/run_notebook.py docs/Examples/Simulations/Notebooks/Cloud_Chamber_Single_Cycle.ipynb --timeout 1200
# 5. If deprecation warnings or errors found:
# - Edit the .py file to update API calls
# - Re-lint and re-sync
# - Re-execute to verify fix
# 6. Validate sync status
python3 .opencode/tool/validate_notebook.py docs/Examples/Simulations/Notebooks/Cloud_Chamber_Single_Cycle.ipynb --check-syncExecution Time Handling Strategy
| Execution Time | Handling |
|---|---|
| < 60 seconds | Include in pre-commit hook |
| 60-300 seconds | Exclude from pre-commit, include in CI |
| > 300 seconds | Nightly CI job only (exclude from PR CI) |
Document execution times in PR for M4-P14 (pre-commit hook configuration).
API Update Guidelines
When updating outdated API calls:
- Import path changes: Update
from particula.old.path import Xtofrom particula.new.path import X - Function renames: Replace
old_function()withnew_function() - Parameter changes: Update function calls with renamed/new parameters
- Class changes: Update class instantiation if constructors changed
- Return type changes: Adjust any code that depends on return values
Reference current API: Check particula/ source code for current function signatures and import paths.
References
Maintenance Plan:
adw-docs/dev-plans/maintenance/M4-jupytext-full-migration.md- Full migration plan
Related:
- [M4-P10] Jupytext Migration: Dynamics/Condensation Part 2 + Customization (2 notebooks) #992 - M4-P10 (dependency)
adw-docs/documentation_guide.md- Notebook editing guidelines