-
Notifications
You must be signed in to change notification settings - Fork 10
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
docs: Add docs for plugin create #795
base: develop
Are you sure you want to change the base?
Conversation
Sourcery Code Quality ReportMerging this PR leaves code quality unchanged.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
Preview page for your plugin is ready here: |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #795 +/- ##
========================================
Coverage 92.95% 92.95%
========================================
Files 205 205
Lines 32480 32484 +4
========================================
+ Hits 30191 30195 +4
Misses 2289 2289 ☔ View full report in Codecov by Sentry. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
WalkthroughThe recent updates encompass a range of enhancements including the addition of a pre-initialization task, expansions in documentation covering plugin creation, and refinements in the codebase such as method additions and variable renamings. These changes indicate a strategic focus on extending functionality, improving user guidance, and enhancing the overall code structure for clarity and future maintenance. Changes
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (2)
Files skipped from review due to trivial changes (1)
Additional comments not posted (4)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 5
Configuration used: CodeRabbit UI
Files selected for processing (6)
- .gitpod.yml (1 hunks)
- docs/conf.py (1 hunks)
- docs/index.rst (1 hunks)
- docs/plugins_creation.rst (1 hunks)
- package/PartSegCore/algorithm_describe_base.py (3 hunks)
- package/PartSegCore/register.py (2 hunks)
Additional comments: 7
.gitpod.yml (1)
- 1-4: The changes to the
.gitpod.yml
file align with the PR objectives of updating configuration files to enhance the documentation and setup for plugin creation. The addition of thebefore
task for system dependencies and theinit
task for project setup are appropriate and there are no apparent issues with these changes.docs/index.rst (1)
- 19-22: The addition of
plugins_creation
to the documentation index aligns with the PR objectives to introduce documentation for plugin creation. This change is correctly implemented and follows the Sphinx documentation structure.docs/plugins_creation.rst (1)
- 1-116: The documentation is clear and seems to align with the PR objectives of enhancing the documentation for plugin creation in the PartSeg application. It covers the areas where plugins can contribute, the plugin detection process, and the "develop" mode for reloading plugins. It also lists existing plugins, which can serve as examples for new plugin creators.
package/PartSegCore/algorithm_describe_base.py (4)
113-127: The addition of the
get_fields
method and the renaming of the function parameter fromfuncobj
tofunc_obj
in the_partial_abstractmethod
decorator function align with the PR objectives and the summary provided. This change enhances the codebase in line with the goal of improving plugin creation support.129-138: The renaming of
cls2
tocls
in the__new__
method ofAlgorithmDescribeBaseMeta
is consistent with the summary and does not appear to introduce any issues. This change improves the readability of the code.239-245: The modification of the docstring in the
Register
class constructor from "may be initial elements" to "maybe initial elements" is a grammatical correction that improves the clarity of the documentation. This change is consistent with the PR objectives of enhancing documentation.441-453: The renaming of
kwargs
tokwargs_
in theallow_positional_args
decorator function is consistent with the summary and does not introduce any issues. This change avoids potential conflicts with keyword arguments.
"sphinx_autodoc_typehints", | ||
"PartSegCore.sphinx.auto_parameters", | ||
"sphinxcontrib.autodoc_pydantic", | ||
"sphinx.ext.autosectionlabel", | ||
] |
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.
The addition of "sphinx.ext.autosectionlabel" to the extensions list is correct and aligns with the PR objective of enhancing documentation. Ensure that if there are any documents with duplicate section names, the configuration option "autosectionlabel_prefix_document" is set to True to avoid conflicts.
flow = 0 #: algorithm for calculation flow from core object to borders. For spiting touching objects, deprecated | ||
threshold = 1 #: threshold algorithms. From greyscale array to binary array | ||
noise_filtering = 2 #: filter noise from image | ||
analysis_algorithm = 3 #: algorithm for creating segmentation in analysis PartSeg part | ||
mask_algorithm = 4 #: algorithm for creating segmentation in mask PartSeg part | ||
analysis_algorithm = 3 | ||
""" | ||
algorithm for creating segmentation in analysis PartSeg part | ||
(deprecated in favour of roi_analysis_segmentation_algorithm) | ||
""" | ||
mask_algorithm = 4 | ||
""" | ||
algorithm for creating segmentation in mask PartSeg part | ||
(deprecated in favour of roi_mask_segmentation_algorithm) | ||
""" | ||
analysis_save = 5 #: save functions for analysis part | ||
analysis_load = 6 #: load functions for analysis part | ||
mask_load = 7 #: load functions for mask part | ||
mask_load = 7 #: load functions for mask part) | ||
image_transform = 8 #: transform image, like interpolation | ||
mask_save_parameters = 9 #: save metadata for mask part (currently creating json file) | ||
mask_save_components = 10 #: save each segmentation component in separate file. Save location is directory |
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.
💡 NOTE
Codebase verification is a beta feature.
The deprecation of analysis_algorithm
and mask_algorithm
is noted, but references to these deprecated enums are still present in the code. The following locations should be reviewed and updated to use the new roi_analysis_segmentation_algorithm
and roi_mask_segmentation_algorithm
:
./package/PartSegCore/register.py
: lines 77, 97 (foranalysis_algorithm
)./package/PartSegCore/register.py
: lines 78, 98 (formask_algorithm
)
PartSeg has a plugin system, but because of a lack of documentation, it is not very popular. | ||
This document is an attempt to explain how to create plugins for PartSeg. The list of good plugins that could be inspirration | ||
is available at the :ref:`end of this document<Already existing plugins>`. |
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.
Minor grammatical error.
- This document is an attempt to explain how to create plugins for PartSeg. The list of good plugins that could be inspirration
+ This document is an attempt to explain how to create plugins for PartSeg. The list of good plugins that could be inspiration
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
PartSeg has a plugin system, but because of a lack of documentation, it is not very popular. | |
This document is an attempt to explain how to create plugins for PartSeg. The list of good plugins that could be inspirration | |
is available at the :ref:`end of this document<Already existing plugins>`. | |
PartSeg has a plugin system, but because of a lack of documentation, it is not very popular. | |
This document is an attempt to explain how to create plugins for PartSeg. The list of good plugins that could be inspiration | |
is available at the :ref:`end of this document<Already existing plugins>`. |
* **ROI Mask save method** - method to save data in *ROI Mask* GUI. | ||
|
||
|
||
A person interested in developing a plugin could wound the whole list in :py:mod:`PartSegCore.register` module. |
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.
Possible typo or incorrect word usage.
- A person interested in developing a plugin could wound the whole list in :py:mod:`PartSegCore.register` module.
+ A person interested in developing a plugin could find the whole list in :py:mod:`PartSegCore.register` module.
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
A person interested in developing a plugin could wound the whole list in :py:mod:`PartSegCore.register` module. | |
A person interested in developing a plugin could find the whole list in :py:mod:`PartSegCore.register` module. |
|
||
PartSeg-bioimageio | ||
~~~~~~~~~~~~~~~~~~ | ||
PartSeg plugin to run bioimage.io deep learning models. It could be found under https:/github.com/czaki/PartSeg-bioimageio/ page |
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.
The URL provided seems to be missing a colon, which could lead to a broken link.
- PartSeg plugin to run bioimage.io deep learning models. It could be found under https:/github.com/czaki/PartSeg-bioimageio/ page
+ PartSeg plugin to run bioimage.io deep learning models. It could be found under https://github.com/czaki/PartSeg-bioimageio/ page
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
PartSeg plugin to run bioimage.io deep learning models. It could be found under https:/github.com/czaki/PartSeg-bioimageio/ page | |
PartSeg plugin to run bioimage.io deep learning models. It could be found under https://github.com/czaki/PartSeg-bioimageio/ page |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Quality Gate passedIssues Measures |
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.
Actionable comments posted: 1
def __new__(mcs, name, bases, attrs, **kwargs): | ||
cls = super().__new__(mcs, name, bases, attrs, **kwargs) | ||
if ( | ||
not inspect.isabstract(cls2) | ||
and hasattr(cls2.get_fields, "__is_partial_abstractmethod__") | ||
and cls2.__argument_class__ is None | ||
not inspect.isabstract(cls) | ||
and hasattr(cls.get_fields, "__is_partial_abstractmethod__") | ||
and cls.__argument_class__ is None | ||
): | ||
raise RuntimeError("class need to have __argument_class__ set or get_fields functions defined") | ||
cls2.__new_style__ = getattr(cls2.get_fields, "__is_partial_abstractmethod__", False) | ||
return cls2 | ||
cls.__new_style__ = getattr(cls.get_fields, "__is_partial_abstractmethod__", False) | ||
return cls |
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.
Ensure correct attribute access in the __new__
method of AlgorithmDescribeBaseMeta
. Use hasattr(cls, 'get_fields') and hasattr(cls.get_fields, '__is_partial_abstractmethod__')
to check the attribute on the method.
- and hasattr(cls.get_fields, "__is_partial_abstractmethod__")
+ and hasattr(cls, 'get_fields') and hasattr(cls.get_fields, '__is_partial_abstractmethod__')
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
def __new__(mcs, name, bases, attrs, **kwargs): | |
cls = super().__new__(mcs, name, bases, attrs, **kwargs) | |
if ( | |
not inspect.isabstract(cls2) | |
and hasattr(cls2.get_fields, "__is_partial_abstractmethod__") | |
and cls2.__argument_class__ is None | |
not inspect.isabstract(cls) | |
and hasattr(cls.get_fields, "__is_partial_abstractmethod__") | |
and cls.__argument_class__ is None | |
): | |
raise RuntimeError("class need to have __argument_class__ set or get_fields functions defined") | |
cls2.__new_style__ = getattr(cls2.get_fields, "__is_partial_abstractmethod__", False) | |
return cls2 | |
cls.__new_style__ = getattr(cls.get_fields, "__is_partial_abstractmethod__", False) | |
return cls | |
def __new__(mcs, name, bases, attrs, **kwargs): | |
cls = super().__new__(mcs, name, bases, attrs, **kwargs) | |
if ( | |
not inspect.isabstract(cls) | |
and hasattr(cls, 'get_fields') and hasattr(cls.get_fields, '__is_partial_abstractmethod__') | |
and cls.__argument_class__ is None | |
): | |
raise RuntimeError("class need to have __argument_class__ set or get_fields functions defined") | |
cls.__new_style__ = getattr(cls.get_fields, "__is_partial_abstractmethod__", False) | |
return cls |
Summary by CodeRabbit
Documentation
Refactor
Chores