I am stuck at getting any local Nomad parser running.
My programme: I have got simulation data in binary format, and want to import it into a local Nomad Oasis. I already have Python code that reads the output files, and can process the data + metadata, with the perspective of integration into the target ontology.
Now I am trying to integrate this into a Nomad parser plugin. And I’m stuck at the first step, which is to get any kind of parser running. I have tried to make sense of the documentation on how to write a parser, but unfortunately to no avail so far.
Not even with any of my own code, the suggested instructions alone already failed. (I have installed Nomad into a local pyenv.):
- I executed the cruft template.
- Installation of the plugin package via
pip install -e .
like described here. The directory/path/to/plugin/.pyenv/lib/python3.10/site-packages/nomad_mweparser-0.1.0.dist-info
exists. - (I have not modified the contents of the plugin, i. e. per
MyParserEntryPoint()
, themainfile
regex should match files called'.*\.myparser'
) - Create an empty file called
test.myparser
- Run
nomad parse test.myparser --show-archive
Always the same result:
$ nomad parse /path/to/plugin/test.myparser
Traceback (most recent call last):
File "/path/to/plugin/.pyenv/bin/nomad", line 8, in <module>
sys.exit(run_cli())
File "/path/to/plugin/.pyenv/lib/python3.10/site-packages/nomad/cli/cli.py", line 71, in run_cli
return cli(obj=POPO()) # pylint: disable=E1120,E1123
File "/path/to/plugin/.pyenv/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/path/to/plugin/.pyenv/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/path/to/plugin/.pyenv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/path/to/plugin/.pyenv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/path/to/plugin/.pyenv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/path/to/plugin/.pyenv/lib/python3.10/site-packages/nomad/cli/parse.py", line 51, in _parse
entry_archives = parse(mainfile, **kwargs)
File "/path/to/plugin/.pyenv/lib/python3.10/site-packages/nomad/client/processing.py", line 56, in parse
assert parser is not None, 'there is no parser matching %s' % mainfile
AssertionError: there is no parser matching test.myparser
No variation of prefixing with PYTHONPATH=.
and moving through the directory structure of the parser plugin did change this.
I do not see any indication that local Nomad CLI recognizes Python modules that are installed in the same pyenv.
This is currently blocking me from establishing a development feedback cycle for the parser code. This blocks me from working on the actual scientific part.
How can I add a local parser into the plugin subsystem of Nomad CLI?