XPublish has only one route when used with new plugin system #170
-
So Im trying to hookup with the new plugin system but Im not getting any of the routers I expect by default. I setup my rest like this: rest = xpublish.Rest(
app_kws={
"title": 'XREDS',
"description": 'XArray Environmental Data Services exposes environmental model data in common data formats for digestion in applications and notebooks',
"openapi_url": "/xreds.json",
},
cache_kws={
"available_bytes": 1e9
},
datasets=None,
plugins={
'xreds_datasets': DatasetProvider(),
'xpublish_wms': CfWmsPlugin(),
},
) The xpublish_wms plugin should expose When I load up I was pretty sure the old routers are gone and plugins should do everything now. Are the default plugins not loaded anymore? Am I missing a step? When I log
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
Okay the key here is that if plugins are speecified, the default ones are not loaded.... so you either have to specify all of them or specify none, then after register any other plugins. However, with this working I get this list of plugins:
So the WMS plugin in loading but it doesnt show on the docs/ page and I'm not sure why |
Beta Was this translation helpful? Give feedback.
-
When you specify If you want to add to the default plugins, you can use either rest = xpublish.Rest(
app_kws={
"title": 'XREDS',
"description": 'XArray Environmental Data Services exposes environmental model data in common data formats for digestion in applications and notebooks',
"openapi_url": "/xreds.json",
},
cache_kws={
"available_bytes": 1e9
},
datasets=None,
)
rest.register_plugin(DatasetProvider(), 'xreds_datasets')
rest.register_plugin(CfWmsPlugin(), 'xpublish_wms') Or from xpublish.plugins.manage import load_default_plugins
rest = xpublish.Rest(
app_kws={
"title": 'XREDS',
"description": 'XArray Environmental Data Services exposes environmental model data in common data formats for digestion in applications and notebooks',
"openapi_url": "/xreds.json",
},
cache_kws={
"available_bytes": 1e9
},
datasets=None,
plugins={
**load_default_plugins(),
'xreds_datasets': DatasetProvider(),
'xpublish_wms': CfWmsPlugin(),
},
) |
Beta Was this translation helpful? Give feedback.
When you specify
plugins
inxpublish.Rest()
it disables automatic loading of the default plugins.How plugins are loaded
If you want to add to the default plugins, you can use either
xpublish.Rest.register_plugin()
to add them one by one, or you can load the default plugins and then add yours to the dict before initializingxpublish.Rest
.