nwb-extensions / ndx-template

A template for creating Neurodata Extensions for the NWB neurophysiology data standard
https://nwb.org/
Other
5 stars 8 forks source link

Add load_namespace to default __init__ #28

Closed oruebel closed 4 years ago

oruebel commented 4 years ago

As far as I can tell the default setup.py here https://github.com/nwb-extensions/ndx-template/blob/ec1364cd9a35d812f821ac8f52c4b6ae587f9ba2/%7B%7B%20cookiecutter.namespace%20%7D%7D/setup.py#L37 seems to copy the YAML spec to a spec/ subfolder in the python package upon install. If this is the case, should we add in the default init.py file for PyNWB https://github.com/nwb-extensions/ndx-template/blob/master/%7B%7B%20cookiecutter.namespace%20%7D%7D/src/pynwb/%7B%7B%20cookiecutter.py_pkg_name%20%7D%7D/__init__.py also a command for loading the namespace, since all packages would have to do this? I guess this would look something like:

import os
from pynwb import load_namespaces
'{{ cookiecutter.namespace }}_specpath = os.path.join(os.path.dirname(__file__), 'spec', '{{ cookiecutter.namespace }}.namespace.yaml')
load_namespaces('{{ cookiecutter.namespace }}_specpath)