Skip to main content

Jupyter kernels for working with dapla services

Project description

dapla-ipython-kernels

Python module for use within Jupyter notebooks. It contains kernel extensions for integrating with Apache Spark, Google Cloud Storage and custom dapla services.

PyPI version Status License

Getting Started

Install the module from pip:

# pip
pip install dapla-ipython-kernels

Now the module is ready to use with a single import:

import dapla as dp

This module is targeted to python kernels in Jupyter, but it may work in any IPython environment. It also depends on a number of custom services, e.g. the custom auth service

To test, simply create any Pandas dataframe. This can be stored in Google Cloud Storage at a specific path:

import pandas as pd
import dapla as dp

data = {
    'apples': [3, 2, 0, 1], 
    'oranges': [0, 3, 7, 2]
}
# Create pandas DataFrame
purchases = pd.DataFrame(data, index=['June', 'Robert', 'Lily', 'David'])

# Write pandas DataFrame to parquet
dp.write_pandas(purchases, '/testfolder/python/purchases', valuation='INTERNAL', state= 'INPUT')

Conversely, parquet files can be read from a path directly into a pandas DataFrame.

import dapla as dp
# Read path into pandas dataframe 
purchases = dp.read_pandas('/testfolder/python/purchases')

Other functions

Since the python module integrates with Google Cloud Storage and custom dapla services, some other functions exist as well:

import dapla as dp

# List path by prefix
dp.show('/testfolder/python')
Path Timestamp
/testfolder/python/purchases 1593120298095
/testfolder/python/other 1593157667793
import dapla as dp

# Show file details
dp.details('/testfolder/python/purchases')
Size Name
2908 42331105444c9ca0ce049ef6de7160.parquet

See also the example notebook written for Jupyter.

Deploy to SSB jupyter

Release version pypi

Make sure you have a clean master branch.
run make bump-version-patch - this will update version and commit to git.
run git push --tags origin master - important to have --tags to make it auto deploy to pypi

If everything was ok we should see a new release her: https://pypi.org/project/ssb-ipython-kernels/

Update jupyter image on staging

For now, we have to delete the running jupyer hub instance to make it use this new config

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

ssb-ipython-kernels-0.3.3.tar.gz (25.3 kB view hashes)

Uploaded Source

Built Distribution

ssb_ipython_kernels-0.3.3-py3-none-any.whl (29.4 kB view hashes)

Uploaded Python 3

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