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 details)

Uploaded Source

File details

Details for the file hydra-notebook-1.0.0.tar.gz.

File metadata

File hashes

Hashes for hydra-notebook-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0085717b350d1eb1d60fc586521f9e59c423f71c7935ac1bdc1b648416c240d8
MD5 be3fa18716ffa167e6840480c62d8cda
BLAKE2b-256 fb4dce087fd04c1fbc6f8b5457ccf28b16b1967f91d2886618c5261921172ae5

See more details on using hashes here.

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