Skip to content

Commit cf7b142

Browse files
committed
Don't depend on ipython
1 parent c383dbb commit cf7b142

File tree

9 files changed

+17
-19
lines changed

9 files changed

+17
-19
lines changed

lovely_numpy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.2.15"
1+
__version__ = "0.2.16"
22

33
from .repr_str import *
44
from .repr_rgb import *

lovely_numpy/repr_chans.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import numpy as np
1010
from matplotlib import axes, figure, pyplot as plt
11-
from IPython.core.pylabtools import print_figure
1211

1312
from .repr_rgb import fig_rgb, rgb
1413
from .utils.colormap import InfCmap, get_cmap
@@ -92,6 +91,7 @@ def fig(self) -> figure.Figure:
9291
return fig_chans(self.x, **self.params)
9392

9493
def _repr_png_(self):
94+
from IPython.core.pylabtools import print_figure
9595
return print_figure(self.fig, fmt="png", pad_inches=0,
9696
metadata={"Software": "Matplotlib, https://matplotlib.org/"})
9797

lovely_numpy/repr_plt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import numpy as np
1111
from matplotlib import pyplot as plt, axes, figure, rc_context
12-
from IPython.core.pylabtools import print_figure
1312

1413
from .repr_str import lovely, pretty_str
1514
from .utils import get_config, config
@@ -282,6 +281,7 @@ def fig(self) -> figure.Figure:
282281
return fig_plot( self.x, **self.params)
283282

284283
def _repr_png_(self):
284+
from IPython.core.pylabtools import print_figure
285285
return print_figure(self.fig, fmt="png",
286286
metadata={"Software": "Matplotlib, https://matplotlib.org/"})
287287

@@ -291,6 +291,7 @@ def _repr_svg_(self):
291291
"Date": None,
292292
"Creator": "Matplotlib, https://matplotlib.org/",
293293
}
294+
from IPython.core.pylabtools import print_figure
294295
with rc_context({"svg.hashsalt": "1"}):
295296
svg_repr = print_figure(self.fig, fmt="svg", metadata=metadata)
296297
return svg_repr

lovely_numpy/repr_rgb.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44
__all__ = ['rgb']
55

66
# %% ../nbs/01_repr_rgb.ipynb
7-
from typing import Union, Any, Optional as O
7+
from typing import Any, Optional as O
88

99
import numpy as np
10-
from matplotlib import pyplot as plt, axes, figure, rcParams
11-
from IPython.core.pylabtools import print_figure
12-
13-
10+
from matplotlib import pyplot as plt, axes, figure
1411
from .utils.tile2d import hypertile
1512
from .utils.utils import cached_property
1613
from .utils import get_config
@@ -110,6 +107,7 @@ def fig(self) -> figure.Figure:
110107
return fig_rgb(self.x, **self.params)
111108

112109
def _repr_png_(self):
110+
from IPython.core.pylabtools import print_figure
113111
return print_figure(self.fig, fmt="png", pad_inches=0,
114112
metadata={"Software": "Matplotlib, https://matplotlib.org/"})
115113

nbs/01_repr_rgb.ipynb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,10 @@
3636
"source": [
3737
"# |export\n",
3838
"# |hide\n",
39-
"from typing import Union, Any, Optional as O\n",
39+
"from typing import Any, Optional as O\n",
4040
"\n",
4141
"import numpy as np\n",
42-
"from matplotlib import pyplot as plt, axes, figure, rcParams\n",
43-
"from IPython.core.pylabtools import print_figure\n",
44-
"\n",
45-
"\n",
42+
"from matplotlib import pyplot as plt, axes, figure\n",
4643
"from lovely_numpy.utils.tile2d import hypertile\n",
4744
"from lovely_numpy.utils.utils import cached_property\n",
4845
"from lovely_numpy.utils import get_config"
@@ -192,6 +189,7 @@
192189
" return fig_rgb(self.x, **self.params)\n",
193190
"\n",
194191
" def _repr_png_(self):\n",
192+
" from IPython.core.pylabtools import print_figure\n",
195193
" return print_figure(self.fig, fmt=\"png\", pad_inches=0,\n",
196194
" metadata={\"Software\": \"Matplotlib, https://matplotlib.org/\"})"
197195
]

nbs/02_repr_plt.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"\n",
4141
"import numpy as np\n",
4242
"from matplotlib import pyplot as plt, axes, figure, rc_context\n",
43-
"from IPython.core.pylabtools import print_figure\n",
4443
"\n",
4544
"from lovely_numpy.repr_str import lovely, pretty_str\n",
4645
"from lovely_numpy.utils import get_config, config\n",
@@ -401,6 +400,7 @@
401400
" return fig_plot( self.x, **self.params)\n",
402401
"\n",
403402
" def _repr_png_(self):\n",
403+
" from IPython.core.pylabtools import print_figure\n",
404404
" return print_figure(self.fig, fmt=\"png\",\n",
405405
" metadata={\"Software\": \"Matplotlib, https://matplotlib.org/\"})\n",
406406
"\n",
@@ -410,6 +410,7 @@
410410
" \"Date\": None,\n",
411411
" \"Creator\": \"Matplotlib, https://matplotlib.org/\",\n",
412412
" }\n",
413+
" from IPython.core.pylabtools import print_figure\n",
413414
" with rc_context({\"svg.hashsalt\": \"1\"}):\n",
414415
" svg_repr = print_figure(self.fig, fmt=\"svg\", metadata=metadata)\n",
415416
" return svg_repr"

nbs/03_utils.utils.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@
419419
"name": "stderr",
420420
"output_type": "stream",
421421
"text": [
422-
"/tmp/ipykernel_179604/2880814502.py:5: UserWarning: IPYthon has its output cache enabled. See https://xl0.github.io/lovely-tensors/history.html\n",
422+
"/tmp/ipykernel_303317/2880814502.py:5: UserWarning: IPYthon has its output cache enabled. See https://xl0.github.io/lovely-tensors/history.html\n",
423423
" warnings.warn(\"IPYthon has its output cache enabled. See https://xl0.github.io/lovely-tensors/history.html\")\n"
424424
]
425425
}

nbs/05_repr_chans.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"\n",
4141
"import numpy as np\n",
4242
"from matplotlib import axes, figure, pyplot as plt\n",
43-
"from IPython.core.pylabtools import print_figure\n",
4443
"\n",
4544
"from lovely_numpy.repr_rgb import fig_rgb, rgb\n",
4645
"from lovely_numpy.utils.colormap import InfCmap, get_cmap\n",
@@ -139,6 +138,7 @@
139138
" return fig_chans(self.x, **self.params)\n",
140139
"\n",
141140
" def _repr_png_(self):\n",
141+
" from IPython.core.pylabtools import print_figure\n",
142142
" return print_figure(self.fig, fmt=\"png\", pad_inches=0,\n",
143143
" metadata={\"Software\": \"Matplotlib, https://matplotlib.org/\"})\n"
144144
]

settings.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### Python library ###
66
repo = lovely-numpy
77
lib_name = lovely-numpy
8-
version = 0.2.15
8+
version = 0.2.16
99
min_python = 3.7
1010
license = MIT
1111

@@ -42,8 +42,8 @@ conda_maintainers = xl0 sugatoray
4242
conda_description = %(description)s
4343

4444
### Optional ###
45-
requirements = numpy>=1.17 fastcore ipython
45+
requirements = numpy>=1.17 fastcore
4646
pip_requirements = matplotlib
4747
conda_requirements = matplotlib-base
48-
dev_requirements = scipy
48+
dev_requirements = scipy ipython
4949
# console_scripts =

0 commit comments

Comments
 (0)