Skip to content

Commit 59f6639

Browse files
committed
Merge branch 'upgrade'
2 parents 5bf01fa + 7e3368c commit 59f6639

File tree

127 files changed

+8692
-14329
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+8692
-14329
lines changed

.github/workflows/deploy-doc-to-ghpages.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ jobs:
1515
- name: Install python dependencies
1616
run: |
1717
python -m pip install --upgrade pip
18-
pip install -r requirements.txt
19-
pip install -r docs/requirements.txt
18+
pip install -e .[docs]
2019
- name: Building docs
2120
run: cd docs && make build-html
2221
- name: Deploy

MANIFEST.in

Lines changed: 0 additions & 4 deletions
This file was deleted.

appyter/VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

appyter/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
'''
33
import os
44
from appyter.magic import init
5+
from importlib.metadata import version
56

6-
__version__ = open(os.path.join(os.path.dirname(__file__), 'VERSION'), 'r').read().strip()
7+
__version__ = version(__package__)

appyter/ext/fsspec/drs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,6 @@ def _open(self, path, mode="rb", **kwargs):
9494
path_info = self.info(path)
9595
kwargs = dict(loop=get_event_loop())
9696
if path_info['_url'].startswith('https://'):
97-
kwargs.update(client_kwargs=dict(connector=aiohttp.TCPConnector(ssl=self.ssl_verify)))
97+
kwargs.update(client_kwargs=dict(connector=aiohttp.TCPConnector(ssl=self.ssl_verify, loop=kwargs['loop'])))
9898
fs, fo = url_to_fs_ex(path_info['_url'], **kwargs)
9999
return fs.open(fo, mode)

appyter/ext/fsspec/storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
async def ensure_storage(storage_uri):
55
import fsspec
66
from appyter.ext.fsspec.core import url_to_fs_ex
7-
if 'storage' not in fsspec.registry.target:
7+
if 'storage' not in fsspec.registry:
88
from appyter.ext.fsspec.singleton import SingletonFileSystem
99
from appyter.ext.asyncio.helpers import ensure_async_contextmanager
1010
fs, fo = url_to_fs_ex(storage_uri)

appyter/ext/fsspec/test_fuseless_mount.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ def test_fuse_mount():
3535
(mnt_dir/'hi').mkdir(exist_ok=True)
3636
(mnt_dir/'hi/world').open('w').write('test')
3737
assert_eq((mnt_dir/'hi/world').open('r').read(), 'test')
38+
# seek works
39+
with (mnt_dir/'bye').open('w+') as fw:
40+
fw.write('hi!')
41+
fw.seek(0)
42+
fw.write('H')
43+
assert_eq((mnt_dir/'bye').open('r').read(), 'Hi!')
3844
finally:
3945
fs.rm('', recursive=True)
4046

appyter/ext/pathlib/assertions.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

appyter/fields.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
''' ```eval_rst
1+
'''
22
This module contains :class:`appyter.fields.Field`, the base class for all fields
33
defined in :mod:`appyter.profiles.default.fields`.
4-
``` '''
4+
'''
55

6-
from flask import Markup
6+
from markupsafe import Markup
77
from appyter.ext.flask import request_get
88

99
class PartialField:
1010
''' Partial instantiation of a field
1111
Replaces a decorator so that we can still identify it as
12-
a callable which will produce a field.
12+
a callable which will produce a field.
1313
'''
1414
def __init__(self, field, **kwargs):
1515
self._field = field
@@ -47,10 +47,9 @@ def as_dict(self):
4747

4848
class Field(dict):
4949
''' Base field for which all fields derive
50-
```eval_rst
5150
Base class for all Field objects representing a value that will later be provided via a front-end form.
5251
See :mod:`appyter.profiles.default.fields` for the actual fields.
53-
``` '''
52+
'''
5453
def __init__(self,
5554
name=None,
5655
label=None,
@@ -62,7 +61,7 @@ def __init__(self,
6261
section=None,
6362
_env=None,
6463
**kwargs):
65-
'''
64+
r'''
6665
:param name: (str) A name that will be used to refer to the object as a variable and in the HTML form.
6766
:param label: (str) A human readable label for the field for the HTML form
6867
:param description: (Optional[str]) A long human readable description for the field for the HTML form
@@ -113,7 +112,7 @@ def constraint(self):
113112
return (self.raw_value is None and not self.args.get('required')) or (self.raw_value in self.choices)
114113

115114
def render(self, **kwargs):
116-
''' Return a rendered version of the field (form)
115+
r''' Return a rendered version of the field (form)
117116
118117
:param \**kwargs: The instance values of the form e.g. `Field.render(**field.args)`
119118
'''

appyter/magic.py

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
''' IPython magic for making templating easy~. This basically
1+
r'''
2+
IPython magic for making templating easy~. This basically
23
just allows our jinja-type language to be executed in place
34
injecting the defaults into the environment so we can easily
45
debug the notebook at the same time as building the appyter.
@@ -10,25 +11,24 @@
1011
1112
Usage (put the following in the first cell):
1213
13-
```python
14-
#%%appyter init
15-
from appyter import magic
16-
magic.init(lambda _=globals: _())
17-
```
14+
.. code-block:: python
15+
16+
#%%appyter init
17+
from appyter import magic
18+
magic.init(lambda _=globals: _())
1819
'''
1920

2021
'''
2122
Setup given globals
2223
'''
2324
def init(_globals, verbose=False, ipynb='app.ipynb', mode='magic', safe_mode=False, **kwargs):
24-
''' Initialize appyter magic.
25+
r''' Initialize appyter magic.
2526
2627
Sets up a jinj2 environment and injects %%appyter magic into your environment.
2728
28-
:param _globals: (Dict[str, Any]) A callable with your globals for the purpose of injection, basically just: `lambda _=globals: _()`
29+
:param _globals: (Dict[str, Any]) A callable with your globals for the purpose of injection, basically just: ``lambda _=globals: _()``
2930
:param verbose: (Optional[bool]) Expand exception reporting to be more verbose
3031
'''
31-
import os
3232
import jinja2
3333
import jinja2.meta
3434
import traceback
@@ -37,23 +37,29 @@ def init(_globals, verbose=False, ipynb='app.ipynb', mode='magic', safe_mode=Fal
3737
from IPython.core.magic import register_cell_magic
3838
from IPython.display import display, Markdown, HTML
3939

40-
'''
40+
r'''
4141
register_cell_magic allows function to execute an entire cell with the following call structure:
42-
```python
43-
%%my_magic whatever
44-
all
45-
my
46-
data
47-
```
48-
Results in a call:
49-
```python
50-
my_magic(
51-
"whatever",
52-
"""all
42+
43+
.. code-block:: python
44+
45+
%%my_magic whatever
46+
all
5347
my
54-
data"""
55-
)
56-
```
48+
data
49+
50+
Results in a call:
51+
52+
.. code-block:: python
53+
54+
my_magic(
55+
"whatever",
56+
"""
57+
all
58+
my
59+
data
60+
"""
61+
)
62+
5763
'''
5864

5965
@register_cell_magic

0 commit comments

Comments
 (0)