Coder Social home page Coder Social logo

libify's Introduction

Libify

Libify makes it easy to import notebooks in Databricks. Notebook imports can also be nested to create complex workflows easily. Supports Databricks Runtime Version 5.5 and above.

Installation
  1. Click the Clusters icon in the sidebar
  2. Click a cluster name (make sure the cluster is running)
  3. Click the Libraries tab
  4. Click Install New
  5. Under Library Source, choose PyPI
  6. Under Package, write libify
  7. Click Install

Capture.png

Typical Usage

After installing the package, add the following code snippets to the notebooks:

  1. In the importee notebook (the notebook to be imported), add the following cell at the end of the notebook. Make sure that dbutils.notebook.exit is not used anywhere in the notebook and that the last cell contains exactly the following snippet and nothing else:

    import libify
    libify.exporter(globals())
  2. In the importer notebook (the notebook that imports other notebooks), first import libify:

    import libify

    and then use the following code to import the notebook(s) of your choice:

    mod1 = libify.importer(globals(), '/path/to/importee1')
    mod2 = libify.importer(globals(), '/path/to/importee2')

    Everything defined in importee1 and importee2 would now be contained in the namespaces mod1 and mod2 respectively, and can be accessed using the dot notation, e.g.

    x = mod1.function_defined_in_importee1()

Databricks Community Cloud Workaround

Databricks Community Cloud (https://community.cloud.databricks.com) does not allow calling one notebook from another notebook, but notebooks can still be imported using the following workaround. However, both of the following steps will have to be run each time a cluster is created/restarted.

  1. Run step 1 from above (Typical Usage). Make a note of the output of the last cell (only the part marked below): Capture.png

  2. In the importer notebook, call libify.importer with the config parameter as the dictionary obtained from the previous step:

    import libify
    mod1 = libify.importer(globals(), config={"key": "T5gRAUduh9uSbhHIrj2c9R4UbrXUt2WiA4aYIpl3gGo=", "file": "/tmp/tmpmcoypj24"})

Build/Push Pipeline GitHub issues PyPI - Format PyPI version GitHub last commit GitHub tag (latest by date) visitors Downloads

libify's People

Contributors

vagrantism avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.