Skip to content

MAINT: upgrade anaconda=2025.06 and python=3.13 - #215

Merged
mmcky merged 15 commits into
mainfrom
maint-software
Sep 22, 2025
Merged

mmcky merged 15 commits into
mainfrom
maint-software

Conversation

@mmcky

@mmcky mmcky commented Jul 29, 2025 •

Copy link
Copy Markdown
Contributor

This PR upgrades

  • ananconda=2025.06
  • python=3.13
  • quantecon-book-theme=0.9.2 (fixes for modal issues)

and associated compatible build infrastructure.

Tasks

@github-actions
github-actions Bot temporarily deployed to commit July 30, 2025 00:00 Inactive
@mmcky

mmcky commented Jul 30, 2025 •

Copy link
Copy Markdown
Contributor Author
  • fix execution incompatibilities with anaconda=2025.06 and numpy>=2.0

amss.err.log
amss2.err.log
amss3.err.log
match_transport.err.log

@netlify

netlify Bot commented Aug 5, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for lustrous-melomakarona-3ee73e ready!

Name Link
🔨 Latest commit 3af6f28
🔍 Latest deploy log https://app.netlify.com/projects/lustrous-melomakarona-3ee73e/deploys/68d1012de5f1d100089e51f7
😎 Deploy Preview https://deploy-preview-215--lustrous-melomakarona-3ee73e.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@mmcky

mmcky commented Aug 25, 2025 •

Copy link
Copy Markdown
Contributor Author

@kp992 this is currently blocked by amss and the interpolations package.

There are some suggestions in #223

We were thinking of Step 1 removing our dependency on interpolations then Step 2 look at converting this lecture to JAX. @HumphreyYang and I gave copilot a go in #244 if those ideas are helpful. Also please liaise with @HumphreyYang through #236 for the jax translation but I think Step 1 would be good to do first.

@kp992

kp992 commented Aug 25, 2025

Copy link
Copy Markdown
Collaborator

Thanks @mmcky. I will look into it.

@HumphreyYang

HumphreyYang commented Aug 25, 2025 •

Copy link
Copy Markdown
Member

Many thanks @mmcky and @kp992,

There is a drop-in replacement for the interpolation in #228.

We can move it into one of script in the static Python file.

This produces the same figures.

Here is a copy of the replacement if that is helpful:

@njit
def get_grid_nodes(grid):
    """
    Get the actual grid points from a grid tuple.
    """
    x_min, x_max, x_num = grid
    return np.linspace(x_min, x_max, x_num)

@njit
def linear_interp_1d_scalar(x_min, x_max, x_num, y_values, x_val):
    """Helper function for scalar interpolation"""
    x_nodes = np.linspace(x_min, x_max, x_num)

    # Extrapolation with linear extension
    if x_val <= x_nodes[0]:
        # Linear extrapolation using first two points
        if x_num >= 2:
            slope = (y_values[1] - y_values[0]) / (x_nodes[1] - x_nodes[0])
            return y_values[0] + slope * (x_val - x_nodes[0])
        else:
            return y_values[0]

    if x_val >= x_nodes[-1]:
        # Linear extrapolation using last two points
        if x_num >= 2:
            slope = (y_values[-1] - y_values[-2]) / (x_nodes[-1] - x_nodes[-2])
            return y_values[-1] + slope * (x_val - x_nodes[-1])
        else:
            return y_values[-1]

    # Binary search for the right interval
    left = 0
    right = x_num - 1
    while right - left > 1:
        mid = (left + right) // 2
        if x_nodes[mid] <= x_val:
            left = mid
        else:
            right = mid

    # Linear interpolation
    x_left = x_nodes[left]
    x_right = x_nodes[right]
    y_left = y_values[left]
    y_right = y_values[right]

    weight = (x_val - x_left) / (x_right - x_left)
    return y_left * (1 - weight) + y_right * weight

@njit
def linear_interp_1d(x_grid, y_values, x_query):
    """
    Perform 1D linear interpolation.
    """
    x_min, x_max, x_num = x_grid
    return linear_interp_1d_scalar(x_min, x_max, x_num, y_values, x_query[0])

