-
Notifications
You must be signed in to change notification settings - Fork 32
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
matnwb package #262
Comments
No but your timing is pristine as I can say that the alternative You are correct that this will be quite a bit of effort as not only does the code regularly reference other functions within itself, the generated class locations will all need to be changed, and there will definitely be breakage in the utility scripts and other third-party applications that utilize the generated classes and custom types. |
I like namespaces as much as the next Python programmer, but this seems like a lot. |
@ln-vidrio It is possible depending on the timescale of implementation, users could be notified of the change (as MathWorks currently does) and that new functions would be put under the For existing users, if a Else can just rely on adding/removing matnwb from path as needed to avoid these issues. |
I support this! FYI: Matlab provides an option to define an alias file, which supports backwards compatibility of names. The matlab.alias.AliasFileManager class provides an API for creating and maintaining alias definitions. Aliases are not part of class definitions. Instead, alias definition files are stored in resources folders that are located in the same folder as the latest class file. This would ensure that utility functions and third party applications would continue to work as is (for a transition period, lets say). |
I gave this an attempt here: https://github.com/ehennestad/matnwb All the packages are moved into a main I ran the generateCore again, and it generates types with correct new names. A few known issues that need further testing/investigating:
Note: I also found a few references to classes that appears to have moved from Final note: |
You would need to add another
This is only really done in file generation so if that is successful it might be fine though that will require running tests. Looks awesome! |
Thanks! I think I got everything sorted out for running the tests. Very many of the tests fail with this error: Another issue I have is that the python tests don't succeed I assume because I don't have pynwb installed. |
I tracked down the date issue to this function This code snippet illustrates the behavior:
Turns out setting the month before the day can flip the month value one step ahead. The default value for Setting the day before the month solves it |
Oh wow, I would not have expected that. Excellent job. |
Yeh, thats one of the weirdest bugs ive encountered. Could you give me a brief explanation what is needed to run python tests? Or point me to documentation if that exists? |
If your python env is on your path, I think the tests should automatically use it. If not, you can save an For more information you can take a look at |
Thanks for elucidating. I'm open to submitting this internally, but I think folks would stumble on why it's mixing & matching At a glance, I think the desired correct behavior might be achieved compactly in this way:
|
Hi Vijay, |
@rly @bendichter Following up from the NWB Workshop about converting matnwb so all functions are inside a package (similar to what @ehennestad has done at https://github.com/ehennestad/matnwb). Happy to help test. |
+1 on this point/issue. One recent/emergent advantage of root namespaces: they enable a toolbox's live script example(s) to be run straight from an Open in MATLAB Online link, as alluded at the end of this blog post. You can this workflow in action at the Brain Observatory Toolbox repository. Additionally, it makes sense to me for NWB to lead way wrt use of root namespaces (such as (*) Personally I'm open to the possibility that three-letter acronym (TLA) namespaces can work in a future where compute environments are often configured to their specific domains (with containers or otherwise) |
I think what I have done so far was complete at the time of my latest commit, but I did not have the time to get into thorough testing on real-world nwb files. I am also open to considering another namespace like |
Suggestion to also reorganise the folder structure of the root directory along the following lines:
Main goals:
|
Is there any plan to move the current
matnwb
packages into sub-packages of amatnwb
package for a cleaner namespace?For example, instead of calling
types.core.OpticalChannel
users could callmatnwb.types.core.OpticalChannel
and this would be true for all functions in the current top-level packages.This would also reduce potential conflicts given the names of the current top-level packages—whereas currently,
matnwb
may have to be added or remove from the path each time a NWB read/write operation is performed to avoid this (e.g. if a parent function hastypes= '';
or similar command, issues could arise).This would not be a minor change (since other packages and code depend on the current setup), but may be worth considering.
The text was updated successfully, but these errors were encountered: