[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/comint-mime 95d9d34 2/8: Improve Matplotlib setup from
From: |
ELPA Syncer |
Subject: |
[elpa] externals/comint-mime 95d9d34 2/8: Improve Matplotlib setup from IPython |
Date: |
Mon, 18 Oct 2021 12:57:18 -0400 (EDT) |
branch: externals/comint-mime
commit 95d9d346a07c77c4dd267262d6bea541d94afbd5
Author: Augusto Stoffel <arstoffel@gmail.com>
Commit: Augusto Stoffel <arstoffel@gmail.com>
Improve Matplotlib setup from IPython
---
comint-mime.py | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/comint-mime.py b/comint-mime.py
index 86584f4..323ef67 100644
--- a/comint-mime.py
+++ b/comint-mime.py
@@ -2,19 +2,15 @@
def __COMINT_MIME_setup(types):
try:
- import IPython, matplotlib
- ipython = IPython.get_ipython()
- matplotlib.use('module://ipykernel.pylab.backend_inline')
+ ipython = get_ipython()
+ assert ipython
except:
- print("`comint-mime': error setting up")
+ print("`comint-mime' error: IPython is required")
return
from base64 import encodebytes
- from json import dumps as to_json
from functools import partial
-
- OSC = '\033]5151;'
- ST = '\033\\'
+ from json import dumps as to_json
MIME_TYPES = {
"image/png": None,
@@ -23,7 +19,7 @@ def __COMINT_MIME_setup(types):
"text/html": str.encode,
"application/json": lambda d: to_json(d).encode(),
}
-
+
if types == "all":
types = MIME_TYPES
else:
@@ -35,8 +31,9 @@ def __COMINT_MIME_setup(types):
data = encoder(data)
header = to_json({**meta, "type": type})
payload = encodebytes(data).decode()
- print(f'{OSC}{header}\n{payload}{ST}')
+ print(f"\033]5151;{header}\n{payload}\033\\")
+ ipython.enable_matplotlib("inline")
ipython.display_formatter.active_types = list(MIME_TYPES.keys())
for mime, encoder in MIME_TYPES.items():
ipython.display_formatter.formatters[mime].enabled = mime in types
- [elpa] branch externals/comint-mime created (now d9cdad5), ELPA Syncer, 2021/10/18
- [elpa] externals/comint-mime a8b0f67 1/8: Initial commit, ELPA Syncer, 2021/10/18
- [elpa] externals/comint-mime 95d9d34 2/8: Improve Matplotlib setup from IPython,
ELPA Syncer <=
- [elpa] externals/comint-mime 6b95376 5/8: Reduce Emacs version requirement to 28 (from 28.1), ELPA Syncer, 2021/10/18
- [elpa] externals/comint-mime 3e02807 7/8: Update copyright assignment, ELPA Syncer, 2021/10/18
- [elpa] externals/comint-mime d9cdad5 8/8: Convert README to org format, ELPA Syncer, 2021/10/18
- [elpa] externals/comint-mime e7c847a 6/8: Fix interaction between HTML rendering and process mark, ELPA Syncer, 2021/10/18
- [elpa] externals/comint-mime bb9a1ad 3/8: Hide setup from shell history, at least when "ignorespace" is set, ELPA Syncer, 2021/10/18
- [elpa] externals/comint-mime 9cf131d 4/8: Disable LaTeX rendering by default for now, ELPA Syncer, 2021/10/18