Configure Serverless Job Environments Using pyproject.toml
Serverless notebook and Python script tasks can now use a pyproject.toml file to define their job environment and manage project dependencies.
What changed
Databricks introduced support for standard pyproject.toml files to define execution environments for serverless job tasks. This feature standardizes dependency management across serverless notebook and Python script tasks.
Para que serve
Imagine you maintain a structured Python data project and want to run serverless tasks without having to scatter %pip install commands across notebooks or manually handle wheel installations. With this capability, you can:
- Standardize job dependencies using Python's modern packaging specification (
pyproject.toml). - Set up the task environment through the Jobs UI, Jobs API, or Databricks Asset Bundles.
- Isolate script and notebook dependencies across project-scoped serverless executions.
Como usar
Define your dependencies within your repository's configuration file:
[project]
name = "meu_projeto_dados"
version = "0.1.0"
dependencies = [
"pandas>=2.0.0",
"polars>=1.0.0",
"pydantic>=2.0.0"
]
O que acontece nesse código:
- The file declares metadata and required package versions for your project.
- The serverless compute layer parses the file when starting the task, preparing dependencies before script execution.
You can then select or point to this project environment from the Jobs UI, pass it through the Jobs API, or reference it in an Asset Bundle.
Limitações e requisitos
- Currently in Beta.
- Requires workspace administrators to turn on "Project-Scoped Shared Compute" from the workspace Previews page.
- Limited to notebook and Python script tasks running on serverless compute.
Como aplicar num pipeline
Within a Databricks Asset Bundle pipeline, you keep a single pyproject.toml file in source control. Both bronze ingest scripts and silver transformation notebooks reference this definition, ensuring consistent package versions throughout your entire execution workflow.
- serverless
- jobs
- python
- pyproject.toml
- asset bundles
Serverless job environments from pyproject.toml (Beta)
Summary and explanation generated by AI from the official release note. When in doubt, the platform's official documentation prevails.
Related
- DatabricksPublic Preview
DataFrame caching arrives on Databricks serverless compute
Now in Public Preview: call df.cache() and df.persist() on Databricks serverless compute to materialize expensive results into snapshots and speed up session reuses.
serverless compute · pyspark - DatabricksBeta
Lakeflow Connect adds managed connector for Box audit logs
Databricks released the Box Audit Logs managed connector in Beta for Lakeflow Connect, enabling direct ingestion of enterprise audit events into Unity Catalog.
lakeflow connect · ingestion - DatabricksBeta
Share serverless compute among notebooks in Asset Bundles
Allow notebooks and files in the same Asset Bundle to share serverless compute and an environment defined in the pyproject.toml file.
asset bundles · serverless