diff --git a/.github/workflows/test_pip.yml b/.github/workflows/test_pip.yml
index 8e5c7c4..161d3f1 100644
--- a/.github/workflows/test_pip.yml
+++ b/.github/workflows/test_pip.yml
@@ -26,6 +26,7 @@ jobs:
pip install -r requirements.txt
pip install -e .
- name: PyTest
+ if: (! contains(matrix.python-version, 'pypy')) || contains(matrix.os, 'windows')
run: |
pip install pytest coverage
coverage run --branch -m pytest
@@ -46,7 +47,7 @@ jobs:
coverage report --show-missing
coveralls --service=github
- name: Notebook test
- if: (! contains(matrix.python-version, 'pypy')) || (! contains(matrix.os, 'windows'))
+ if: (! contains(matrix.python-version, 'pypy'))
run: |
pip install nbconvert jupyter
jupyter nbconvert --to notebook --execute afar/tests/*ipynb
diff --git a/README.md b/README.md
index 1615084..c884201 100644
--- a/README.md
+++ b/README.md
@@ -10,9 +10,13 @@
> _Robert A. Heinlein_
+**To install:** `pip install afar`
+
`afar` allows you to run code on a remote [Dask](https://dask.org/) [cluster](https://distributed.dask.org/en/latest/) using context managers. For example:
```python
import afar
+from dask.distributed import Client
+client = Client()
with afar.run, remotely:
import dask_cudf
diff --git a/afar/core.py b/afar/core.py
index bf36c4d..28e1e4c 100644
--- a/afar/core.py
+++ b/afar/core.py
@@ -38,7 +38,7 @@ def __enter__(self):
def __exit__(self, exc_type, exc_value, exc_traceback): # pragma: no cover
return False
- def __call__(self, *, client=None, **submit_kwargs):
+ def __call__(self, client=None, **submit_kwargs):
return Where(self.where, client, submit_kwargs)
@@ -194,7 +194,9 @@ def _exit(self, exc_type, exc_value, exc_traceback):
if self._where == "remotely":
if client is None:
client = distributed.client._get_global_client()
- remote_dict = client.submit(run_afar, self._magic_func, names, futures, **submit_kwargs)
+ remote_dict = client.submit(
+ run_afar, self._magic_func, names, futures, pure=False, **submit_kwargs
+ )
if display_expr:
repr_val = client.submit(
reprs.repr_afar,
diff --git a/afar/reprs.py b/afar/reprs.py
index 8ba2274..d2256d8 100644
--- a/afar/reprs.py
+++ b/afar/reprs.py
@@ -106,6 +106,7 @@ def repr_afar(val, repr_methods):
if method is None:
continue
if method_name == "_ipython_display_":
+ # Custom display! Send the object to the client
return val, method_name, False
try:
rv = method()
@@ -116,7 +117,12 @@ def repr_afar(val, repr_methods):
rv = traceback.format_exception(*exc_info)
return rv, method_name, True
else:
- if rv is None or not isinstance(rv, str):
+ if rv is None:
+ continue
+ if method_name == "_repr_mimebundle_":
+ if not isinstance(rv, (dict, tuple)):
+ continue
+ elif not isinstance(rv, str):
continue
return rv, method_name, False
return repr(val), "__repr__", False
diff --git a/setup.cfg b/setup.cfg
index 46efc6f..4120389 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -17,6 +17,7 @@ ignore =
[coverage:run]
source = afar
+branch = True
omit =
afar/_version.py,
afar/tests/*