diff --git a/.github/workflows/cache.yml b/.github/workflows/cache.yml index 438912c0..734d5174 100644 --- a/.github/workflows/cache.yml +++ b/.github/workflows/cache.yml @@ -14,7 +14,7 @@ jobs: auto-update-conda: true auto-activate-base: true miniconda-version: 'latest' - python-version: "3.12" + python-version: "3.13" environment-file: environment.yml activate-environment: quantecon - name: Build HTML diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75a1ee7d..6a7f36e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: auto-update-conda: true auto-activate-base: true miniconda-version: 'latest' - python-version: "3.12" + python-version: "3.13" environment-file: environment.yml activate-environment: quantecon - name: Install latex dependencies diff --git a/.github/workflows/execution-linux.yml b/.github/workflows/execution-linux.yml index fedc2e41..2ae72f73 100644 --- a/.github/workflows/execution-linux.yml +++ b/.github/workflows/execution-linux.yml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest"] - python-version: ["3.12"] + python-version: ["3.13"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/execution-osx.yml b/.github/workflows/execution-osx.yml index b6aab55c..b3df8203 100644 --- a/.github/workflows/execution-osx.yml +++ b/.github/workflows/execution-osx.yml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: os: ["macos-latest"] - python-version: ["3.12"] + python-version: ["3.13"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/execution-win.yml b/.github/workflows/execution-win.yml index 6f7e1ae3..f0bf9d34 100644 --- a/.github/workflows/execution-win.yml +++ b/.github/workflows/execution-win.yml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: os: ["windows-latest"] - python-version: ["3.12"] + python-version: ["3.13"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 58cd14b6..88f354ce 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,7 @@ jobs: auto-update-conda: true auto-activate-base: true miniconda-version: 'latest' - python-version: "3.12" + python-version: "3.13" environment-file: environment.yml activate-environment: quantecon - name: Install latex dependencies diff --git a/.gitignore b/.gitignore index d1e96dd0..a15f5193 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ dask-worker-space .ipynb_checkpoints/ .virtual_documents/ +lectures/sine_wave.py lectures/mathfoo.py lectures/mod.py lectures/test.py \ No newline at end of file diff --git a/environment.yml b/environment.yml index 11b6e1f7..87316c85 100644 --- a/environment.yml +++ b/environment.yml @@ -2,17 +2,16 @@ name: quantecon channels: - default dependencies: - - python=3.12 - - anaconda=2024.10 + - python=3.13 + - anaconda=2025.06 - pip - pip: - - jupyter-book==1.0.3 - - quantecon-book-theme==0.8.2 - - sphinx-tojupyter==0.3.0 + - jupyter-book==1.0.4post1 + - quantecon-book-theme==0.8.3 + - sphinx-tojupyter==0.3.1 - sphinxext-rediraffe==0.2.7 - sphinx-exercise==1.0.1 - - ghp-import==2.1.0 - - sphinxcontrib-youtube==1.3.0 #Version 1.3.0 is required as quantecon-book-theme is only compatible with sphinx<=5 + - sphinxcontrib-youtube==1.4.1 - sphinx-togglebutton==0.3.2 diff --git a/lectures/getting_started.md b/lectures/getting_started.md index d6798fb5..ecb19613 100644 --- a/lectures/getting_started.md +++ b/lectures/getting_started.md @@ -376,7 +376,7 @@ You will spend a lot of time debugging code, so it is important to [learn how to If you are using a newer version of Jupyter, you should see a bug icon on the right end of the toolbar. ```{figure} /_static/lecture_specific/getting_started/debug.png -:scale: 80% +:scale: 50% :figclass: auto ``` diff --git a/lectures/matplotlib.md b/lectures/matplotlib.md index 3a47c0dc..5e80dfd3 100644 --- a/lectures/matplotlib.md +++ b/lectures/matplotlib.md @@ -122,7 +122,7 @@ If everything is properly configured, then adding LaTeX is trivial ```{code-cell} python3 fig, ax = plt.subplots() -ax.plot(x, y, 'r-', linewidth=2, label='$y=\sin(x)$', alpha=0.6) +ax.plot(x, y, 'r-', linewidth=2, label=r'$y=\sin(x)$', alpha=0.6) ax.legend(loc='upper center') plt.show() ``` @@ -131,7 +131,7 @@ Controlling the ticks, adding titles and so on is also straightforward ```{code-cell} python3 fig, ax = plt.subplots() -ax.plot(x, y, 'r-', linewidth=2, label='$y=\sin(x)$', alpha=0.6) +ax.plot(x, y, 'r-', linewidth=2, label=r'$y=\sin(x)$', alpha=0.6) ax.legend(loc='upper center') ax.set_yticks([-1, 0, 1]) ax.set_title('Test plot') @@ -163,7 +163,7 @@ x = np.linspace(-4, 4, 150) for i in range(3): m, s = uniform(-1, 1), uniform(1, 2) y = norm.pdf(x, loc=m, scale=s) - current_label = f'$\mu = {m:.2}$' + current_label = rf'$\mu = {m:.2}$' ax.plot(x, y, linewidth=2, alpha=0.6, label=current_label) ax.legend() plt.show() @@ -186,7 +186,7 @@ for i in range(num_rows): m, s = uniform(-1, 1), uniform(1, 2) x = norm.rvs(loc=m, scale=s, size=100) axes[i, j].hist(x, alpha=0.6, bins=20) - t = f'$\mu = {m:.2}, \quad \sigma = {s:.2}$' + t = rf'$\mu = {m:.2}, \quad \sigma = {s:.2}$' axes[i, j].set(title=t, xticks=[-4, 0, 4], yticks=[]) plt.show() ``` @@ -419,7 +419,7 @@ x = np.linspace(-4, 4, 150) for i in range(3): m, s = uniform(-1, 1), uniform(1, 2) y = norm.pdf(x, loc=m, scale=s) - current_label = f'$\mu = {m:.2}$' + current_label = rf'$\mu = {m:.2}$' ax.plot(x, y, linewidth=2, alpha=0.6, label=current_label) ax.legend() plt.show() @@ -462,8 +462,9 @@ Place all the curves in the same figure. The output should look like this -```{figure} /_static/lecture_specific/matplotlib/matplotlib_ex1.png +```{image} /_static/lecture_specific/matplotlib/matplotlib_ex1.png :scale: 130 +:align: center ``` ```{exercise-end} diff --git a/lectures/numba.md b/lectures/numba.md index fb458daf..736b1b52 100644 --- a/lectures/numba.md +++ b/lectures/numba.md @@ -563,7 +563,8 @@ Suppose that the volatility of returns on an asset can be in one of two regimes The transition probabilities across states are as follows -```{figure} /_static/lecture_specific/sci_libs/nfs_ex1.png +```{image} /_static/lecture_specific/sci_libs/nfs_ex1.png +:align: center ``` For example, let the period length be one day, and suppose the current state is high. diff --git a/lectures/oop_intro.md b/lectures/oop_intro.md index 708f1ee9..21787a1d 100644 --- a/lectures/oop_intro.md +++ b/lectures/oop_intro.md @@ -61,6 +61,7 @@ We'll make use of the following third party library ```{code-cell} python3 +:tags: [hide-output] !pip install rich ``` diff --git a/lectures/pandas.md b/lectures/pandas.md index 61bc5056..e2f93b75 100644 --- a/lectures/pandas.md +++ b/lectures/pandas.md @@ -682,8 +682,9 @@ ticker = read_data(ticker_list) Complete the program to plot the result as a bar graph like this one: -```{figure} /_static/lecture_specific/pandas/pandas_share_prices.png +```{image} /_static/lecture_specific/pandas/pandas_share_prices.png :scale: 80 +:align: center ``` ```{exercise-end} @@ -748,8 +749,9 @@ indices_list = {'^GSPC': 'S&P 500', Complete the program to show summary statistics and plot the result as a time series graph like this one: -```{figure} /_static/lecture_specific/pandas/pandas_indices_pctchange.png +```{image} /_static/lecture_specific/pandas/pandas_indices_pctchange.png :scale: 80 +:align: center ``` ```{exercise-end} diff --git a/lectures/pandas_panel.md b/lectures/pandas_panel.md index 9fd442b9..8bb6b29e 100644 --- a/lectures/pandas_panel.md +++ b/lectures/pandas_panel.md @@ -150,7 +150,7 @@ the row index (`.unstack()` works in the opposite direction - try it out) ```{code-cell} ipython3 -realwage.stack().head() +realwage.stack(future_stack=True).head() ``` We can also pass in an argument to select the level we would like to @@ -432,7 +432,7 @@ plt.show() summary statistics ```{code-cell} ipython3 -merged.stack().describe() +merged.stack(future_stack=True).describe() ``` This is a simplified way to use `groupby`. diff --git a/lectures/workspace.md b/lectures/workspace.md index ad60f88c..fe175e5b 100644 --- a/lectures/workspace.md +++ b/lectures/workspace.md @@ -3,10 +3,12 @@ jupytext: text_representation: extension: .md format_name: myst + format_version: 0.13 + jupytext_version: 1.17.2 kernelspec: - display_name: Python 3 - language: python name: python3 + display_name: Python 3 (ipykernel) + language: python --- (workspace)= @@ -51,7 +53,7 @@ Python files are used when writing long, reusable blocks of code - by convention Let us begin by working with the following example. -```{code-block} python +```{code-cell} ipython3 :caption: sine_wave.py :lineno-start: 1 @@ -68,17 +70,18 @@ plt.title('Sine Wave') plt.show() ``` -The code is first saved locally on the computer before it is executed. - As there are various ways to execute the code, we will explore them in the context of different development environments. One major advantage of using Python scripts lies in the fact that you can "import" functionality from other scripts into your current script or Jupyter Notebook. -Let's rewrite the earlier code into a function. +Let's rewrite the earlier code into a function and write to to a file called `sine_wave.py`. -```{code-block} python +```{code-cell} ipython3 :caption: sine_wave.py :lineno-start: 1 + +%%writefile sine_wave.py + import matplotlib.pyplot as plt import numpy as np @@ -94,7 +97,7 @@ def plot_wave(title : str = 'Sine Wave'): plt.show() ``` -```{code-block} python +```{code-cell} ipython3 :caption: second_script.py :lineno-start: 1 @@ -345,9 +348,7 @@ In case you already haven't, try For example, if you've installed the command line version, open up a terminal and enter. -```{code-block} bash -:class: no-execute - +```bash git clone https://github.com/QuantEcon/QuantEcon.py ``` (This is just `git clone` in front of the URL for the repository)