Skip to main content

Python package to make it easy to develop beautiful, performant streamlit-in-snowflake apps

Project description

sisx

A command-line interface (CLI) for managing Streamlit applications in Snowflake.

Overview

sisx provides a set of commands to simplify the workflow for developing, deploying, and managing Streamlit applications on Snowflake. It handles common tasks like deploying applications, creating preview versions, and cleaning up old deployments.

Installation

uv tool install sisx

# Or

pip install sisx

If you don't want to actually install the tool permanently, you can just run uvx sisx <any command> to use it.

CLI

sisx CLI tool for Streamlit in Snowflake applications

Usage:

$ [OPTIONS] COMMAND [ARGS]...

Options:

  • --version: Show the version and exit.
  • --install-completion: Install completion for the current shell.
  • --show-completion: Show completion for the current shell, to copy it or customize the installation.
  • --help: Show this message and exit.

Commands:

  • deploy: Deploy a Streamlit application using the...
  • deploy-preview: Deploy a preview version of a Streamlit...
  • drop: Drop a Streamlit application from Snowflake.
  • drop-preview: Drop a preview version of a Streamlit...
  • new: Create a new Streamlit in Snowflake...
  • run: Run a Streamlit application locally.
  • test: Run the tests for the CLI.
  • cleanup: Drop multiple Streamlit applications...
  • new-connection: Add a new Snowflake connection configuration.

deploy

Deploy a Streamlit application using the Snowflake CLI.

This command wraps the snow streamlit deploy command, providing a convenient interface for deploying Streamlit applications to Snowflake.

By default, opens the app in your browser. Use --no-open to disable.

Usage:

$ deploy [OPTIONS]

Options:

  • -v, --verbose: Enable verbose output
  • -r, --replace: Replace the Streamlit app if it already exists
  • --no-open: Don't open the deployed Streamlit app in a browser
  • -c, --connection TEXT: Connection to use for deployment
  • --query-warehouse TEXT: Override the query warehouse to use
  • --app-warehouse TEXT: Override the app warehouse to use
  • --debug: Enable debug output
  • --help: Show this message and exit.

deploy-preview

Deploy a preview version of a Streamlit application.

This command adds 'preview_' to the beginning of the app name and also adds 'PREVIEW: ' to the app title, making it easy to identify preview deployments.

By default, opens the app in your browser. Use --no-open to disable.

Usage:

$ deploy-preview [OPTIONS]

Options:

  • --preview-name TEXT: Name of the preview app
  • -v, --verbose: Enable verbose output
  • -r, --replace: Replace the Streamlit app if it already exists
  • --no-open: Don't open the deployed Streamlit app in a browser
  • -c, --connection TEXT: Connection to use for deployment
  • --debug: Enable debug output
  • --help: Show this message and exit.

drop

Drop a Streamlit application from Snowflake.

This command will remove the Streamlit app. If --drop-spcs is specified, it will also clean up any associated SPCS services.

Usage:

$ drop [OPTIONS]

Options:

  • -v, --verbose: Enable verbose output
  • -c, --connection TEXT: Connection to use for deployment
  • -f, --force: Force drop without confirmation
  • --drop-spcs: Also drop any associated SPCS services
  • --help: Show this message and exit.

drop-preview

Drop a preview version of a Streamlit application from Snowflake.

This command will remove the preview Streamlit app (with prefix 'preview_'). If --drop-spcs is specified, it will also clean up any associated SPCS services.

Usage:

$ drop-preview [OPTIONS]

Options:

  • -v, --verbose: Enable verbose output
  • -c, --connection TEXT: Connection to use for deployment
  • -f, --force: Force drop without confirmation
  • --drop-spcs: Also drop any associated SPCS services
  • --help: Show this message and exit.

new

Create a new Streamlit in Snowflake application using a template.

This command uses snow init to generate a new app from the appropriate template based on your compute choice (warehouse or compute pool).

All configuration can be provided via command line flags for automation, or will be prompted for interactively if not provided.

Usage:

$ new [OPTIONS] [OUTPUT_DIR]

Arguments:

  • [OUTPUT_DIR]: Directory where the new app will be created

Options:

  • -f, --force: Force creation of app, overwriting existing directory
  • -c, --connection TEXT: Name of the connection to use
  • -v, --verbose: Enable verbose output
  • -t, --compute-type TEXT: Type of compute to use: 'warehouse' or 'compute_pool' [default: warehouse]
  • -q, --query-warehouse TEXT: Warehouse to use for queries (when using warehouse compute type)
  • -a, --app-warehouse TEXT: Warehouse to use for running the app (when using warehouse compute type)
  • --compute-pool TEXT: Compute pool to use (when using compute_pool compute type)
  • --stage TEXT: Stage to use for app artifacts
  • --database TEXT: Database to use for the app
  • --schema TEXT: Schema to use for the app
  • --role TEXT: Role to use for the app
  • --debug: Enable debug output
  • --help: Show this message and exit.

run

Run a Streamlit application locally.

This command wraps the streamlit run command, providing a convenient interface for running Streamlit applications during development.

Usage:

$ run [OPTIONS] [APP_PATH]

Arguments:

  • [APP_PATH]: Path to the Streamlit app file to run [default: streamlit_app.py]

Options:

  • --help: Show this message and exit.

test

Run the tests for the CLI.

Usage:

$ test [OPTIONS]

Options:

  • --help: Show this message and exit.

cleanup

Drop multiple Streamlit applications containing the specified filter text.

If no filter is provided, uses the text 'preview_' as the filter. This is useful for cleaning up development apps in your account.

Usage:

$ cleanup [OPTIONS] [FILTER_TEXT]

Arguments:

  • [FILTER_TEXT]: Text to filter apps by (uses preview_ if not specified)

Options:

  • -v, --verbose: Enable verbose output
  • -c, --connection TEXT: Connection to use for deployment
  • -f, --force: Force cleanup without confirmation
  • --drop-spcs: Also drop any associated SPCS services
  • --help: Show this message and exit.

new-connection

Add a new Snowflake connection configuration.

This command wraps the snow connection add command, providing a convenient interface for adding new Snowflake connections.

Usage:

$ new-connection [OPTIONS]

Options:

  • -n, --connection-name TEXT: Name of the new connection.
  • -a, --account, --accountname TEXT: Account name to use when authenticating with Snowflake.
  • -u, --user, --username TEXT: Username to connect to Snowflake.
  • -p, --password TEXT: Snowflake password.
  • -r, --role, --rolename TEXT: Role to use on Snowflake.
  • -w, --warehouse TEXT: Warehouse to use on Snowflake.
  • -d, --database, --dbname TEXT: Database to use on Snowflake.
  • -s, --schema, --schemaname TEXT: Schema to use on Snowflake.
  • -h, --host TEXT: Host name the connection attempts to connect to Snowflake.
  • -P, --port INTEGER: Port to communicate with on the host.
  • -R, --region TEXT: Region name if not the default Snowflake deployment.
  • -A, --authenticator TEXT: Chosen authenticator, if other than password-based
  • -k, --private-key, --private-key-file, --private-key-path TEXT: Path to file containing private key
  • -t, --token-file-path TEXT: Path to file with an OAuth token that should be used when connecting to Snowflake
  • --default: If provided the connection will be configured as default connection.
  • -v, --verbose: Enable verbose output
  • --debug: Enable debug output
  • --help: Show this message and exit.

Configuration

sisx uses the snowflake.yml file in your project directory for configuration. This defines your app's name, database, schema, and other settings.

Example snowflake.yml for warehouse compute type:

definition_version: "2"
env:
  name: "my_app"
  query_warehouse: "compute_wh"
  app_warehouse: "SYSTEM$STREAMLIT_NOTEBOOK_WH"
  schema: "public"
  database: "streamlit"
  role: "ACCOUNTADMIN"
  preview_database: "streamlit"
  preview_schema: "public"
  preview_role: "ACCOUNTADMIN"
  stage: "streamlit_stage"
entities:
  streamlit_app:
    type: streamlit
    identifier:
      name: <% ctx.env.name %>
      schema: <% ctx.env.schema %>
      database: <% ctx.env.database %>
    stage: <% ctx.env.stage %>
    query_warehouse: <% ctx.env.query_warehouse %>
    main_file: streamlit_app.py
    pages_dir: pages/
    artifacts:
      - "**/*.py"
      - "*.yml"

Example snowflake.yml for compute pool type:

definition_version: "2"
env:
  name: "my_app"
  compute_pool: "streamlit_compute_pool"
  schema: "public"
  database: "streamlit"
  preview_database: "streamlit"
  preview_schema: "public"
  preview_role: "ACCOUNTADMIN"
  stage: "streamlit_stage"
entities:
  streamlit_app:
    type: streamlit
    identifier:
      name: <% ctx.env.name %>
      schema: <% ctx.env.schema %>
      database: <% ctx.env.database %>
    stage: <% ctx.env.stage %>
    compute_pool: <% ctx.env.compute_pool %>
    main_file: streamlit_app.py
    pages_dir: pages/
    artifacts:
      - "**/*.py"
      - "requirements.txt"
      - "*.yml"

Version Information

You can check the version of sisx by running:

uvx sisx --version

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sisx-0.1.8.tar.gz (219.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sisx-0.1.8-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file sisx-0.1.8.tar.gz.

File metadata

  • Download URL: sisx-0.1.8.tar.gz
  • Upload date:
  • Size: 219.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.18

File hashes

Hashes for sisx-0.1.8.tar.gz
Algorithm Hash digest
SHA256 59304a9441e7a66274f17fb7fb25376ef48f89bffb3b21c56c1d35b27e866498
MD5 2765612021a7fd4b838a6fdf0afac913
BLAKE2b-256 74285ecd3b55dab40bdafb0ec0e7600bf92fde7a017da2f0aaa8bfb23cba0029

See more details on using hashes here.

File details

Details for the file sisx-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: sisx-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 23.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.18

File hashes

Hashes for sisx-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 46d3f486255750ab163e8b02787da86b68c2b315512b863e2018fd790ffbd7f7
MD5 b593000cdd210c682cf3d96c4b87de4a
BLAKE2b-256 4c3c921b8c7445c51a8e95c9d540a0ac55fce7ba1d87aa860babdc09165a37f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page