Skip to main content

Import Databricks notebooks as libraries/modules

Project description

Libify

Hits

(Does not work with Databricks Community)

Usage

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

  • 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())
    
  • 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 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()
    

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

libify-0.75.tar.gz (2.4 kB view hashes)

Uploaded Source

Built Distribution

libify-0.75-py3-none-any.whl (3.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