-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
&fkiraly [DOC] Add guide for module-level soft dependency imports (#7690) #8386
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
&fkiraly [DOC] Add guide for module-level soft dependency imports (#7690) #8386
Conversation
This PR adds documentation for how to handle module-level soft dependency imports.
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.
Hi @aarsh1a thanks for your contribution.
It is recommended to rely on the python dependencies tag as much as possible, and avoid module level imports even after checks. This is to avoid possible side effects that imports may cause. In some cases we do deviate from this, mostly in our deep learning estimators, but those are specific cases and if I am not wrong we are trying to reduce those as well. Can you please update accordingly?
sure! i'll make the changes and update the file. |
Made specific changes that were asked for and updated the file.
hi @yarnabrina I made some changes to the file please take a look. |
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.
Nice! Thanks!
Some requests to make it clearer:
- can you turn the content into a subsection of the previous section "handling soft dependencies", and turn part of the previous section into another subsection?
- at the start, it should be explained that (a) soft dependencies should be restricted to estimators if possible, and (b) if not possible, then the instructions in the other section should be followed
- the distribute the examples in the appropriate section
_safe_import
should also be mentioned
Addressed the changes requested.
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.
Great! left some improvement requests
This is abandoned, I wrapped it up now. |
…time#7690) (sktime#8386) This PR adds documentation for handling module-level soft dependency imports in sktime. The existing developer guide explains how to manage soft dependencies within estimators, but does not cover scenarios where optional dependencies need to be imported at the module level. To address this, I have added a new section titled "Module-level soft dependency imports" under dependencies.rst. It provides clear usage patterns for using _check_soft_dependencies before importing optional modules directly. Example code snippets are included to demonstrate both severity-based checks and conditional imports.
This PR adds documentation for handling module-level soft dependency imports in sktime. The existing developer guide explains how to manage soft dependencies within estimators, but does not cover scenarios where optional dependencies need to be imported at the module level.
To address this, I have added a new section titled "Module-level soft dependency imports" under dependencies.rst. It provides clear usage patterns for using _check_soft_dependencies before importing optional modules directly. Example code snippets are included to demonstrate both severity-based checks and conditional imports.