Skip to content

Commit e22a31f

Browse files
authored
Merge pull request #38 from tower/develop
Production deployment
2 parents fe7e234 + 9dc36a8 commit e22a31f

186 files changed

Lines changed: 7883 additions & 4165 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test-python.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This workflow will build and test the Rust code in this repository. There are
2+
# separate workflows for testing the python portion of the code base.
3+
#
4+
# This file is *not* generated from automation and is manually maintained.
5+
#
6+
name: "[tower] Test python"
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- '*'
13+
tags-ignore:
14+
- '**'
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
test:
22+
runs-on: ${{ matrix.os }}
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
os: [ubuntu-latest, windows-latest]
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
34+
- name: Install the latest version of uv
35+
uses: astral-sh/setup-uv@v6
36+
37+
- name: Install dependencies
38+
if: github.ref_name != 'main'
39+
run: uv sync --all-extras
40+
41+
- name: Run tests
42+
if: github.ref_name != 'main'
43+
run: uv run -m pytest --tb=short --disable-warnings

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ resolver = "2"
44

55
[workspace.package]
66
edition = "2021"
7-
version = "0.3.9"
7+
version = "0.3.10"
88
description = "Tower is the best way to host Python data apps in production"
99
rust-version = "1.77"
1010
authors = ["Brad Heller <brad@tower.dev>"]

pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "maturin"
44

55
[project]
66
name = "tower"
7-
version = "0.3.9"
7+
version = "0.3.10"
88
description = "Tower CLI and runtime environment for Tower."
99
authors = [{ name = "Tower Computing Inc.", email = "brad@tower.dev" }]
1010
readme = "README.md"
@@ -45,7 +45,11 @@ dependencies = [
4545
ai = ["huggingface-hub>=0.30.2", "ollama>=0.4.7"]
4646
iceberg = ["polars>=1.27.1", "pyarrow>=19.0.1", "pyiceberg>=0.9.0"]
4747
all = ["tower[ai,iceberg]"]
48-
dev = ["openapi-python-client>=0.12.1"]
48+
dev = [
49+
"openapi-python-client>=0.12.1",
50+
"pytest>=8.3.5",
51+
"pytest-httpx>=0.35.0",
52+
]
4953

5054
[tool.maturin]
5155
bindings = "bin"

scripts/generate-python-api-client.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@
66
TOWER_OPENAPI_URL="https://api.tower.dev/v1/openapi-3.0.yaml"
77
OUTPUT_DIR="src/tower"
88

9-
cd ${OUTPUT_DIR} && uv run openapi-python-client update --meta none \
9+
# We have to remove the previously-generated source in case some things were
10+
# removed, etc.
11+
rm -rf ${OUTPUT_DIR}/tower_api_client
12+
13+
cd ${OUTPUT_DIR} && uv run openapi-python-client generate --meta none \
1014
--url ${TOWER_OPENAPI_URL}

src/tower/_client.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
)
1616
from .tower_api_client.models.error_model import ErrorModel
1717

18+
# WAIT_TIMEOUT is the amount of time to wait between requests when polling the
19+
# Tower API.
20+
WAIT_TIMEOUT = 2
21+
1822
# DEFAULT_TOWER_URL is the default tower URL to use when connecting back to
1923
# Tower.
2024
DEFAULT_TOWER_URL = "https://api.tower.dev"
@@ -43,7 +47,7 @@ def _env_client(ctx: TowerContext) -> AuthenticatedClient:
4347

4448

4549
def run_app(
46-
name: str,
50+
slug: str,
4751
environment: Optional[str] = None,
4852
parameters: Optional[Dict[str, str]] = None,
4953
) -> Run:
@@ -68,7 +72,7 @@ def run_app(
6872
)
6973

7074
output: Optional[Union[ErrorModel, RunAppResponse]] = run_app_api.sync(
71-
name=name, client=client, json_body=input_body
75+
slug=slug, client=client, body=input_body
7276
)
7377

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

9397
while True:
9498
output: Optional[Union[DescribeRunResponse, ErrorModel]] = describe_run_api.sync(
95-
name=run.app_name,
99+
slug=run.app_slug,
96100
seq=run.number,
97101
client=client
98102
)
@@ -114,4 +118,4 @@ def wait_for_run(run: Run) -> None:
114118
elif desc.status == "errored":
115119
return
116120
else:
117-
time.sleep(2)
121+
time.sleep(WAIT_TIMEOUT)

src/tower/tower_api_client/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
""" A client library for accessing Tower API """
1+
"""A client library for accessing Tower API"""
2+
23
from .client import AuthenticatedClient, Client
34

45
__all__ = (
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
""" Contains methods for accessing the API """
1+
"""Contains methods for accessing the API"""
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Contains endpoint functions for accessing the API"""

0 commit comments

Comments
 (0)