-
Notifications
You must be signed in to change notification settings - Fork 37
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 import statements #70
Conversation
@CPBridge please note that I had to move two classes from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally in favour of this but I think there a few important things to think through:
- Structure I notice you have chosen to import everything from files in the root of the repo (
io
,spatial
,content
) such that it appears at the top level ofhighdicom
. This seems a little odd to me, since it ends up with what I consider to be more peripheral classes such asImageToReferenceTransformer
at the root of the module but more central classes such asSegmentation
within a submodule. I propose keeping everything inspatial
,io
,uid
,content
within those modules so that every class exists one level below the main package (e.g.hd.spatial.ImageToReferenceTransformer
andhd.seg.Segmentation
) and it's essentially an implementation detail whether these submodules are implemented in a single file or spread across multiple files in a directory. - Documentation If we want this new scheme to be the "standard" way of using highdicom, I think we should make sure that the documentation is consistent with this in this PR. An easy fix is to the examples in the usage file. However other things becomes much more complex. Every time a class in mentioned in a docstring, e.g. as the type of a parameter, should we change this to the "new" canonical path? This might be quite tedious. Furthermore, it appears that currently your change has created errors in the documentation building process due to ambiguous cross-references.
Sorry, I forgot to address those comments. I generally agree with your structure proposal. However, there are few edge cases and additional considerations that I'd like to discuss. First, I would suggest exposing Regarding documentation, I agree that it would be nice to use |
I think I agree about Regarding docs, sure If you prefer to do it later we'll do that. I was just thinking lower chance of forgetting if we do it now! Definitely think factoring out the examples to allow them to be tested is a good idea - nothing's worse than having the examples throw errors. The disadvantage is that there can be no more |
Also please remember to address the warnings in the documentation build process |
@CPBridge take a look at 3e1c246. I introduced a namespace for import highdicom as hd
transformer = hd.spatial.ImageToReferenceTransformer(...)
with hd.io.ImageFileReader(...) as reader:
... For consistency, I also kept the import highdicom as hd
matched_items = hd.sr.utils.find_content_items(...) Is that what you had in mind? |
@CPBridge I also updated the usage section of the documentation accordingly. I don't make use of the Sphinx source code run feature. This will require a little bit more thought and effort. For example, we will need to select appropriate test data. I would like to address that with #69, which will require writing additional docs anyways. I looked into the warning messages
I am not sure this is a problem. There are now two targets available and both of them are valid in my opinion. What do you suggest? Should we update the docstrings to reflect the namespace of the public API (i.e., use |
I think that's a bit nicer. How do you feel about it?
I don't personally think the inconsistency of having
I agree that the cause of the warning/error is not particularly important, but I still think we should aim to have the docs build with 0 warnings. That way it becomes much easier to check the build process and catch warnings that are actually important. I have fixed this issue in #72
I spent a while playing around with this and I think we don't actually have a choice here. We have to use Also, why is the test on this branch failing due to some missing file? |
Fixed with c7fd54b |
I don't have a strong opinion here. From a usage perspective, I like giving each modality a dedicated namespace and keeping everything else under the root namespace. However, having separate namespaces for groups of related symbols may be relevant from a documentation perspective, since it would allow for a more intuitive structure and inclusion of additional descriptions (module docstrings) into the API doc. |
I see advantages of keeping |
* Fix all sphinx warnings * Removed all unnecessary modules from doc content tree, fixed all docstrings to match * Fix unused import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I think we're good to go. Regarding spatial
, io
etc I leave it as an executive decision to you, while leaning towards the way things are currently.
This will facilitate importing and using the package: