Skip to content

Add configurable base directory for included bundle files - #22769

Draft
Strainy wants to merge 1 commit into
PrefectHQ:mainfrom
Strainy:jstrain/include-files-base-dir
Draft

Add configurable base directory for included bundle files#22769
Strainy wants to merge 1 commit into
PrefectHQ:mainfrom
Strainy:jstrain/include-files-base-dir

Conversation

@Strainy

@Strainy Strainy commented Aug 10, 2026

Copy link
Copy Markdown

Summary

this PR adds an include_files_base_dir option to infrastructure decorators so bundle file patterns can be resolved outside the directory containing the flow file.

@docker(
    work_pool="my-pool",
    include_files=["config.yaml", "data/"],
    include_files_base_dir=Path("/my/custom/base-dir"),
)
@flow
def my_flow():
    ...

The option accepts a string or pathlib.Path. Omitting it preserves the existing behavior of resolving patterns relative to the flow file.

Implementation details

create_bundle_for_flow_run previously always derived the collection root from inspect.getfile(flow.fn). It now uses the configured base directory when present, including for archive-relative paths and .prefectignore filtering.

The option is propagated through InfrastructureBoundFlow, bind_flow_to_infrastructure, and with_options, and is exposed by the Docker, ECS, Azure Container Instance, Cloud Run, Vertex AI, and Kubernetes decorators.

User documentation and generated API references are updated for the new option.

Validation

  • uv run pytest tests/_experimental/bundles/test_bundles.py -q --tb=short (14 passed)
  • uv run pytest tests/_experimental/bundles/test_include_files_integration.py -q --tb=short (15 passed, 4 optional-AWS skips)
  • uv run pytest tests/test_infrastructure_bound_flow.py -k 'include_files' -q --tb=short (10 passed)
  • focused decorator tests for Docker, AWS, Azure, GCP, and Kubernetes (6 passed)
  • Ruff formatting and import/error checks
  • codespell and git diff --check

@github-actions github-actions Bot added the docs label Aug 10, 2026
@codspeed-hq

codspeed-hq Bot commented Aug 10, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 8 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing Strainy:jstrain/include-files-base-dir (cd11518) with main (40a34ba)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant