Build-assets.py plugin failure

Hi,

I’m trying to port my plugins to 2.2, but if I run:
bin/maintenance/build-assets.py plugin <path_to_my_plugin>

I get the following Stacktrace:

No handlers could be found for logger "indico.plugins"
Traceback (most recent call last):
  File "bin/maintenance/dump_url_map.py", line 70, in <module>
    main()
  File "/Users/bkolobara/Development/indico/indico-production-env/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/bkolobara/Development/indico/indico-production-env/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/bkolobara/Development/indico/indico-production-env/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/bkolobara/Development/indico/indico-production-env/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "bin/maintenance/dump_url_map.py", line 62, in main
    rules = get_rules(plugin)
  File "bin/maintenance/dump_url_map.py", line 42, in get_rules
    'PLUGINS': {plugin} if plugin else set()})
  File "/Users/bkolobara/Development/indico/indico-production-env/lib/python2.7/site-packages/indico/web/flask/app.py", line 345, in make_app
    raise Exception('Could not load some plugins: {}'.format(', '.join(plugin_engine.get_failed_plugins(app))))
Exception: Could not load some plugins: ecmwf
Traceback (most recent call last):
  File "./src/bin/maintenance/build-assets.py", line 270, in <module>
    cli()
  File "/Users/bkolobara/Development/indico/indico-production-env/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/bkolobara/Development/indico/indico-production-env/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/bkolobara/Development/indico/indico-production-env/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/bkolobara/Development/indico/indico-production-env/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/bkolobara/Development/indico/indico-production-env/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "./src/bin/maintenance/build-assets.py", line 233, in build_plugin
    '--plugin', webpack_build_config['plugin']] + force_url_map)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['python', 'bin/maintenance/dump_url_map.py', '--output', '/Users/bkolobara/Development/indico/ecmwf_indico_plugin/url_map.json', '--plugin', 'ecmwf', '--force']' returned non-zero exit status 1

So I got a bit stuck on this one.

Does your plugin depend on another plugin? If yes, create a <yourplugindir>/required-build-plugins.json containing a JSON array with the name of the required plugin.

Is the plugin installed in your python virtualenv? If not, install it (pip install -e <yourplugindir>) - this isn’t amazing but to dump the URL map we need to load the plugin and that’s not really possible without its entrypoint being registered in the env.

It doesn’t depend on any other plugins & it’s installed in the current virtualenv.

This entry point should be picked up in this case?

entry_points={
  'indico.plugins': {'ecmwf = ecmwf.plugin:ECMWFPlugin'}
},

Yes. Does indico setup list-plugins show the plugin?

Also see if you can manually run python bin/maintenance/dump_url_map.py --plugin ecmwf --output /tmp/test.json without errors.

After running indico setup list-plugins I noticed that I had 2 .egg-info files in my plugin after renaming it. I ended up dumping the virtual env and recreating everything again. Now i run into other errors :slight_smile:.

I also needed to install this two npm dependencies for it to work: extract-text-webpack-plugin & style-loader.

My latest exception is: ManifestKeyNotFoundError: Key css/ecmwf.css not found in manifest.json.

But I guess all my css/js files in the static folder are messed up as I don’t use webpack to build them. Is there an example of an extension that injects css/js so I can see the setup?

Why do you want to install extract-text-webpack-plugin? We are using mini-css-extract-plugin and you should not need to install it manually since the packages from the indico core node_modules are reused.

Anyway, you do need to use webpack to build js/css assets now - the easiest option would be looking at an existing plugin how it’s done there. It’s quite easy and all the building is done automatically so you don’t need to learn how to configure/use webpack etc.!

Since you asked for examples:

1 Like

Without installing extract-text-webpack-plugin I would get the following error:

# ./bin/maintenance/build-assets.py plugin <fulll_plugin_path> --dev
Cannot find module 'extract-text-webpack-plugin'
Require stack:
- /Users/bkolobara/Development/indico/src/webpack/base.js
- /Users/bkolobara/Development/indico/src/webpack/index.js
- /Users/bkolobara/Development/indico/src/plugin.webpack.config.js
- /Users/bkolobara/Development/indico/src/node_modules/webpack-cli/bin/utils/convert-argv.js
- /Users/bkolobara/Development/indico/src/node_modules/webpack-cli/bin/cli.js
- /Users/bkolobara/Development/indico/src/node_modules/webpack/bin/webpack.js
Error: running webpack failed

Thanks for the links. I will check everything out.

Do you have the latest Indico version (2.2-maintenance branch)?

Yes, but it also could be that I run npm install when I was on master. There was a lot of “experimentation” until I got it working :slight_smile:

Best to rm -rf node_modules and npm install again in that case (and in case package-lock.json shows up as changed in git, revert the changes in that file before npm install)

1 Like