Skip to main content

prefect.deployments.steps.pull

Core set of steps for specifying a Prefect project pull step.

Functions

set_working_directory

Sets the working directory; works with both absolute and relative paths. Args:
  • directory: the directory to set as the working directory
Returns:
  • a dictionary containing a directory key of the absolute path of the directory that was set

agit_clone

Asynchronously clones a git repository into the current working directory. Args:
  • repository: the URL of the repository to clone
  • branch: the branch to clone; if not provided, the default branch will be used
  • commit_sha: the commit SHA to clone; if not provided, the default branch will be used
  • include_submodules: whether to include git submodules when cloning the repository
  • access_token: an access token to use for cloning the repository; if not provided the repository will be cloned using the default git credentials
  • credentials: 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 branch
Returns:
  • a dictionary containing a directory key of the new directory that was created
Raises:
  • subprocess.CalledProcessError: if the git clone command fails for any reason

git_clone

Clones a git repository into the current working directory. Args:
  • repository: the URL of the repository to clone
  • branch: the branch to clone; if not provided, the default branch will be used
  • commit_sha: the commit SHA to clone; if not provided, the default branch will be used
  • include_submodules: whether to include git submodules when cloning the repository
  • access_token: an access token to use for cloning the repository; if not provided the repository will be cloned using the default git credentials
  • credentials: 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 branch
Returns:
  • a dictionary containing a directory key of the new directory that was created
Raises:
  • subprocess.CalledProcessError: if the git clone command fails for any reason
Examples: Clone a public repository:
Clone a branch of a public repository:
Clone a private repository using a GitHubCredentials block:
Clone a private repository using an access token:
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:
Clone a repository with an SSH key (note that the SSH key must be added to the worker before executing flows):
Clone a repository using sparse-checkout (allows specific folders of the repository to be checked out)
Clone a repository with a custom directory name:

pull_from_remote_storage

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:
  • a dictionary containing a directory key of the new directory that was created
Examples: Pull code from a remote storage location:
Pull code from a remote storage location with additional settings:

pull_with_block

Pulls code using a block. Args:
  • block_document_name: The name of the block document to use
  • block_type_slug: The slug of the type of block to use