Skip to content

Commit 4ee8372

Browse files
authored
Merge branch 'master' into single-archive-file-selector
2 parents ac957a0 + 2cccb72 commit 4ee8372

File tree

6 files changed

+194
-64
lines changed

6 files changed

+194
-64
lines changed

README.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,42 @@
55
[![Version](https://img.shields.io/npm/v/@hadim/jupyter-archive.svg)](https://www.npmjs.com/package/@hadim/jupyter-archive)
66
[![PyPI](https://img.shields.io/pypi/v/jupyter-archive)](https://pypi.org/project/jupyter-archive/)
77

8-
Make, download and extract archive files.
8+
A Jupyter/Jupyterlab extension to make, download and extract archive files.
99

10-
The extension is composed of two extensions:
10+
Features:
1111

12-
- A Jupyterlab extension (frontend).
13-
- A Jupyter server extension (backend).
12+
- Download selected or current folder as an archive.
13+
- Supported formats: 'zip', 'tar.gz', 'tar.bz2' and 'tar.xz'.
14+
- Archiving and downloading are non-blocking for Jupyter. UI can still be used.
15+
- Archive format can be set in the JLab settings.
16+
- Alternatively, you can choose the format in the file browser menu (the format setting needs to be set to `null`).
17+
- Decompress an archive directly in file browser.
18+
- Notebok client extension not available. [Contributions are welcome](https://github.com/hadim/jupyter-archive/issues/21).
1419

1520
![jupyter-archive in action](./archive.gif "jupyter-archive in action.")
1621

17-
Note that the extension is inspired from [nbzip](https://github.com/data-8/nbzip).
18-
1922
## Prerequisites
2023

2124
- JupyterLab
2225

2326
## Installation
2427

25-
This extension is meant to be integrated into Jupyter. In the meantime you can install it with:
28+
Using `pip`:
2629

2730
```bash
2831
pip install jupyter-archive
2932
jupyter lab build
3033
```
3134

32-
This will install both the server extension and the labextension needed by this plugin.
35+
Using `conda`:
36+
37+
```bash
38+
conda install jupyter-archive
39+
```
3340

34-
You can also install the labextension via Jupyterlab's extension manager GUI. Keep in mind that if you use the GUI, you'll still need to install the `jupyterlab-archive` server extension via `pip`.
41+
This will install both the server extension and the Jupyterlab extension needed by the plugin.
42+
43+
You can also install the labextension via Jupyterlab's extension manager GUI. Keep in mind that if you use the GUI, you'll still need to install the `jupyterlab-archive` server extension via `pip` or `conda`.
3544

3645
## Development
3746

@@ -73,6 +82,11 @@ pytest jupyter_archive/tests/
7382

7483
Under BSD license. See [LICENSE](LICENSE).
7584

85+
## Authors
86+
87+
- Hadrien Mary: [@hadim](https://github.com/hadim)
88+
- Frédéric Collonval: [@fcollonval](https://github.com/fcollonval)
89+
7690
## Release a new version
7791

7892
- Install [rever](https://regro.github.io/rever-docs/index.html): `conda install rever`

jupyter_archive/handlers.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@
1212
# The delay in ms at which we send the chunk of data
1313
# to the client.
1414
ARCHIVE_DOWNLOAD_FLUSH_DELAY = 100
15+
SUPPORTED_FORMAT = [
16+
"zip",
17+
"tgz",
18+
"tar.gz",
19+
"tbz",
20+
"tbz2",
21+
"tar.bz",
22+
"tar.bz2",
23+
"txz",
24+
"tar.xz"
25+
]
1526

1627

1728
class ArchiveStream():
@@ -84,6 +95,9 @@ def get(self, archive_path, include_body=False):
8495

8596
archive_token = self.get_argument('archiveToken')
8697
archive_format = self.get_argument('archiveFormat', 'zip')
98+
if archive_format not in SUPPORTED_FORMAT:
99+
self.log.error("Unsupported format {}.".format(archive_format))
100+
raise web.HTTPError(404)
87101

88102
archive_path = os.path.join(cm.root_dir, url2path(archive_path))
89103

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@hadim/jupyter-archive",
33
"version": "0.5.2-dev",
4-
"description": "Make, download and extract archive files.",
4+
"description": "A Jupyter/Jupyterlab extension to make, download and extract archive files.",
55
"keywords": [
66
"jupyter",
77
"jupyterlab",

schema/archive.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"description": "Archive handler options.",
44
"properties": {
55
"format": {
6-
"type": "string",
7-
"enum": ["zip", "tgz", "tar.gz","tbz", "tbz2", "tar.bz", "tar.bz2","txz", "tar.xz"],
6+
"type": ["string", "null"],
7+
"enum": [null, "zip", "tgz", "tar.gz","tbz", "tbz2", "tar.bz", "tar.bz2","txz", "tar.xz"],
88
"title": "Archive format",
9-
"description": "Archive format for compressing folder; one of ['zip', 'tgz', 'tar.gz', 'tbz', 'tbz2', 'tar.bz', 'tar.bz2', 'txz', 'tar.xz']",
9+
"description": "Archive format for compressing folder; one of [null (submenu), 'zip', 'tgz', 'tar.gz', 'tbz', 'tbz2', 'tar.bz', 'tar.bz2', 'txz', 'tar.xz']",
1010
"default": "zip"
1111
}
1212
},

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
author='Hadrien Mary',
5151
author_email='[email protected]',
5252
url='https://github.com/hadim/jupyter-archive/',
53-
description='Make, download and extract archive files.',
53+
description='A Jupyter/Jupyterlab extension to make, download and extract archive files.',
5454
long_description_content_type='text/markdown',
5555
cmdclass=cmdclass,
5656
packages=find_packages(),

0 commit comments

Comments
 (0)