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:ย 

Manage Project Dependencies with pyproject.toml

a_user12
Contributor

Dear Community!

I want to work in a serverless environment. I tried this code here a couple of weeks:

resources:
  pipelines:
    test_uv_etl:
      name: test_uv_etl
      catalog: ${var.catalog}
      schema: ${var.schema}
      serverless: true
      root_path: '../src/test_uv_etl'

      libraries:
        - glob:
            include: ../src/test_uv_etl/transformations/**

      environment:
        dependencies:
          - --editable ${workspace.file_path}

I really like it: it simply installs all libraries defined in the pyproject.toml. On top, it builds a wheel for the package specified in the pyproject.toml. I assume, that this also works for jobs.

Now, I saw this pretty new docu about serverless folders

Here the following code snippet is suggested:

resources:
  jobs:
    my_project_job:
      name: my-project-job
      environments:
        - environment_key: project
          spec:
            project_environment: ../pyproject.toml
      tasks:
        - task_key: main
          environment_key: project
          spark_python_task:
            python_file: ../src/main.py

I assume, that this also works for pipelines.

Pretty similar, but still not clear for me:

  • With --editable I shouldn't have any issues with cache. When I refer to the project environment directly as it is done in the second snippet: is it also cache-safe?
  • The first snippet also triggers a build (e.g. via hatchling): is that also trigger in the second option?
  • Finally: are the two approaches at the end the same? If not: what is the difference (I know that shared serverless is for the whole bundle, I mean difference in processing the pyproject.toml)?
 
0 REPLIES 0