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

Add simplified param.depends and watch mechanisms #253

Merged
merged 9 commits into from Aug 28, 2018

Conversation

philippjfr
Copy link
Member

Supersedes #250 by making a number of simplifications:

  • No viewable argument for param.depends
  • No cache argument for param.depends (can be added back later)
  • Renamed eager keyword watch in param.depends

Copy link
Member

@jbednar jbednar left a comment

Choose a reason for hiding this comment

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

Seems like there are several things still up in the air, but maybe Chris and Philipp could meet to decide them and move on?



# (thought I was going to have a few decorators following this pattern)
def accept_arguments(f):
Copy link
Member

Choose a reason for hiding this comment

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

Would be helpful to have docstrings on some of these new functions


# TODO: this is a python 3.6+ thing; we can presumably do this in
# Parameterized.__new__ for older pythons. (And merge with objtype
# slot.)
Copy link
Member

Choose a reason for hiding this comment

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

@ceball, can you work out what to do here for when not in 3.6?

# (not specific to this change, but regarding attrib_name, owner:
# what if someone re-uses a parameter object across different
# classes? maybe we should raise an error if attrib name,owner
# already set)
Copy link
Member

Choose a reason for hiding this comment

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

Seems like that would be polite of us but is not required for merging.

@@ -472,24 +564,38 @@ def __set__(self,obj,val):
object stored in a constant or read-only Parameter (e.g. the
left bound of a BoundingBox).
"""
# TODO: simplify this method!
Copy link
Member

Choose a reason for hiding this comment

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

Or document it, at least.

@@ -979,6 +1085,65 @@ def inspect_value(self_,name): # pylint: disable-msg=E0213

return value


def params_depended_on(self_,name):
Copy link
Member

Choose a reason for hiding this comment

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

This and several more below need docstrings...

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also not sure about the names yet but we can iterate on that outside this PR.

Copy link
Member

Choose a reason for hiding this comment

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

I agree - will be part of an issue covering things that need to be sorted out before the next release.

# add watched dependencies
#
# TODO: This isn't great. Also note anything here will happen
# for every instantiation.
Copy link
Member Author

Choose a reason for hiding this comment

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

This bit seems to be pretty expensive, it seems to take about 4x longer than before to instantiate a parameterized class.

Copy link
Member

Choose a reason for hiding this comment

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

Did it get any better? I'd expect it to be a bit better than before (and minimal impact when there's no watching), but there are still improvements I plan to make (future PR).

ceball and others added 4 commits August 28, 2018 11:52
(Includes restoring more explicit args for depends().)
Dependencies: support more pythons and begin storing dependency info in more convenient way
@coveralls
Copy link

coveralls commented Aug 28, 2018

Coverage Status

Coverage decreased (-2.00001%) to 74.354% when pulling 5bb9531 on param_mthd_deps_simplified into a4e617d on master.

@ceball
Copy link
Member

ceball commented Aug 28, 2018

With #255, does this cover what yuo need for now?

When merged, I'll make an issues about things that must be cleaned up before release, and things that could be improved/added in the future.

@philippjfr
Copy link
Member Author

With #255, does this cover what yuo need for now?

Yes I think so. Looking forward to seeing this merged.

@ceball
Copy link
Member

ceball commented Aug 28, 2018

Who's handling that - me or you? I don't mind either way, just let me know if I should do it...

@philippjfr
Copy link
Member Author

Who's handling that - me or you? I don't mind either way, just let me know if I should do it...

Missed your question about subscribe on the other PR. Happy to merge both once that's deleted.

ceball and others added 2 commits August 28, 2018 15:31
Also simplified signature of watch (and unwatch).
@jlstevens
Copy link
Contributor

Looking at the diff I do have a number of suggestions to make. To avoid slowing things down, I won't write anything down just yet so that we can merge sooner rather than late.

@ceball
Copy link
Member

ceball commented Aug 28, 2018

Looking at the diff I do have a number of suggestions to make

I have some suggestions too. But yes, I think until we've settled on the functionality we want, we should hold off. Unless you're talking about something that's an error...

@philippjfr
Copy link
Member Author

I just double checked and after updating panel and my holoviews PR everything still works great.

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.

None yet

5 participants