<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Best practice for using multiple local Python packages in notebooks within a Declarative Automation in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/best-practice-for-using-multiple-local-python-packages-in/m-p/178414#M57541</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm looking for a best practice on how to share several Python packages with notebooks in a Databricks bundle on serverless compute.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Setup&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;bundle-root/
├── databricks.yml
├── pyproject.toml
├── uv.lock
├── resources/
├── notebooks/
│ └── main.ipynb
└── src/
├── my_project/
│ └── foo/__init__.py
├── common/__init__.py
└── ingestion/__init__.py&lt;/LI-CODE&gt;&lt;P&gt;Locally everything works: `uv sync` installs the project in editable mode (hatchling, `packages = ["src/my_project", "src/common", "src/ingestion"]`) and `from my_project.foo.utils import bar` works in the notebook.&lt;/P&gt;&lt;P&gt;After `databricks bundle deploy`, on serverless I get `ModuleNotFoundError: No module named 'my_project'`, because the bundle root / `src` is not on `sys.path`.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Options I see&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1. **Plain source + sys.path:** Add `src` to `sys.path` at the top of every notebook. Works, but feels hacky, depends on the notebook location, and doesn't handle third-party dependencies.&lt;/P&gt;&lt;P&gt;2. **One pyproject.toml → one wheel with all packages:**&lt;BR /&gt;a) Use the Beta `project_environment` (&lt;A href="https://docs.databricks.com/aws/en/compute/serverless/dependencies#configure-a-project-environment-with-pyprojecttoml" target="_blank"&gt;https://docs.databricks.com/aws/en/compute/serverless/dependencies#configure-a-project-environment-with-pyprojecttoml&lt;/A&gt;), which needs the "Project-Scoped Shared Compute" preview, environment version 5+, an up-to-date `uv.lock` and CLI 1.21.0+.&lt;BR /&gt;b) Build the wheel as a bundle artifact and `%pip install` it in the notebook (or via `environments` for wheel tasks).&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Questions&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;- What is your recommended / production-proven approach for this?&lt;BR /&gt;- For option 2b: how do you reference the deployed wheel from a notebook task without hardcoding the workspace path?&lt;BR /&gt;- For option 2a: i build one wheel cotaining with all packages: is that fine?&lt;BR /&gt;- How do you keep interactive development in the workspace fast (no rebuild/redeploy after every code change)?&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
    <pubDate>Wed, 02 Dec 2026 07:31:43 GMT</pubDate>
    <dc:creator>a_user12</dc:creator>
    <dc:date>2026-12-02T07:31:43Z</dc:date>
    <item>
      <title>Best practice for using multiple local Python packages in notebooks within a Declarative Automation</title>
      <link>https://community.databricks.com/t5/data-engineering/best-practice-for-using-multiple-local-python-packages-in/m-p/178414#M57541</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm looking for a best practice on how to share several Python packages with notebooks in a Databricks bundle on serverless compute.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Setup&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;bundle-root/
├── databricks.yml
├── pyproject.toml
├── uv.lock
├── resources/
├── notebooks/
│ └── main.ipynb
└── src/
├── my_project/
│ └── foo/__init__.py
├── common/__init__.py
└── ingestion/__init__.py&lt;/LI-CODE&gt;&lt;P&gt;Locally everything works: `uv sync` installs the project in editable mode (hatchling, `packages = ["src/my_project", "src/common", "src/ingestion"]`) and `from my_project.foo.utils import bar` works in the notebook.&lt;/P&gt;&lt;P&gt;After `databricks bundle deploy`, on serverless I get `ModuleNotFoundError: No module named 'my_project'`, because the bundle root / `src` is not on `sys.path`.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Options I see&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1. **Plain source + sys.path:** Add `src` to `sys.path` at the top of every notebook. Works, but feels hacky, depends on the notebook location, and doesn't handle third-party dependencies.&lt;/P&gt;&lt;P&gt;2. **One pyproject.toml → one wheel with all packages:**&lt;BR /&gt;a) Use the Beta `project_environment` (&lt;A href="https://docs.databricks.com/aws/en/compute/serverless/dependencies#configure-a-project-environment-with-pyprojecttoml" target="_blank"&gt;https://docs.databricks.com/aws/en/compute/serverless/dependencies#configure-a-project-environment-with-pyprojecttoml&lt;/A&gt;), which needs the "Project-Scoped Shared Compute" preview, environment version 5+, an up-to-date `uv.lock` and CLI 1.21.0+.&lt;BR /&gt;b) Build the wheel as a bundle artifact and `%pip install` it in the notebook (or via `environments` for wheel tasks).&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Questions&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;- What is your recommended / production-proven approach for this?&lt;BR /&gt;- For option 2b: how do you reference the deployed wheel from a notebook task without hardcoding the workspace path?&lt;BR /&gt;- For option 2a: i build one wheel cotaining with all packages: is that fine?&lt;BR /&gt;- How do you keep interactive development in the workspace fast (no rebuild/redeploy after every code change)?&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2026 07:31:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/best-practice-for-using-multiple-local-python-packages-in/m-p/178414#M57541</guid>
      <dc:creator>a_user12</dc:creator>
      <dc:date>2026-12-02T07:31:43Z</dc:date>
    </item>
  </channel>
</rss>

