docs/v3/api-ref/python/prefect-deployments-steps-pull.mdx
prefect.deployments.steps.pullCore set of steps for specifying a Prefect project pull step.
set_working_directory <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/deployments/steps/pull.py#L24" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>set_working_directory(directory: str) -> dict[str, str]
Sets the working directory; works with both absolute and relative paths.
Args:
directory: the directory to set as the working directoryReturns:
directory key of the
absolute path of the directory that was setagit_clone <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/deployments/steps/pull.py#L50" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>agit_clone(repository: str, branch: Optional[str] = None, commit_sha: Optional[str] = None, include_submodules: bool = False, access_token: Optional[str] = None, credentials: Optional['Block'] = None, directories: Optional[list[str]] = None, clone_directory_name: Optional[str] = None) -> dict[str, str]
Asynchronously clones a git repository into the current working directory.
Args:
repository: the URL of the repository to clonebranch: the branch to clone; if not provided, the default branch will be usedcommit_sha: the commit SHA to clone; if not provided, the default branch will be usedinclude_submodules: whether to include git submodules when cloning the repositoryaccess_token: an access token to use for cloning the repository; if not provided
the repository will be cloned using the default git credentialscredentials: a GitHubCredentials, GitLabCredentials, or BitBucketCredentials block can be used to specify the
credentials to use for cloning the repository.clone_directory_name: the name of the local directory to clone into; if not provided,
the name will be inferred from the repository URL and branchReturns:
directory key of the new directory that was createdRaises:
subprocess.CalledProcessError: if the git clone command fails for any reasongit_clone <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/deployments/steps/pull.py#L104" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>git_clone(repository: str, branch: Optional[str] = None, commit_sha: Optional[str] = None, include_submodules: bool = False, access_token: Optional[str] = None, credentials: Optional['Block'] = None, directories: Optional[list[str]] = None, clone_directory_name: Optional[str] = None) -> dict[str, str]
Clones a git repository into the current working directory.
Args:
repository: the URL of the repository to clonebranch: the branch to clone; if not provided, the default branch will be usedcommit_sha: the commit SHA to clone; if not provided, the default branch will be usedinclude_submodules: whether to include git submodules when cloning the repositoryaccess_token: an access token to use for cloning the repository; if not provided
the repository will be cloned using the default git credentialscredentials: a GitHubCredentials, GitLabCredentials, or BitBucketCredentials block can be used to specify the
credentials to use for cloning the repository.directories: Specify directories you want to be included (uses git sparse-checkout)clone_directory_name: the name of the local directory to clone into; if not provided,
the name will be inferred from the repository URL and branchReturns:
directory key of the new directory that was createdRaises:
subprocess.CalledProcessError: if the git clone command fails for any reasonExamples:
Clone a public repository:
pull:
- prefect.deployments.steps.git_clone:
repository: https://github.com/PrefectHQ/prefect.git
Clone a branch of a public repository:
pull:
- prefect.deployments.steps.git_clone:
repository: https://github.com/PrefectHQ/prefect.git
branch: my-branch
Clone a private repository using a GitHubCredentials block:
pull:
- prefect.deployments.steps.git_clone:
repository: https://github.com/org/repo.git
credentials: "{{ prefect.blocks.github-credentials.my-github-credentials-block }}"
Clone a private repository using an access token:
pull:
- prefect.deployments.steps.git_clone:
repository: https://github.com/org/repo.git
access_token: "{{ prefect.blocks.secret.github-access-token }}" # Requires creation of a Secret block
Note that you will need to create a Secret block to store the
value of your git credentials. You can also store a username/password combo or token prefix (e.g. x-token-auth)
in your secret block. Refer to your git providers documentation for the correct authentication schema.
Clone a repository with submodules:
pull:
- prefect.deployments.steps.git_clone:
repository: https://github.com/org/repo.git
include_submodules: true
Clone a repository with an SSH key (note that the SSH key must be added to the worker before executing flows):
pull:
- prefect.deployments.steps.git_clone:
repository: [email protected]:org/repo.git
Clone a repository using sparse-checkout (allows specific folders of the repository to be checked out)
pull:
- prefect.deployments.steps.git_clone:
repository: https://github.com/org/repo.git
directories: ["dir_1", "dir_2", "prefect"]
Clone a repository with a custom directory name:
pull:
- prefect.deployments.steps.git_clone:
repository: https://github.com/org/repo.git
branch: dev
clone_directory_name: my-custom-name
pull_from_remote_storage <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/deployments/steps/pull.py#L226" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>pull_from_remote_storage(url: str, **settings: Any) -> dict[str, Any]
Pulls code from a remote storage location into the current working directory.
Works with protocols supported by fsspec.
Args:
url: the URL of the remote storage location. Should be a valid fsspec URL.
Some protocols may require an additional fsspec dependency to be installed.
Refer to the fsspec docs
for more details.**settings: any additional settings to pass the fsspec filesystem class.Returns:
directory key of the new directory that was createdExamples:
Pull code from a remote storage location:
pull:
- prefect.deployments.steps.pull_from_remote_storage:
url: s3://my-bucket/my-folder
Pull code from a remote storage location with additional settings:
pull:
- prefect.deployments.steps.pull_from_remote_storage:
url: s3://my-bucket/my-folder
key: {{ prefect.blocks.secret.my-aws-access-key }}}
secret: {{ prefect.blocks.secret.my-aws-secret-key }}}
pull_with_block <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/deployments/steps/pull.py#L268" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>pull_with_block(block_document_name: str, block_type_slug: str) -> dict[str, Any]
Pulls code using a block.
Args:
block_document_name: The name of the block document to useblock_type_slug: The slug of the type of block to use