Name | jupyter-io JSON |
Version |
1.0.1
JSON |
| download |
home_page | None |
Summary | Direct saving and loading of files into Jupyter notebooks |
upload_time | 2024-12-11 08:25:01 |
maintainer | None |
docs_url | None |
author | None |
requires_python | <3.14,>=3.9 |
license | MIT License Copyright (c) 2020-2024 Akio Taniguchi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
io
jupyter
python
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# jupyter-io
[![Release](https://img.shields.io/pypi/v/jupyter-io?label=Release&color=cornflowerblue&style=flat-square)](https://pypi.org/project/jupyter-io/)
[![Python](https://img.shields.io/pypi/pyversions/jupyter-io?label=Python&color=cornflowerblue&style=flat-square)](https://pypi.org/project/jupyter-io/)
[![Downloads](https://img.shields.io/pypi/dm/jupyter-io?label=Downloads&color=cornflowerblue&style=flat-square)](https://pepy.tech/project/jupyter-io)
[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.14379974-cornflowerblue?style=flat-square)](https://doi.org/10.5281/zenodo.14379974)
[![Tests](https://img.shields.io/github/actions/workflow/status/astropenguin/jupyter-io/tests.yaml?label=Tests&style=flat-square)](https://github.com/astropenguin/jupyter-io/actions)
Direct saving and loading of files into Jupyter notebooks
## Installation
```shell
$ pip install jupyter-io
```
## File saving
jupyter-io provides the `in_notebook` function to directly save (i.e. embed) files into Jupyter notebooks.
Suppose you create a Matplotlib figure want to save it as a PDF file.
The following code will save the PDF file into your local environment:
```python
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])
plt.savefig("figure.pdf")
```
This should work in most cases, however, in a virtual environment like [Google Colaboratory](https://colab.research.google.com/), you will not be able to get the file once the Jupyter server is stopped.
By wrapping the file path by `in_notebook`, the PDF file will be directly saved into the Jupyter notebook and you will get a download link instead:
```python
import matplotlib.pyplot as plt
from jupyter_io import in_notebook
plt.plot([1, 2, 3])
plt.savefig(in_notebook("figure.pdf"))
```
The download link works when the Jupyter server is stopped, and even when it does not exist.
This makes Jupyter notebooks more portable, for example, to share the output data other than images together with them.
### More examples
To save a pandas series into a notebook:
```python
import pandas as pd
from jupyter_io import in_notebook
ser = pd.Series([1, 2, 3])
ser.to_csv(in_notebook("series.csv"))
```
To save a general text into a notebook:
```python
from jupyter_io import in_notebook
with open(in_notebook("output.txt"), "w") as f:
f.write("1, 2, 3\n")
```
## File loading
The file loading feature has not been implemented yet.
Raw data
{
"_id": null,
"home_page": null,
"name": "jupyter-io",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.14,>=3.9",
"maintainer_email": null,
"keywords": "io, jupyter, python",
"author": null,
"author_email": "Akio Taniguchi <taniguchi.akio@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/94/46/1fd3996c96ce4695eb84b414d565983d48a45b716bf81d08070ff72864eb/jupyter_io-1.0.1.tar.gz",
"platform": null,
"description": "# jupyter-io\n\n[![Release](https://img.shields.io/pypi/v/jupyter-io?label=Release&color=cornflowerblue&style=flat-square)](https://pypi.org/project/jupyter-io/)\n[![Python](https://img.shields.io/pypi/pyversions/jupyter-io?label=Python&color=cornflowerblue&style=flat-square)](https://pypi.org/project/jupyter-io/)\n[![Downloads](https://img.shields.io/pypi/dm/jupyter-io?label=Downloads&color=cornflowerblue&style=flat-square)](https://pepy.tech/project/jupyter-io)\n[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.14379974-cornflowerblue?style=flat-square)](https://doi.org/10.5281/zenodo.14379974)\n[![Tests](https://img.shields.io/github/actions/workflow/status/astropenguin/jupyter-io/tests.yaml?label=Tests&style=flat-square)](https://github.com/astropenguin/jupyter-io/actions)\n\nDirect saving and loading of files into Jupyter notebooks\n\n## Installation\n\n```shell\n$ pip install jupyter-io\n```\n\n## File saving\n\njupyter-io provides the `in_notebook` function to directly save (i.e. embed) files into Jupyter notebooks.\nSuppose you create a Matplotlib figure want to save it as a PDF file.\nThe following code will save the PDF file into your local environment:\n```python\nimport matplotlib.pyplot as plt\n\nplt.plot([1, 2, 3])\nplt.savefig(\"figure.pdf\")\n```\nThis should work in most cases, however, in a virtual environment like [Google Colaboratory](https://colab.research.google.com/), you will not be able to get the file once the Jupyter server is stopped.\nBy wrapping the file path by `in_notebook`, the PDF file will be directly saved into the Jupyter notebook and you will get a download link instead:\n```python\nimport matplotlib.pyplot as plt\nfrom jupyter_io import in_notebook\n\nplt.plot([1, 2, 3])\nplt.savefig(in_notebook(\"figure.pdf\"))\n```\nThe download link works when the Jupyter server is stopped, and even when it does not exist.\nThis makes Jupyter notebooks more portable, for example, to share the output data other than images together with them.\n\n### More examples\n\nTo save a pandas series into a notebook:\n\n```python\nimport pandas as pd\nfrom jupyter_io import in_notebook\n\nser = pd.Series([1, 2, 3])\nser.to_csv(in_notebook(\"series.csv\"))\n```\n\nTo save a general text into a notebook:\n\n```python\nfrom jupyter_io import in_notebook\n\nwith open(in_notebook(\"output.txt\"), \"w\") as f:\n f.write(\"1, 2, 3\\n\")\n```\n\n## File loading\n\nThe file loading feature has not been implemented yet.\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2020-2024 Akio Taniguchi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "Direct saving and loading of files into Jupyter notebooks",
"version": "1.0.1",
"project_urls": {
"homepage": "https://astropenguin.github.io/jupyter-io/v1.0.1",
"repository": "https://github.com/astropenguin/jupyter-io"
},
"split_keywords": [
"io",
" jupyter",
" python"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "be4e1306c2f31be8f321a2002731661e88954c6b59d5de217a7b032b7229fc6e",
"md5": "e17c1e35af77ffd9a3302dd3978515a6",
"sha256": "1cf2fa52756c7fecbab37087f35422dc18c3573260efe5ef5faba9306923287b"
},
"downloads": -1,
"filename": "jupyter_io-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e17c1e35af77ffd9a3302dd3978515a6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.14,>=3.9",
"size": 6284,
"upload_time": "2024-12-11T08:24:59",
"upload_time_iso_8601": "2024-12-11T08:24:59.139468Z",
"url": "https://files.pythonhosted.org/packages/be/4e/1306c2f31be8f321a2002731661e88954c6b59d5de217a7b032b7229fc6e/jupyter_io-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "94461fd3996c96ce4695eb84b414d565983d48a45b716bf81d08070ff72864eb",
"md5": "cfdf0bfce5cdc722f89acf12ddc350dc",
"sha256": "3c7f303f09554fe9c8403ccab5aaccd252ee1f23864d6af89900dcc8bf051800"
},
"downloads": -1,
"filename": "jupyter_io-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "cfdf0bfce5cdc722f89acf12ddc350dc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.14,>=3.9",
"size": 83086,
"upload_time": "2024-12-11T08:25:01",
"upload_time_iso_8601": "2024-12-11T08:25:01.322483Z",
"url": "https://files.pythonhosted.org/packages/94/46/1fd3996c96ce4695eb84b414d565983d48a45b716bf81d08070ff72864eb/jupyter_io-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-11 08:25:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "astropenguin",
"github_project": "jupyter-io",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "jupyter-io"
}