Name | ipyuploads JSON |
Version |
0.2.4
JSON |
| download |
home_page | None |
Summary | A Jupyter file widget with chunked upload capabilities |
upload_time | 2024-10-10 19:53:10 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.6 |
license | BSD 3-Clause License Copyright (c) 2022, Regents of the University of California & Broad Institute All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
ipython
jupyter
widgets
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# ipyuploads
**ipyuploads** is a Jupyter file widget with a variety of improvements over the `FileUpload` component that comes in [ipywidgets](https://github.com/jupyter-widgets/ipywidgets). It is designed to serve as a drop-in replacement for the aforementioned component. Features include:
* Progress indicator on uploads over 1 mb
* "Chunked" file upload supports larger files than `FileUpload` allows
* The ability to write chunks to disk reduces the memory requirement for large file uploads
* Callback hooks on file upload completion, chunk upload completion and all-files completion
## Requirements
* ipywidgets >= 7.5.0
## Installation
```bash
pip install ipyuploads
```
### Development
```bash
git clone https://github.com/g2nb/ipyuploads.git
pip install -e ipyuploads
```
## Usage
In a Jupyter notebook, run the following:
```python
import ipyuploads
ipyuploads.Upload()
```
Various options can also be set, including:
```python
import ipyuploads
ipyuploads.Upload(accept='txt', # Accept only text files
multiple=True, # Upload multiple files at once
disabled=True, # Disable the widget
icon='cloud-upload', # Change the upload icon
button_stye='primary', # Change the button style
error='Bad Error', # Set the error message
busy=False, # Whether an upload is in progress
chunk_complete=foo, # Callback when a chunk upload completes
file_complete=bar, # Callback when a file upload completes
all_files_complete=baz, # Callback when all files complete
upload_dir=path # Custom dir path to upload to
)
```
The three callback functions defined above should have the following structure:
```python
def chunk_complete(name, count, total):
"""Callback to be executed when a chunk finishes uploading
name - Name of the file being uploaded
count - A counter of which chunk just finished uploading
total - The total number of chunks in this file"""
print(f'CHUNK CALLBACK! {name} {count} {total}')
def file_complete(name):
"""Callback to be executed when a file finishes uploading
name - Name of the file that was just uploaded"""
print('FILE CALLBACK! ' + name)
def all_files_complete(names):
"""Callback to be executed once all selected files finish uploading
names - A list of metadata objects, one for each file. Each contains:
{ 'name': 'the file's name',
'type': 'mime-type of the file',
'last_modified': last modified data as an integer
(number of milliseconds since the epoch) }"""
print(f'ALL FILES CALLBACK! {names}')
```
Raw data
{
"_id": null,
"home_page": null,
"name": "ipyuploads",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "ipython, jupyter, widgets",
"author": null,
"author_email": "Thorin Tabor <tmtabor@cloud.ucsd.edu>",
"download_url": "https://files.pythonhosted.org/packages/39/f3/679b9ba34489da28480ef14930ac78564e0d968963da300ed08b121cb602/ipyuploads-0.2.4.tar.gz",
"platform": null,
"description": "# ipyuploads\n\n**ipyuploads** is a Jupyter file widget with a variety of improvements over the `FileUpload` component that comes in [ipywidgets](https://github.com/jupyter-widgets/ipywidgets). It is designed to serve as a drop-in replacement for the aforementioned component. Features include:\n\n* Progress indicator on uploads over 1 mb\n* \"Chunked\" file upload supports larger files than `FileUpload` allows\n* The ability to write chunks to disk reduces the memory requirement for large file uploads\n* Callback hooks on file upload completion, chunk upload completion and all-files completion\n\n## Requirements\n\n* ipywidgets >= 7.5.0\n\n## Installation\n\n```bash\npip install ipyuploads\n```\n\n### Development\n\n```bash\ngit clone https://github.com/g2nb/ipyuploads.git\npip install -e ipyuploads\n```\n\n## Usage\n\nIn a Jupyter notebook, run the following:\n\n```python\nimport ipyuploads\n\nipyuploads.Upload()\n```\n\nVarious options can also be set, including:\n\n```python\nimport ipyuploads\n\nipyuploads.Upload(accept='txt', # Accept only text files\n multiple=True, # Upload multiple files at once\n disabled=True, # Disable the widget\n icon='cloud-upload', # Change the upload icon\n button_stye='primary', # Change the button style\n error='Bad Error', # Set the error message\n busy=False, # Whether an upload is in progress\n chunk_complete=foo, # Callback when a chunk upload completes\n file_complete=bar, # Callback when a file upload completes\n all_files_complete=baz, # Callback when all files complete\n upload_dir=path # Custom dir path to upload to\n )\n```\n\nThe three callback functions defined above should have the following structure:\n\n```python\ndef chunk_complete(name, count, total):\n \"\"\"Callback to be executed when a chunk finishes uploading\n \n name - Name of the file being uploaded\n count - A counter of which chunk just finished uploading\n total - The total number of chunks in this file\"\"\"\n print(f'CHUNK CALLBACK! {name} {count} {total}')\n\ndef file_complete(name):\n \"\"\"Callback to be executed when a file finishes uploading\n \n name - Name of the file that was just uploaded\"\"\"\n print('FILE CALLBACK! ' + name)\n\ndef all_files_complete(names):\n \"\"\"Callback to be executed once all selected files finish uploading\n \n names - A list of metadata objects, one for each file. Each contains:\n { 'name': 'the file's name', \n 'type': 'mime-type of the file', \n 'last_modified': last modified data as an integer \n (number of milliseconds since the epoch) }\"\"\"\n print(f'ALL FILES CALLBACK! {names}')\n```\n",
"bugtrack_url": null,
"license": "BSD 3-Clause License Copyright (c) 2022, Regents of the University of California & Broad Institute All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
"summary": "A Jupyter file widget with chunked upload capabilities",
"version": "0.2.4",
"project_urls": {
"Homepage": "https://github.com/g2nb/ipyuploads"
},
"split_keywords": [
"ipython",
" jupyter",
" widgets"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ae4f2fb26f49e8ed984e35afb8f5826110ab62ffb235936ca2be3487257c8169",
"md5": "03bb47cabfe0ef69a865398689240af1",
"sha256": "ef90db391f5f73eb21b97205fcae59d13b4ed189c41183b6905c1096e047704d"
},
"downloads": -1,
"filename": "ipyuploads-0.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "03bb47cabfe0ef69a865398689240af1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 108779,
"upload_time": "2024-10-10T19:53:14",
"upload_time_iso_8601": "2024-10-10T19:53:14.364473Z",
"url": "https://files.pythonhosted.org/packages/ae/4f/2fb26f49e8ed984e35afb8f5826110ab62ffb235936ca2be3487257c8169/ipyuploads-0.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "39f3679b9ba34489da28480ef14930ac78564e0d968963da300ed08b121cb602",
"md5": "b07de8e145a95904fe83fc1b6075967c",
"sha256": "4f7152200549cca204612d9aedd3071e595b7ffbbb451b92bfc3407107ac91aa"
},
"downloads": -1,
"filename": "ipyuploads-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "b07de8e145a95904fe83fc1b6075967c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 30010872,
"upload_time": "2024-10-10T19:53:10",
"upload_time_iso_8601": "2024-10-10T19:53:10.012408Z",
"url": "https://files.pythonhosted.org/packages/39/f3/679b9ba34489da28480ef14930ac78564e0d968963da300ed08b121cb602/ipyuploads-0.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-10 19:53:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "g2nb",
"github_project": "ipyuploads",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "ipyuploads"
}