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

consider dill as a replacement for cloudpickle to improve caching of functions #260

Open
satra opened this issue May 16, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@satra
Copy link
Contributor

satra commented May 16, 2020

https://pypi.org/project/dill/ may allow us to pickle functions that behave the same way across two different environments (by getting source code). this should allow us to pickle arbitrary functions but will have to see if multiple functions can be encoded. there is an open issue using it inside ipython (uqfoundation/dill#346)

@satra satra added the enhancement New feature or request label May 16, 2020
@nicolocin
Copy link
Collaborator

Was looking into typing and found out that dill doesn't preserve type annotations when pickling typed functions (uqfoundation/dill#179). Still not working on python 3.7.7 and dill 0.3.2, which is the latest version. Potentially an issue?

import dill
import typing as ty

def doit(x: int, y: ty.List[int]) -> ty.List[int]:
    return y + [x]

_doit = dill.copy(doit)

# >>> {'x': <class 'int'>, 'y': ty.List[int], 'return': ty.List[int]}
print(doit.__annotations__)

# >>> {}
print(_doit.__annotations__)

@satra
Copy link
Contributor Author

satra commented Jul 1, 2020

@nicolocin - that may not be a necessary element since our use of dill is after the function has been transformed to a task, at which point it would be nice to have the annotations, but not necessary. you can check if dill can get the source code with the annotations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants