Skip to content

Conversation

@rplopes
Copy link
Contributor

@rplopes rplopes commented Mar 25, 2025

Part of https://datacamp.atlassian.net/browse/CP-4659

This makes numpy and pandas no longer required dependencies, meaning that they won't be automatically installed when installing pythonwhat.

The only usage of any of them on anything other than comparing numpy/pandas objects (i.e. expected usage without the need to have those packages already imported anyway) is a np.testing.assert_equal(x, y) to compare dict, list and tuple objects, and a np.array_equal(list(x), list(y)) to compare map and filter objects. Those calls got refactored to not need numpy to achieve the same behavior.

With this change, users who relied on the instance of numpy and/or pandas installed by pythonwhat now need to install it themselves. This shouldn't affect most users, as it's good practice to always install one's own dependencies instead of having to rely on having them installed by other dependencies.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How confident are you that the refactor here leads to the same behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests pass and the few manual tests I did in Intro to Python seemed fine, though to be honest I may not have tested enough weird edge cases where there's a greater chance of there being something wrong. I can always look out for more SCTs and check if they still return the expected result. Fortunately, the worst case scenario is if there's a change in behavior for some edge case in some course, then the course build will fail when attempting to upgrade its course image to one with this updated pythonwhat version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested all SCTs for Intro to Python and Intermediate Python, and there was no regression, so that raises the confidence for now. Once we roll this out to more courses, we can always react at that time to any failed validation.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for double-checking and for the info.

@rplopes rplopes merged commit 27b8d1c into master Mar 28, 2025
1 check passed
@rplopes rplopes mentioned this pull request Mar 28, 2025
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