Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timkpaine/jupyterlab_email
A jupyterlab extension to email notebooks directly from JupyterLab.
https://github.com/timkpaine/jupyterlab_email
email email-notebooks jupyter jupyterlab jupyterlab-extension
Last synced: 19 days ago
JSON representation
A jupyterlab extension to email notebooks directly from JupyterLab.
- Host: GitHub
- URL: https://github.com/timkpaine/jupyterlab_email
- Owner: timkpaine
- License: apache-2.0
- Created: 2018-08-07T14:14:40.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-10-15T19:20:24.000Z (about 2 months ago)
- Last Synced: 2024-11-16T23:04:04.510Z (26 days ago)
- Topics: email, email-notebooks, jupyter, jupyterlab, jupyterlab-extension
- Language: Python
- Homepage:
- Size: 2.64 MB
- Stars: 60
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-jupyter-resources - GitHub - 11% open · ⏱️ 21.07.2022): (JupyterLab扩展)
- best-of-jupyter - GitHub - 5% open · ⏱️ 19.11.2024): (JupyterLab Extensions)
README
# jupyterlab_email
A jupyterlab extension to email notebooks from the browser.[![Build Status](https://github.com/timkpaine/jupyterlab_email/workflows/Build%20Status/badge.svg?branch=main)](https://github.com/timkpaine/jupyterlab_email/actions?query=workflow%3A%22Build+Status%22)
[![codecov](https://codecov.io/gh/timkpaine/jupyterlab_email/branch/main/graph/badge.svg)](https://codecov.io/gh/timkpaine/jupyterlab_email)
[![PyPI](https://img.shields.io/pypi/l/jupyterlab_email.svg)](https://pypi.python.org/pypi/jupyterlab_email)
[![PyPI](https://img.shields.io/pypi/v/jupyterlab_email.svg)](https://pypi.python.org/pypi/jupyterlab_email)
[![npm](https://img.shields.io/npm/v/jupyterlab_email.svg)](https://www.npmjs.com/package/jupyterlab_email)![](https://raw.githubusercontent.com/timkpaine/jupyterlab_email/main/docs/example.gif)
## Options
- Inline notebook as email, with code
- Inline notebook as email, without code
- Send notebook as HTML attachment, with code
- Send notebook as HTML attachment, without code
- Send notebook as PDF attachment, with code
- Send notebook as PDF attachment, without code
- Attach output data as CSV, TSV, PDF, PNG, or Excel Spreadsheet## Install
```bash
pip install jupyterlab_email
jupyter labextension install jupyterlab_email
jupyter serverextension enable --py jupyterlab_email
```## Adding templates
install the server extension, and add the following to `jupyter_notebook_config.py````python3
c.JupyterLabEmail.smtp_servers = [{'name': 'gmail',
'domain': 'gmail.com',
'username': '',
'smtp': 'smtp.gmail.com',
'port': 465}]```
## Create email from notebook:
Use the function in `jupyterlab_email._email`
```python3
def make_email(path, model, from_, type='email', template='', code=False, subject='',
also_attach='none', also_attach_pdf_template='', also_attach_html_template=''):
'''
path : path to notebook
model : notebook itself (in case deployment strips outputs or
notebook not available except through ContentsManager)
from_ : address to send the email from
type : type to convert notebook to
template : template to use when converting notebook
code : include input cells in notebook
subject : subject of email
also_attach : also attach pdf/html/both
'''
```## Attach dataframe as csv or spreadsheet
In `jupyterlab_email.attachments````python3
def attach(data, filename, type):
```Modify `jupyterlab_email.attachments.EXCEL_ENGINE` to use a different excel writer (defaults to `xlsxwriter`)
## Inline LaTeX
In `jupyterlab_email.attachments````python3
def latex(expression):
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(10, 1))
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)
ax.axis('off')
plt.text(0, 0.6, r'$%s$' % expression, fontsize=25)
plt.show()
```