GithubHelp home page GithubHelp logo

Comments (2)

samimia-swks avatar samimia-swks commented on June 12, 2024

What is interesting is that the current implementation of the depends() decorator, shown below, does use functools.wrap from the standard library; and that is supposed to solve the problem of pickeling decorated functions per this article...

@accept_arguments
def depends(func, *dependencies, watch=False, on_init=False, **kw):
    if iscoroutinefunction(func):
        @wraps(func)
        async def _depends(*args, **kw):
            return await func(*args, **kw)
    else:
        @wraps(func)
        def _depends(*args, **kw):
            return func(*args, **kw)

from param.

maximlt avatar maximlt commented on June 12, 2024

Hi @steenha and @samimia-swks,

Param unfortunately doesn't have too many tests that exert serializing Param objects with pickle. I think it actually just has one!

def test_pickle_instance(self):
import pickle
s = pickle.dumps(instance)
instance.scale=0.8
i = pickle.loads(s)
self.assertEqual(i(),(0.3,18,[10,20,30]))

As it is it's not too surprising that pickling "more" complex objects fail :/ Contributions in this area are more than welcomed. It'd be for instance interesting to know whether pickling package_depends worked in the past, and if so what change (there were lots of changes in the internals of param.depends) broke it.

from param.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.