@kp992

kp992 commented Aug 26, 2025

Copy link
Copy Markdown
Collaborator

Thanks @HumphreyYang for sharing this. Should we add this in the quantecon package? This is because we can reuse the same snippets across all the series?

@HumphreyYang

HumphreyYang commented Sep 21, 2025 •

Copy link
Copy Markdown
Member

Thanks @HumphreyYang for sharing this. Should we add this in the quantecon package? This is because we can reuse the same snippets across all the series?

I think for now we can put it into the script that is used across the lecture since we are going to rewrite things in JAX later.

@HumphreyYang

Copy link
Copy Markdown
Member

Hi @mmcky, I will use this PR to test the workaround now.

@github-actions

github-actions Bot commented Sep 21, 2025 •

Copy link
Copy Markdown
Contributor

@github-actions
github-actions Bot temporarily deployed to pull request September 21, 2025 03:14 Inactive
@mmcky

mmcky commented Sep 21, 2025

Copy link
Copy Markdown
Contributor Author

@HumphreyYang nice work!

The preview is looking pretty good. Are you happy for me to merge this?

@mmcky

mmcky commented Sep 21, 2025

Copy link
Copy Markdown
Contributor Author

@HumphreyYang it is interesting that the modal issue is still a problem in this preview build. So this isn't going to directly solve the problem.

@HumphreyYang

Copy link
Copy Markdown
Member

@HumphreyYang nice work!

The preview is looking pretty good. Are you happy for me to merge this?

Sounds great! I will commence stage 2 when migrating it to JAX since JAX result looks a bit different.

@HumphreyYang it is interesting that the modal issue is still a problem in this preview build.

Could you please let me know which model issue you are referring to?

@mmcky

mmcky commented Sep 22, 2025

Copy link
Copy Markdown
Contributor Author

@HumphreyYang nice work!
The preview is looking pretty good. Are you happy for me to merge this?

Sounds great! I will commence stage 2 when migrating it to JAX since JAX result looks a bit different.

@HumphreyYang it is interesting that the modal issue is still a problem in this preview build.

Could you please let me know which model issue you are referring to?

Thanks @HumphreyYang a modal is an html object that shows as a window. The colab button should show a modal :-)

@kp992

kp992 commented Sep 22, 2025

Copy link
Copy Markdown
Collaborator

Thanks @HumphreyYang and @mmcky for taking it forward. I missed the track of this PR somehow while working on the other JAX lectures.

@HumphreyYang

Copy link
Copy Markdown
Member

Thanks @HumphreyYang a modal is an html object that shows as a window. The colab button should show a modal :-)

Ah roger that. I thought the namedtuple model has some problem : )

@mmcky

mmcky commented Sep 22, 2025

Copy link
Copy Markdown
Contributor Author

@HumphreyYang, @kp992 has submitted a patch to fix the modal issue on the theme. Are you happy if we merge this as we will need the later version of sphinx unless we want to back port the fix to an earlier version of quantecon-book-theme but that is a lot of work. I'd prefer to merge this if we can.

@HumphreyYang

Copy link
Copy Markdown
Member

Hi @mmcky, please feel free to merge when you are ready!

@mmcky

mmcky commented Sep 22, 2025 •

Copy link
Copy Markdown
Contributor Author

if works then,

@github-actions
github-actions Bot temporarily deployed to pull request September 22, 2025 04:03 Inactive
@mmcky

mmcky commented Sep 22, 2025

Copy link
Copy Markdown
Contributor Author

thanks @kp992 and @HumphreyYang -- once I get the green tick of approval I will merge this.

@github-actions
github-actions Bot temporarily deployed to pull request September 22, 2025 08:16 Inactive
@mmcky
mmcky merged commit d65b66e into main Sep 22, 2025
@mmcky
mmcky deleted the maint-software branch September 22, 2025 08:20

This branch was previously deployed

2 inactive (1 outdated) deployments
pull request — 3af6f287 Deployed Sep 22, 2025 by github-actions[bot]
commit — c5b94d01 Deployed Jul 30, 2025 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants