Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resolver = "2"

[workspace.package]
edition = "2021"
version = "0.3.40"
version = "0.3.41"
description = "Tower is the best way to host Python data apps in production"
rust-version = "1.81"
authors = ["Brad Heller <brad@tower.dev>"]
Expand Down
8 changes: 7 additions & 1 deletion crates/tower-cmd/src/apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ pub fn apps_cmd() -> Command {
Command::new("apps")
.about("Manage the apps in your current Tower account")
.arg_required_else_help(true)
.subcommand(Command::new("list").about("List all of your apps`"))
.subcommand(Command::new("list").about("List all of your apps"))
.subcommand(
Command::new("show")
.allow_external_subcommands(true)
.override_usage("tower apps show [OPTIONS] <APP_NAME>")
.after_help("Example: tower apps show hello-world")
.about("Show the details about an app in Tower"),
)
.subcommand(
Command::new("logs")
.allow_external_subcommands(true)
.override_usage("tower apps logs [OPTIONS] <APP_NAME>#<RUN_NUMBER>")
.after_help("Example: tower apps logs hello-world#11")
.about("Get the logs from a previous Tower app run"),
)
.subcommand(
Expand All @@ -42,6 +46,8 @@ pub fn apps_cmd() -> Command {
.subcommand(
Command::new("delete")
.allow_external_subcommands(true)
.override_usage("tower apps delete [OPTIONS] <APP_NAME>")
.after_help("Example: tower apps delete hello-world")
.about("Delete an app in Tower"),
)
}
Expand Down
4 changes: 4 additions & 0 deletions crates/tower-cmd/src/schedules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ pub fn schedules_cmd() -> Command {
.subcommand(
Command::new("delete")
.allow_external_subcommands(true)
.override_usage("tower schedules delete [OPTIONS] <SCHEDULE_ID>")
.after_help("Example: tower schedules delete 123")
.about("Delete a schedule"),
)
.subcommand(
Expand All @@ -92,6 +94,8 @@ pub fn schedules_cmd() -> Command {
.action(clap::ArgAction::Append),
)
.allow_external_subcommands(true)
.override_usage("tower schedules update [OPTIONS] <SCHEDULE_ID>")
.after_help("Example: tower schedules update 123 --cron \"*/15 * * * *\"")
.about("Update an existing schedule"),
)
}
Expand Down
8 changes: 8 additions & 0 deletions crates/tower-cmd/src/secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub fn secrets_cmd() -> Command {
Arg::new("show")
.short('s')
.long("show")
.help("Show secrets in plain text")
.action(clap::ArgAction::SetTrue),
)
.arg(
Expand All @@ -27,12 +28,14 @@ pub fn secrets_cmd() -> Command {
.long("environment")
.default_value("default")
.value_parser(value_parser!(String))
.help("List secrets in this environment")
.action(clap::ArgAction::Set),
)
.arg(
Arg::new("all")
.short('a')
.long("all")
.help("List secrets across all environments")
.action(clap::ArgAction::SetTrue),
)
.about("List all of your secrets"),
Expand All @@ -45,6 +48,7 @@ pub fn secrets_cmd() -> Command {
.long("name")
.value_parser(value_parser!(String))
.required(true)
.help("Secret name to create")
.action(clap::ArgAction::Set),
)
.arg(
Expand All @@ -53,6 +57,7 @@ pub fn secrets_cmd() -> Command {
.long("environment")
.default_value("default")
.value_parser(value_parser!(String))
.help("Environment to store the secret in")
.action(clap::ArgAction::Set),
)
.arg(
Expand All @@ -61,13 +66,16 @@ pub fn secrets_cmd() -> Command {
.long("value")
.value_parser(value_parser!(String))
.required(true)
.help("Secret value to store")
.action(clap::ArgAction::Set),
)
.about("Create a new secret in your Tower account"),
)
.subcommand(
Command::new("delete")
.allow_external_subcommands(true)
.override_usage("tower secrets delete [OPTIONS] <SECRET_NAME>")
.after_help("Example: tower secrets delete MY_API_KEY")
.about("Delete a secret in Tower"),
)
}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "tower"
version = "0.3.40"
version = "0.3.41"
description = "Tower CLI and runtime environment for Tower."
authors = [{ name = "Tower Computing Inc.", email = "brad@tower.dev" }]
readme = "README.md"
Expand Down
12 changes: 12 additions & 0 deletions src/tower/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,25 @@
wait_for_runs,
)

from ._utils import (
param,
parameter,
secret,
)


from ._features import override_get_attr, get_available_features, is_feature_enabled

if TYPE_CHECKING:
from ._tables import tables as tables
from ._llms import llms as llms
from ._dbt import dbt as dbt

#
# Sub-packages to expose
#
from . import info


def __getattr__(name: str):
"""
Expand Down
45 changes: 45 additions & 0 deletions src/tower/_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
def secret(name: str, default: str = ""):
"""
Retrieve a secret value from environment variables.

Args:
name (str): The name of the secret (environment variable).
default (str, optional): The default value to return if the secret is not found. Defaults to "".

Returns:
str: The value of the secret or the default value.
"""
import os

return os.getenv(name, default)


def param(name: str, default: str = ""):
"""
Retrieve a parameter value from this invocation. In this implementation,
it fetches the value from environment variables.

Args:
name (str): The name of the parameter (environment variable).
default (str, optional): The default value to return if the parameter is not found. Defaults to "".

Returns:
str: The value of the parameter or the default value.
"""
import os

return os.getenv(name, default)


def parameter(name: str, default: str = ""):
"""
Alias for param function to retrieve a parameter value from environment variables.

Args:
name (str): The name of the parameter (environment variable).
default (str, optional): The default value to return if the parameter is not found. Defaults to "".

Returns:
str: The value of the parameter or the default value.
"""
return param(name, default)
Loading