Skip to content

Historical Record: Removal of :load: Directives in Cake Eating Series (PR #679) #680

@mmcky

Description

@mmcky

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:

  1. Self-contained - All code visible in the lecture file itself
  2. Compatible with jupytext - Enables easy conversion to executable Python with jupytext --to py
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions