-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
When hvplot checks is_intake
, remove pathname requirement
#1051
Comments
This seems like a correct suggestion. Are you up for a PR to fixs it? 🙂 |
@hoxbro Yes I can do a PR — Do you mean the first or second proposed solution? |
I would be happy with either of them 👍 |
@martindurant Do you have an opinion about which of the above two solutions (at the bottom of the initial post) you think would be better? That is, is there a case in which
|
I can understand that hvplot needs to run the check for the case that intake isn't installed, and ideally doesn't want to import intake either just for the purpose of the check. You could do
i.e., a way to catch subclasses defined outside of the intake library. Note that the previous method is accidentally passing for most derived classes, since there's a convention to name packages "intake_*", but this is not a requirement. |
Ok great, and that works in my test case too. I'll work on a PR with that change. |
With the changes made in #1052, I still get an error. This can be recreated by using your example and replacing the last line with ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[11], line 40
36 cat = intake.open_catalog("test.yaml")
38 # try to make plot
39 # cat['ctd_source'].plot()
---> 40 cat['ctd_source'].read()
File ~/Development/holoviz/development/dev_hvplot/test_transform.py:32, in DataFrameTransform.read(self)
30 def read(self):
31 # return self.read()
---> 32 return self.to_dask()
File ~/Development/holoviz/development/dev_hvplot/test_transform.py:17, in DataFrameTransform.to_dask(self)
15 def to_dask(self):
16 if self._df is None:
---> 17 self._pick()
18 self._df = self._transform(self._source.to_dask().compute(),
19 **self._params["transform_kwargs"])
20 return self._df
File ~/miniconda3/envs/holoviz/lib/python3.10/site-packages/intake/source/derived.py:171, in DerivedSource._pick(self)
169 def _pick(self):
170 """Pick the source from the given targets"""
--> 171 self._source = self._chooser(self.targets, self.cat, self._kwargs, self._cat_kwargs)
172 if self.input_container != "other":
173 assert self._source.container == self.input_container
File ~/miniconda3/envs/holoviz/lib/python3.10/site-packages/intake/source/derived.py:100, in first(targets, cat, kwargs, cat_kwargs)
94 """A target chooser that simply picks the first from the given list
95
96 This is the default, particularly for the case of only one element in
97 the list
98 """
99 targ = targets[0]
--> 100 return get_source(targ, cat, kwargs.get(targ, {}), cat_kwargs)
File ~/miniconda3/envs/holoviz/lib/python3.10/site-packages/intake/source/derived.py:88, in get_source(target, cat, kwargs, cat_kwargs)
86 cat = cached_cats(caturl, **cat_kwargs)
87 if cat:
---> 88 return cat[target].configure_new(**kwargs)
89 # for testing only
90 return target
File ~/miniconda3/envs/holoviz/lib/python3.10/site-packages/intake/catalog/base.py:475, in Catalog.__getitem__(self, key)
473 out = out[part]
474 return out()
--> 475 raise KeyError(key)
KeyError: 'c' |
@hoxbro Oh I forgot that the |
I just edited the initial comment so that it is correct now. |
ALL software version info
(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc)
Description of expected behavior and the observed behavior
I'm making a plot with intake through an intake catalog using my own
DataFrameTransform
. Whenhvplot
checks the incomingdata
in_process_data()
in converter.py, it usesutils.py
is_intake()
which runsand an intake Transform that is not a fully-qualified path in the intake namespace (as mine isn't because it is just defined in my project) won't pass this test. But, I don't think it should need to since it is subsequently checked with
isinstance(data, DataSource)
. See discussion on this intake/intake#724.Complete, minimal, self-contained example code that reproduces the issue
Save to a local file "test_transform.py":
Stack traceback and/or browser JavaScript console output
Suggestion
So, perhaps a simple fix is just to remove
in
is_intake()
but I wasn't sure if that part was necessary for some other reason. Or just both checks could be options like:The text was updated successfully, but these errors were encountered: