cloudpipe / cloudpipe/cloudpickle

Support for pickling functions within a class defined outside of __main__?

Open
#175 6 comments 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
1.9k
Forks
195
Avg merge
1d 10h
Merged PRs (30d)
1

Description

Cloudpickle's ability to serialize instantiated classes and their member functions is a huge advantage over cloudpickle alternatives. Unfortunately, this feature seems limited heavily to the check for `instantiated_class.__module__ == '__main__'`.

One hacky solution is to set `__module__` in the class definition:
```
class SomeFunClass(object):
__module__ = '__main__'

# Rest of the class definition
```

But this could cause problems with any code that relies on a proper value for `__module__`. Is there another solution I'm not seeing?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.