Skip to content
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

Unable to Load ndx-ophys-devices Namespace to build ndx-microscopy Extension #23

Open
alessandratrapani opened this issue Dec 3, 2024 · 3 comments
Assignees

Comments

@alessandratrapani
Copy link
Collaborator

alessandratrapani commented Dec 3, 2024

I am trying to build the ndx-microscopy extension, which requires the namespace of another extension, ndx-ophys-devices. However, I encounter an error indicating that the ndx-ophys-devices namespace cannot be loaded.

Error Details

When running the tests, the following error occurs:

src/pynwb/tests/test_constructors.py:None (src/pynwb/tests/test_constructors.py)
..\..\..\..\..\anaconda3\envs\ndx-microscopy-env\Lib\site-packages\hdmf\spec\namespace.py:452: in __load_namespace
    inc_ns = self.get_namespace(s['namespace'])
..\..\..\..\..\anaconda3\envs\ndx-microscopy-env\Lib\site-packages\hdmf\utils.py:668: in func_call
    return func(args[0], **pargs)
..\..\..\..\..\anaconda3\envs\ndx-microscopy-env\Lib\site-packages\hdmf\spec\namespace.py:303: in get_namespace
    raise KeyError("'%s' not a namespace" % name)
E   KeyError: "'ndx-ophys-devices' not a namespace"

Code

schema:
- namespace: core
- namespace: ndx-ophys-devices
- source: ndx-microscopy.extensions.yaml
version: 0.1.0

from ndx_ophys_devices import ExcitationSource, Indicator, OpticalFilter, Photodetector

@rly could you help identify why the ndx-ophys-devices namespace is not being recognized?
After merging this PR I would like to work on the integration with NWBEP003

@alessandratrapani alessandratrapani self-assigned this Dec 3, 2024
@rly
Copy link
Contributor

rly commented Dec 10, 2024

ndx-ophys-devices does not seem to be available on PyPI. Either it needs to be a Python module that is a dependency of this package (and mentioned in pyproject.toml or setup.py and therefore installed by pip when ndx-microscopy is installed, or the ndx-ophys-devices spec files need to be included in this package and the classes instantiated in __init__.py.

If I clone ndx-ophys-devices and install it locally, then running pytest gives me:

ERROR src/pynwb/tests/test_constructors.py - ValueError: No specification for 'ExcitationLightPath' in namespace 'ndx-microscopy'
ERROR src/pynwb/tests/test_roundtrip.py - ValueError: No specification for 'ExcitationLightPath' in namespace 'ndx-microscopy'

so it seems like the namespace is recognized then.

@alessandratrapani
Copy link
Collaborator Author

alessandratrapani commented Dec 16, 2024

Ah sorry I forgot to specify that this error occurred running the code in the add_ophys_device branch, not the main branch

@rly
Copy link
Contributor

rly commented Dec 16, 2024

No problem. I guessed that. I see now that you added the GitHub link to ndx-ophys-devices into requirements-min.txt, but it actually needs to be in pyproject.toml or setup.py to be used. requirements-min.txt is only used in a particular GitHub actions workflow that checks whether the tests pass when installing the minimum versions of the packages that you specify in pyproject.toml or setup.py. Both lists need to be manually updated. Sorry that's confusing! I'll try to improve the documentation.

Separately you may want to use the latest ndx template for this extension which has a few improvements like having a project.toml which is more standard now. I'm happy to help you migrate this extension over to using that (I do it manually but I've done it enough times for other extensions that it's pretty quick). Let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants