Skip to main content

Keep your local python scripts installed and in sync with a databricks notebook. Shortens the feedback loop to develop projects using a hybrid enviroment

Project description

Databricks-Rocket

PyPI version PyPI downloads

Databricks-Rocket (short db-rockets), keeps your local Python scripts installed and synchronized with a Databricks notebook. Every change on your local machine is automatically reflected in the notebook. This shortens the feedback loop for developing git-based projects and eliminates the need to set up a local development environment.

Installation

Install databricks-rocket using pip:

pip install databricks-rocket

Setup

Ensure you've created a personal access token in Databricks (offical documentation). Afterward, set up the Databricks CLI by executing:

databricks configure --token

Alternatively, you can set the Databricks token and host in your environment variables:

export DATABRICKS_HOST="mydatabrickshost"
export DATABRICKS_TOKEN="mydatabrickstoken"

If your project isn't already a pip package, you'll need to convert it into one. Use dbrocket for this:

rocket setup

Will create a setup.py for you.

Usage

To Sync Your Project

By default, databricks-rocket syncs your project to DBFS automatically. This allows you to update your code and have those changes reflected in your Databricks notebook without restarting the Python kernel. Simply execute:

rocket launch

You'll then receive the exact command to run in your notebook. Example:

stevenmi@MacBook db-rocket % rocket launch --watch=False
>> Watch activated. Uploaded your project to databricks. Install your project in your databricks notebook by running:
>> %pip install --upgrade pip
>> %pip install  -r /dbfs/temp/stevenmi/db-rocket/requirements.txt
>> %pip install --no-deps -e /dbfs/temp/stevenmi/db-rocket

and following in a new Python cell:
>> %load_ext autoreload
>> %autoreload 2

Finally, add the content in you databricks notebook: imgs/img_2.png

To Upload Your Python Package

If you've disabled the watch feature, databricks-rocket will only upload your project as a wheel to DBFS:

rocket launch --watch=False

Example:

stevenmi@MacBook db-rocket % rocket launch --watch=False
>> Watch is disabled. Building creating a python wheel from your project
>> Found setup.py. Building python library
>> Uploaded ./dist/databricks_rocket-2.0.0-py3-none-any.whl to dbfs:/temp/stevenmi/db-rocket/dist/databricks_rocket-2.0.0-py3-none-any.whl
>> Uploaded wheel to databricks. Install your library in your databricks notebook by running:
>> %pip install --upgrade pip
>> %pip install  /dbfs/temp/stevenmi/db-rocket/databricks_rocket-2.0.0-py3-none-any.whl --force-reinstall

Support

  • Databricks: >=7
  • Python: >=3.7
  • Tested on Platform: Linux, MacOs. Windows will probably not work but contributions are welcomed!

Acknowledgments

  • Thanks Leon Poli for the Logo :)
  • Thanks Stephane Leonard for source-code and documentation improvements :)
  • Thanks Malachi Soord for the CICD setup and README improvements

Contributions are welcomed!

Blogposts

  • DB Rocket 1.0 post also gives more details about the rationale around dbrocket.

Security

For security issues please contact security@getyourguide.com.

Legal

db-rocket is licensed under the Apache License, Version 2.0. See LICENSE for the full text.

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

databricks-rocket-2.0.2.tar.gz (61.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

databricks_rocket-2.0.2-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file databricks-rocket-2.0.2.tar.gz.

File metadata

  • Download URL: databricks-rocket-2.0.2.tar.gz
  • Upload date:
  • Size: 61.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for databricks-rocket-2.0.2.tar.gz
Algorithm Hash digest
SHA256 ecc33b2aebaded49512f7dc85409bc9a6a739f22ead26a837f1fffc4aa0982f4
MD5 d57b03f64d69ae5ccf8b7be125e759b0
BLAKE2b-256 17acb0d3210d536f1e49cae41ae24a36057afe61b5cdc2142a3cf6073e8451df

See more details on using hashes here.

File details

Details for the file databricks_rocket-2.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for databricks_rocket-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f51daae1ca420e32b08faa1ce5ca42793845f443dc5ec024ac93a642aab2d9a7
MD5 14e67d595744e954233f9d06906a212a
BLAKE2b-256 1e24f69166ae1cc668d65ae1dc6faa20f84b0f3dfa5239b2f472689cb387b93d

See more details on using hashes here.

Supported by

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