Context
As part of PR #679 (Refactor optimal growth lectures into unified cake eating series), we removed all :load: directives from the affected lectures and inlined the code directly.
Motivation
The :load: directive was removed to make lectures:
- Self-contained - All code visible in the lecture file itself
- Compatible with jupytext - Enables easy conversion to executable Python with
jupytext --to py
- Easier to maintain - No need to track external code files
Lectures That Had :load: Directives Removed
| Lecture File |
External Code File(s) Loaded |
Purpose |
cake_eating_numerical.md |
_static/lecture_specific/cake_eating_numerical/analytical.py |
Analytical solutions (c_star, v_star functions) |
cake_eating_stochastic.md (formerly optgrowth.md) |
_static/lecture_specific/optgrowth/cd_analytical.py |
Analytical solutions for Cobb-Douglas case |
cake_eating_stochastic.md |
_static/lecture_specific/optgrowth/solve_model.py |
solve_model() function for value function iteration |
cake_eating_time_iter.md (formerly coleman_policy_iter.md) |
_static/lecture_specific/optgrowth/cd_analytical.py |
Analytical solutions |
cake_eating_egm.md (formerly egm_policy_iter.md) |
_static/lecture_specific/optgrowth/cd_analytical.py |
Analytical solutions |
cake_eating_egm.md |
_static/lecture_specific/coleman_policy_iter/solve_time_iter.py |
solve_model_time_iter() function |
ifp.md |
_static/lecture_specific/coleman_policy_iter/solve_time_iter.py |
solve_model_time_iter() function |
ifp.md |
_static/lecture_specific/cake_eating_numerical/analytical.py |
Analytical solutions for cake eating |
optgrowth_fast.md (deleted) |
_static/lecture_specific/optgrowth_fast/ogm.py |
OptimalGrowthModel class |
optgrowth_fast.md (deleted) |
_static/lecture_specific/optgrowth_fast/ogm_crra.py |
OptimalGrowthModel_CRRA class |
optgrowth_fast.md (deleted) |
_static/lecture_specific/optgrowth/cd_analytical.py |
Analytical solutions |
optgrowth_fast.md (deleted) |
_static/lecture_specific/optgrowth/solve_model.py |
solve_model() function |
External Code Files That Were Loaded
_static/lecture_specific/cake_eating_numerical/analytical.py
_static/lecture_specific/optgrowth/cd_analytical.py
_static/lecture_specific/optgrowth/solve_model.py
_static/lecture_specific/coleman_policy_iter/solve_time_iter.py
_static/lecture_specific/optgrowth_fast/ogm.py
_static/lecture_specific/optgrowth_fast/ogm_crra.py
Files Deleted
The following external Python files were deleted after their content was inlined:
_static/lecture_specific/cake_eating_numerical/analytical.py
_static/lecture_specific/optgrowth/cd_analytical.py
_static/lecture_specific/optgrowth/solve_model.py
Impact
- 8 lecture files had
:load: directives removed
- All affected lectures now contain inline code
- No functionality changed - only code organization
- Lectures are now fully executable via
jupytext --to py lectures/filename.md
Related
Future Considerations
Going forward, we should prefer inline code over external :load: files for:
- Better jupytext compatibility
- Improved readability (all code visible in context)
- Easier maintenance
The :load: directive may still be useful for:
- Very large helper modules (>100 lines)
- Code shared across many lectures (though this should be in a proper Python package)
- Utility functions that would clutter the pedagogical flow
This issue serves as historical documentation and does not require action.
Context
As part of PR #679 (Refactor optimal growth lectures into unified cake eating series), we removed all
:load:directives from the affected lectures and inlined the code directly.Motivation
The
:load:directive was removed to make lectures:jupytext --to pyLectures That Had :load: Directives Removed
cake_eating_numerical.md_static/lecture_specific/cake_eating_numerical/analytical.pyc_star,v_starfunctions)cake_eating_stochastic.md(formerlyoptgrowth.md)_static/lecture_specific/optgrowth/cd_analytical.pycake_eating_stochastic.md_static/lecture_specific/optgrowth/solve_model.pysolve_model()function for value function iterationcake_eating_time_iter.md(formerlycoleman_policy_iter.md)_static/lecture_specific/optgrowth/cd_analytical.pycake_eating_egm.md(formerlyegm_policy_iter.md)_static/lecture_specific/optgrowth/cd_analytical.pycake_eating_egm.md_static/lecture_specific/coleman_policy_iter/solve_time_iter.pysolve_model_time_iter()functionifp.md_static/lecture_specific/coleman_policy_iter/solve_time_iter.pysolve_model_time_iter()functionifp.md_static/lecture_specific/cake_eating_numerical/analytical.pyoptgrowth_fast.md(deleted)_static/lecture_specific/optgrowth_fast/ogm.pyOptimalGrowthModelclassoptgrowth_fast.md(deleted)_static/lecture_specific/optgrowth_fast/ogm_crra.pyOptimalGrowthModel_CRRAclassoptgrowth_fast.md(deleted)_static/lecture_specific/optgrowth/cd_analytical.pyoptgrowth_fast.md(deleted)_static/lecture_specific/optgrowth/solve_model.pysolve_model()functionExternal Code Files That Were Loaded
_static/lecture_specific/cake_eating_numerical/analytical.py_static/lecture_specific/optgrowth/cd_analytical.py_static/lecture_specific/optgrowth/solve_model.py_static/lecture_specific/coleman_policy_iter/solve_time_iter.py_static/lecture_specific/optgrowth_fast/ogm.py_static/lecture_specific/optgrowth_fast/ogm_crra.pyFiles Deleted
The following external Python files were deleted after their content was inlined:
_static/lecture_specific/cake_eating_numerical/analytical.py_static/lecture_specific/optgrowth/cd_analytical.py_static/lecture_specific/optgrowth/solve_model.pyImpact
:load:directives removedjupytext --to py lectures/filename.mdRelated
jupytext --to py..."Future Considerations
Going forward, we should prefer inline code over external
:load:files for:The
:load:directive may still be useful for:This issue serves as historical documentation and does not require action.