You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The visualization capabilities are a strong benefit for using serpentTools and should not be negatively impacted by this feature
Is your feature request related to a problem? Please describe.
matplotlib is a wonderful package. It is not always needed at the same level numpy is for this package. At the least, importing matplotlib can cause an unnecessary slow down if all I want to do is read in data, using serpentTools more like a library than a visualization tool.
Describe the solution you'd like
I see two solutions that can be incorporated separately.
Delay the importing of matplotlib.pyplot until the moment a plot routine is called. Most of the plotting routines have logic like
defplot(ax=None):
ifaxisNone:
ax=pyplot.gca()
where from matplotlib import pyplot or from matplotlib.pyplot import gca is included at the top of the file. We can delay this import by using some wrappers, like
This allows people to install serpentTools just as a parser / library without the plotting support. If this capability is needed, one can install with `pip install serpentTools[plotting].
Describe alternatives you've considered
Hard to avoid this as a user / installer.
Additional context
I am conflicted with action 2. First, in my opinion, the plotting capabilities are a valuable asset of serpentTools. I am not proposing to drop or heavily alter these capabilities. Instead, I am proposing to keep the dependencies to a strict minimum, and matplotlib is not required to parse the files and obtain the data.
On the other hand, if people see our posters or examples at a conference or in a paper, install the package (without matplotlib as a dependency nor previously installed), and try to plot, they will be greeted with an error. That probably won't sit well. We can include a nice try/except statement in the guarded plot routines indicating that installing matplotlib or serpentTools[plotting] is required, but I'm not sure how well that may get received.
The text was updated successfully, but these errors were encountered:
The visualization capabilities are a strong benefit for using serpentTools and should not be negatively impacted by this feature
Is your feature request related to a problem? Please describe.
matplotlib is a wonderful package. It is not always needed at the same level numpy is for this package. At the least, importing matplotlib can cause an unnecessary slow down if all I want to do is read in data, using serpentTools more like a library than a visualization tool.
Consider
pandas
, another wonderful package that has wonderful and broad plotting capabilities. And yet, matplotlib is not a requirement pandas:Describe the solution you'd like
I see two solutions that can be incorporated separately.
matplotlib.pyplot
until the moment a plot routine is called. Most of the plotting routines have logic likewhere
from matplotlib import pyplot
orfrom matplotlib.pyplot import gca
is included at the top of the file. We can delay this import by using some wrappers, likethen later
Similar interfaces can be done for figures and subplots.
matplotlib
is an extra dependency, something likeThis allows people to install serpentTools just as a parser / library without the plotting support. If this capability is needed, one can install with `pip install serpentTools[plotting].
Describe alternatives you've considered
Hard to avoid this as a user / installer.
Additional context
I am conflicted with action 2. First, in my opinion, the plotting capabilities are a valuable asset of serpentTools. I am not proposing to drop or heavily alter these capabilities. Instead, I am proposing to keep the dependencies to a strict minimum, and
matplotlib
is not required to parse the files and obtain the data.On the other hand, if people see our posters or examples at a conference or in a paper, install the package (without matplotlib as a dependency nor previously installed), and try to plot, they will be greeted with an error. That probably won't sit well. We can include a nice try/except statement in the guarded plot routines indicating that installing matplotlib or
serpentTools[plotting]
is required, but I'm not sure how well that may get received.The text was updated successfully, but these errors were encountered: