-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Improvement] Dependencies rationalization #58
Conversation
…ype hints should be good for the API objects.
# Conflicts: # pyannote/core/annotation.py # pyannote/core/segment.py # pyannote/core/timeline.py
# Conflicts: # pyannote/core/feature.py
…nts on the WIP Pull request.
…ailing in timeline.py. Added a type for LabelGenerator modes.
# Conflicts: # pyannote/core/segment.py
# Conflicts: # pyannote/core/segment.py
# Conflicts: # pyannote/core/segment.py
… couple of issues with the docstrings. Made use of "subset" for the Annotation's overlaps.
Made the installation of matplotlib optional via the [notebook] extra require. Removed pandas dependency (as it is only used for input data, we can assume it has already been installed by the user code).
For notebook, testing and documentation, all dependencies can be installed via extra_requires in setup.py. Updated the github configs accordingly. Added page for objects vizualization.
Thanks for this PR -- this really makes things cleaner. |
I added some warnings, tell me if this fits the bill |
Thanks. Sorry for nitpicking here but how can we be sure the Could we do something slightly smarter and try to import |
This is a reasonable nitpick :) However, my rationale was that, in this try/except statement, the only code that is imported (as part of the png rendering) is precisely This would however be a good solution if you're planning on adding other visualization backends in the future. |
That would have been my reply before you edited your answer :) |
I made the warnings flag-enabled, is this how you expected them to be? |
pyannote/core/feature.py
Outdated
from .notebook import repr_feature | ||
from .notebook import MATPLOTLIB_IS_AVAILABLE, MATPLOTLIB_WARNING | ||
if not MATPLOTLIB_IS_AVAILABLE: | ||
warnings.warn(MATPLOTLIB_WARNING.format(obj=self)) |
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.
Shouldn't obj
be the class name rather than the instance?
>>> MATPLOTLIB_WARNING.format(obj=Annotation())
Couldn't import matplotlib to render the vizualization for object . To enable, install the required dependencies with 'pip install pyannore.core[notebook]'
>>> MATPLOTLIB_WARNING.format(obj=Annotation().__class__.__name__)
Couldn't import matplotlib to render the vizualization for object Annotation. To enable, install the required dependencies with 'pip install pyannore.core[notebook]'
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.
Good point, sorry for that.
Will make a proper release when PR for #57 is also merged. |
A couple of updates:
Made the matplotlib dependency optional
Made pandas only required for testing/documentation (as it's only imported for typing purposes in the lib)
Made all additional and unnecessary dependencies installable via
extra_requires
, e.g.:reflected these updates in the github actions configs.
added some documentation in the "Visualization" section
I'm sorry for the gory PR commit history... i don't know what i did wrong to have all these old commit listed in the PR.