Skip to main content

Embeddable notebooks.

Project description

# hydra-notebooks

Jupyter notebooks integration for Django.
Features:
- Expose and API to handle notebooks,
- Import as modules
- Execute by notebook
- Embedd to Django-extensions shell plus

### Configuration

Jupyter configuration has to be add to the site directory, aside the ```settings.py```

### Usage

#### Importing and using notebooks

Assume, we have a notebook called ```my_notebook``` with the following cell:

```python
class SampleClass(object):

def sample_method(self):
print('execute sample_method')
pass

def sample_method_with_output(self):
print('execute sample_method_with_output')
return 'output'

def sample_method_with_inoutput(self, param, *args, **kwargs):
print('execute sample_method_with_inoutput(%s, %s, %s)' % (param, args, kwargs))
return 'output'

def __str__(self):
return 'sample_class'
```

```python
# To use the module capabilities
import hydra_notebook

import notebooks.my_notebook as mynb

new_instance = mynb.SampleClass()

new_instance.sample_method_with_output()

```

As result:

```
execute sample_method_with_output
```

#### Executing notebooks

```python
import hydra_notebook
import os

with hydra_notebook.NotebookExecutor(path=os.path.join('.', 'notebooks'), fullname='demo_notebook') as e:
e()
```

#### Displaying notebooks as HTML5 page

```/notebook/index```: List all notebooks

```/notebook/detail/<notebook_name>```: Show a notebook

#### Displaying notebooks as JSON

```/notebook/```: List all notebooks

```/notebook/<notebook_name>/```: Show a notebook

```/notebook/<notebook_name>/execute```: Execute a notebook

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hydra-notebook-1.0.0.tar.gz (16.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page