QuantEcon / QuantEcon/lecture-python.myst
Historical Record: Removal of :load: Directives in Cake Eating Series (PR #679)
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 123
- Forks
- 57
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 11
Description
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
- PR #679: Refactor optimal growth lectures into unified cake eating series
- Comment from @jstac: "I really need to be able to easily generate executable code via
jupytext --to py..."
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No contribution is requested: this issue records the completed changes from PR #679. Read the listed cake-eating lecture files and related external Python paths only if you need historical context; the documented outcome is that the directives were removed and the issue requires no further work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 10/100