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

Add functions for inferring directory of generated types #681

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ehennestad
Copy link
Collaborator

@ehennestad ehennestad commented Mar 7, 2025

Motivation

Generated neurodata type classes and format specifications (namespace) caches are saved in the root MatNWB directory by default.

However, it is possible to generate types and caches in other locations by specifying a savedir argument when running generateCore/generateExtension (for example temporary locations which can be useful during testing).

For the function schemes.loadNamespace, the default behavior was to look for the format specifications (namespace) caches in the root MatNWB directory. This PR changes this default behavior to instead find the directory where the types.core.NWBFile is located by looking at MATLAB's search path.

This makes the schemes.loadNamespace function more robust when used during testing where the namespace caches might be present in a different location than the root MatNWB directory.

Checklist

  • Have you ensured the PR description clearly describes the problem and solutions?
  • Have you checked to ensure that there aren't other open or previously closed Pull Requests for the same change?
  • If this PR fixes an issue, is the first line of the PR description fix #XX where XX is the issue number?

Make generatedTypesDirectory optional. If not provided, it will be inferred from MATLAB's search path
Improve docstring, variablenames and error message
Throw error from caller instead
Add property type constraints because name (and version?) are expected to be character types
Copy link

codecov bot commented Mar 7, 2025

Codecov Report

Attention: Patch coverage is 97.29730% with 1 line in your changes missing coverage. Please review.

Project coverage is 95.29%. Comparing base (3d252da) to head (3addda1).

Files with missing lines Patch % Lines
+schemes/loadNamespace.m 94.11% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #681   +/-   ##
=======================================
  Coverage   95.29%   95.29%           
=======================================
  Files         139      141    +2     
  Lines        5332     5360   +28     
=======================================
+ Hits         5081     5108   +27     
- Misses        251      252    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ehennestad ehennestad requested a review from bendichter March 7, 2025 13:13
Copy link
Collaborator Author

@ehennestad ehennestad Mar 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to loadNamespace function

  • Make generatedTypesDirectory optional. If not provided, it will be inferred from MATLAB's search path
  • Improve docstring, variablenames and error message


if numel(generatedTypeLocation) > 1
warning('NWB:Types:MultipleGeneratedTypesFound', ...
['Multiple generated types was found for %s.\n', ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
['Multiple generated types was found for %s.\n', ...
['Multiple generated types were found for %s.\n', ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you indicate the paths for each?

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

Successfully merging this pull request may close these issues.

2 participants