Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Enable comms to work across different Python versions #492

Merged
merged 21 commits into from
May 29, 2024

Conversation

impact27
Copy link
Contributor

@impact27 impact27 commented May 23, 2024

Cloudpickle only works when the exact same version of python is used. Replaced with json.

This creates a bit more work because all the input and output of comms must be json serialisable or bytes

Goes with spyder-ide/spyder#22120

Fixes #468

FrameSummary are not compatible between versions of python. This change follows the doc here: https://docs.python.org/3/library/traceback.html#traceback.FrameSummary

@impact27 impact27 changed the title PR: SpyderFrameSummary PR: Drop cloudpickle May 25, 2024
@impact27 impact27 changed the title PR: Drop cloudpickle PR: Enable comms across different versions of python May 27, 2024
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Thanks @impact27 for your hard work on this! I only small formatting suggestions and a question for you.

spyder_kernels/comms/commbase.py Outdated Show resolved Hide resolved
spyder_kernels/comms/commbase.py Outdated Show resolved Hide resolved
spyder_kernels/comms/commbase.py Outdated Show resolved Hide resolved
spyder_kernels/comms/commbase.py Outdated Show resolved Hide resolved
spyder_kernels/comms/commbase.py Outdated Show resolved Hide resolved
spyder_kernels/comms/commbase.py Show resolved Hide resolved
spyder_kernels/comms/commbase.py Outdated Show resolved Hide resolved
spyder_kernels/console/kernel.py Outdated Show resolved Hide resolved
@@ -346,14 +350,21 @@ def get_var_properties(self):
return None

@comm_handler
def get_value(self, name):
def get_value(self, name, encoded=False):
Copy link
Member

Choose a reason for hiding this comment

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

Why encoded is False by default and not True? Don't we need all values to be encoded with Cloudpickle?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

get_value is also used in spyder_kernels e.g. in the tests where there is no need for encoding. Only the comm call requires encoding. The extra bonus is that it makes the encoding explicit on the frontend side

spyder_kernels/console/kernel.py Show resolved Hide resolved
@ccordoba12 ccordoba12 added this to the v3.0.0b7 milestone May 28, 2024
@ccordoba12 ccordoba12 added the type:Bug Something isn't working label May 28, 2024
@ccordoba12 ccordoba12 changed the title PR: Enable comms across different versions of python PR: Enable comms to work across different Python versions May 28, 2024
Co-authored-by: Carlos Cordoba <ccordoba12@gmail.com>
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Looks good to me now, thanks @impact27!

@ccordoba12 ccordoba12 merged commit cf59728 into spyder-ide:master May 29, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debugger not working for environments with different Python versions
2 participants