snowpark build

Builds the Snowpark project as a .zip archive that can be used by deploy command. The archive is built using only the src directory specified in the project file.

Syntax

snow snowpark build
  --pypi-download <pypi_download>
  --check-anaconda-for-pypi-deps
  --package-native-libraries <package_native_libraries>
  --project <project_definition>
  --format <format>
  --verbose
  --debug
  --silent
Copy

Arguments

None

Options

--pypi-download [yes|no|ask]

Whether to download non-Anaconda packages from PyPi.

--check-anaconda-for-pypi-deps, -a

Whether to check if any of missing Anaconda packages dependencies can be imported directly from Anaconda. Valid values include: true, false, Default: true.

--package-native-libraries [yes|no|ask]

When using packages from PyPi, whether to allow native libraries.

-p, --project TEXT

Path where the Snowpark project resides. Defaults to current working directory.

--format [TABLE|JSON]

Specifies the output format.

--verbose, -v

Displays log entries for log levels info and higher.

--debug

Displays log entries for log levels debug and higher; debug logs contains additional information.

--silent

Turns off intermediate output to console.

--help

Displays the help text for this command.

Usage notes

  • The app.zip contains everything needed to run the functions and procedures in the project, apart from packages available through Snowflake Anaconda channel, which you can call directly from Snowflake.-

  • The command parses requirements.txt for packages available on Conda channel. This process results in creates two files in the project catalog: requirements.snowflake.txt and requirements.other.txt.

  • If you set the –pypi-download option to yes, or if the value is ask (default) and user responds positively to prompt, the command downloads dependencies from requirements.other.txt. Downloaded dependencies are then zipped to a file called app.zip, together with project source code (specified by the src field in the snowflake.yaml file.

  • You can use the --no-check-anaconda-for-pypi-deps option to include all the required dependencies in the app.zip file, even those available in Snowflake Anaconda channel. The dependencies aren’t downloaded from Anaconda, but from PyPi.

  • The --package-native-libraries option checks whether any of the packages downloaded from PyPi are using native dependencies, which can cause problems as Snowpark currently supports only native dependencies for packages taken from Conda channel

  • By default, the command looks for the snowflake.yml file in the current directory. Alternatively, you can specify a different path with the --project option.

Examples

  • Build a project located in the current directory:

    snow snowpark build
    
    Copy
    Build done. Artifact path: /Path/to/current/dir/project_dir/app.zip
    
  • Build a project located in a different directory:

    ls
    
    Copy
    project_dir    some_other_dir    some_file.txt
    
    snow snowpark build -p project_dir
    
    Copy
    Build done. Artifact path: /Path/to/current/dir/project_dir/app.zip
    
  • Build a project in a directory with no snowflake.yml project definition:

    ls
    
    Copy
    project_dir    some_other_dir    some_file.txt
    
    snow snowpark build
    
    Copy
    ╭─ Error ──────────────────────────────────────────────────────────╮
    │ Cannot find project definition (snowflake.yml). Please provide a |
    |path to the project or run this command in a valid                |
    |project directory.                                                |                                                          │                                                                  |
    ╰──────────────────────────────────────────────────────────────────╯
    
  • Build a project with native libraries not in Anaconda:

    snow snowpark build --pypi-download
    
    Copy
    WARNING! Some packages appear to have native libraries!
    Continue with package installation? [y/N]:  y
    Build done. Artifact path: /Path/to/current/dir/project_dir/app.zip
    
  • Build a project and include all dependencies:

    snow snowpark build --no-check-anaconda-for-pypi-deps
    
    Copy
    Build done. Artifact path: /Path/to/current/dir/project_dir/app.zip