cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Sharing Databricks Notebook Functionality Without Revealing Source Code

Hari_P
New Contributor II

Hi All,

I have a unique scenario in Databricks and would appreciate your insights.

I’ve developed functionality in Databricks notebooks, and I’d like to share this with other developers within the same workspace. My goal is to allow colleagues to import my notebook and call its functions, but without access to the notebook’s source code.

I’ve already explored converting my notebook into a wheel file, which works well for cross-workspace collaboration. However, my current need is limited to users within the same workspace, and I’m hoping for a solution that doesn’t involve packaging as a wheel.

Are there any built-in options or best practices within Databricks that would allow users to access the functionality of my notebook without viewing or modifying the underlying code?

Any suggestions or alternative approaches would be greatly appreciated.

2 REPLIES 2

Isi
Honored Contributor III

Hey @Hari_P ,

I believe this doesn’t exist today as a built-in feature. I reviewed the Databricks notebook permission model (docs link) and with the minimum level (“CAN READ”) users already have access to view the notebook’s source.

 

The simplest and most robust approach seems to be sticking with the wheel package. You can also use wheels for colleagues within the same workspace. Depending on your use case, you might want to check the installation options here: Python library support.

 

I tested a wrapper approach (a child notebook calling a parent notebook while restricting access to the parent), but it doesn’t work that way. So, in my opinion, the most sensible and convenient solution is to package your code into a wheel. I’d also recommend setting up some CI/CD pipeline to recompile the wheel automatically and publish the new version, so that everyone can update their clusters with the latest code without manual steps.

Hope this helps, 🙂

Isi


Hari_P
New Contributor II

Thank you @Isi  for your inputs. Yes, wheel file approach worked but since it is in the same workspace was thinking to explore if any alternative options we have.

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now