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
43 changes: 43 additions & 0 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow will build and test the Rust code in this repository. There are
# separate workflows for testing the python portion of the code base.
#
# This file is *not* generated from automation and is manually maintained.
#
name: "[tower] Test python"

on:
pull_request:
push:
branches:
- '*'
tags-ignore:
- '**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5

- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6

- name: Install dependencies
if: github.ref_name != 'main'
run: uv sync --all-extras

- name: Run tests
if: github.ref_name != 'main'
run: uv run -m pytest --tb=short --disable-warnings
16 changes: 8 additions & 8 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.9"
version = "0.3.10"
description = "Tower is the best way to host Python data apps in production"
rust-version = "1.77"
authors = ["Brad Heller <brad@tower.dev>"]
Expand Down
8 changes: 6 additions & 2 deletions 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.9"
version = "0.3.10"
description = "Tower CLI and runtime environment for Tower."
authors = [{ name = "Tower Computing Inc.", email = "brad@tower.dev" }]
readme = "README.md"
Expand Down Expand Up @@ -45,7 +45,11 @@ dependencies = [
ai = ["huggingface-hub>=0.30.2", "ollama>=0.4.7"]
iceberg = ["polars>=1.27.1", "pyarrow>=19.0.1", "pyiceberg>=0.9.0"]
all = ["tower[ai,iceberg]"]
dev = ["openapi-python-client>=0.12.1"]
dev = [
"openapi-python-client>=0.12.1",
"pytest>=8.3.5",
"pytest-httpx>=0.35.0",
]

[tool.maturin]
bindings = "bin"
Expand Down
6 changes: 5 additions & 1 deletion scripts/generate-python-api-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@
TOWER_OPENAPI_URL="https://api.tower.dev/v1/openapi-3.0.yaml"
OUTPUT_DIR="src/tower"

cd ${OUTPUT_DIR} && uv run openapi-python-client update --meta none \
# We have to remove the previously-generated source in case some things were
# removed, etc.
rm -rf ${OUTPUT_DIR}/tower_api_client

cd ${OUTPUT_DIR} && uv run openapi-python-client generate --meta none \
--url ${TOWER_OPENAPI_URL}
12 changes: 8 additions & 4 deletions src/tower/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
)
from .tower_api_client.models.error_model import ErrorModel

# WAIT_TIMEOUT is the amount of time to wait between requests when polling the
# Tower API.
WAIT_TIMEOUT = 2

# DEFAULT_TOWER_URL is the default tower URL to use when connecting back to
# Tower.
DEFAULT_TOWER_URL = "https://api.tower.dev"
Expand Down Expand Up @@ -43,7 +47,7 @@ def _env_client(ctx: TowerContext) -> AuthenticatedClient:


def run_app(
name: str,
slug: str,
environment: Optional[str] = None,
parameters: Optional[Dict[str, str]] = None,
) -> Run:
Expand All @@ -68,7 +72,7 @@ def run_app(
)

output: Optional[Union[ErrorModel, RunAppResponse]] = run_app_api.sync(
name=name, client=client, json_body=input_body
slug=slug, client=client, body=input_body
)

if output is None:
Expand All @@ -92,7 +96,7 @@ def wait_for_run(run: Run) -> None:

while True:
output: Optional[Union[DescribeRunResponse, ErrorModel]] = describe_run_api.sync(
name=run.app_name,
slug=run.app_slug,
seq=run.number,
client=client
)
Expand All @@ -114,4 +118,4 @@ def wait_for_run(run: Run) -> None:
elif desc.status == "errored":
return
else:
time.sleep(2)
time.sleep(WAIT_TIMEOUT)
3 changes: 2 additions & 1 deletion src/tower/tower_api_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" A client library for accessing Tower API """
"""A client library for accessing Tower API"""

from .client import AuthenticatedClient, Client

__all__ = (
Expand Down
2 changes: 1 addition & 1 deletion src/tower/tower_api_client/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
""" Contains methods for accessing the API """
"""Contains methods for accessing the API"""
1 change: 1 addition & 0 deletions src/tower/tower_api_client/api/default/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Contains endpoint functions for accessing the API"""
Loading
Loading