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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 9 additions & 11 deletions .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ on:
plan:
required: true
type: string
workflow_dispatch:
pull_request:
paths:
# When we change pyproject.toml, we want to ensure that the maturin builds still work.
- pyproject.toml
# And when we change this workflow itself...
- .github/workflows/build-binaries.yml
paths-ignore:
- '**.md'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -219,10 +217,6 @@ jobs:
# see https://github.com/astral-sh/ruff/issues/3791
# and https://github.com/gnzlbg/jemallocator/issues/170#issuecomment-1503228963
maturin_docker_options: -e JEMALLOC_SYS_WITH_LG_PAGE=16
- target: armv7-unknown-linux-gnueabihf
arch: armv7
- target: arm-unknown-linux-musleabihf
arch: arm

steps:
- uses: actions/checkout@v4.2.2
Expand All @@ -240,6 +234,7 @@ jobs:
docker-options: ${{ matrix.platform.maturin_docker_options }}
args: --release --locked --out dist
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
# Set the CFLAGS for the aarch64 target, defining the ARM architecture
# for the ring crate's build script. This is a workaround for the
# issue where the ring crate's build script is not able to detect the
Expand All @@ -250,14 +245,17 @@ jobs:
name: Test wheel
with:
arch: ${{ matrix.platform.arch == 'arm' && 'armv6' || matrix.platform.arch }}
distro: ${{ matrix.platform.arch == 'arm' && 'bullseye' || 'ubuntu22.04' }}
distro: ${{ matrix.platform.arch == 'arm' && 'bookworm' || 'ubuntu22.04' }}
githubToken: ${{ github.token }}
install: |
apt-get update
apt-get install -y --no-install-recommends python3 python3-pip python3-venv python3-dev cargo libffi-dev
pip3 install -U pip
# Create and use a virtual environment to avoid the externally-managed-environment error
run: |
# Workaround for QEMU bug when emulating 32-bit on 64-bit hosts
# See: https://github.com/docker/buildx/issues/395
# Use /tmp for CARGO_HOME (often tmpfs, which avoids the QEMU filesystem bug)
export CARGO_HOME=/tmp/cargo-home
python3 -m venv /tmp/venv
. /tmp/venv/bin/activate
pip3 install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ pytest.ini

# from nix builds
/result

# wheel build artifacts
*.data/
7 changes: 7 additions & 0 deletions crates/tower-uv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,13 @@ impl Uv {
.arg("install")
.arg("-r")
.arg(cwd.join("requirements.txt"))
// setuptools 82 removed pkg_resources, but many legacy packages
// still import it without declaring the dependency. Let's always install
// a version that includes pkg_resources for requirements.txt, on the
// basis that requirements.txt projects are probably not using the latest
// and greatest deps (then they'd likely be using pyproject.toml anyway)
// https://github.com/pypa/setuptools/issues/5174
.arg("setuptools<82")
.envs(env_vars);

#[cfg(unix)]
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version = "0.3.46"
description = "Tower CLI and runtime environment for Tower."
authors = [{ name = "Tower Computing Inc.", email = "brad@tower.dev" }]
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.10"
license = { file = "LICENSE" }
keywords = [
"automation",
Expand All @@ -25,7 +25,6 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand Down Expand Up @@ -96,7 +95,7 @@ dev = [
{ include-group = "test" },
"black==24.10.0",
"mypy==1.13.0",
"openapi-python-client==0.24.3",
"openapi-python-client==0.28.1",
"pre-commit==4.0.1",
"pyiceberg[sql-sqlite]==0.9.1",
]
39 changes: 20 additions & 19 deletions src/tower/tower_api_client/api/default/acknowledge_alert.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from http import HTTPStatus
from typing import Any, Optional, Union
from typing import Any
from urllib.parse import quote

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.acknowledge_alert_response import AcknowledgeAlertResponse
from ...models.error_model import ErrorModel
from ...types import Response


Expand All @@ -15,29 +16,29 @@ def _get_kwargs(
_kwargs: dict[str, Any] = {
"method": "post",
"url": "/alerts/{alert_seq}/acknowledge".format(
alert_seq=alert_seq,
alert_seq=quote(str(alert_seq), safe=""),
),
}

return _kwargs


def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[AcknowledgeAlertResponse]:
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> AcknowledgeAlertResponse | ErrorModel:
if response.status_code == 200:
response_200 = AcknowledgeAlertResponse.from_dict(response.json())

return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None

response_default = ErrorModel.from_dict(response.json())

return response_default


def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[AcknowledgeAlertResponse]:
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Response[AcknowledgeAlertResponse | ErrorModel]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
Expand All @@ -50,7 +51,7 @@ def sync_detailed(
alert_seq: int,
*,
client: AuthenticatedClient,
) -> Response[AcknowledgeAlertResponse]:
) -> Response[AcknowledgeAlertResponse | ErrorModel]:
"""Acknowledge alert

Mark an alert as acknowledged
Expand All @@ -63,7 +64,7 @@ def sync_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[AcknowledgeAlertResponse]
Response[AcknowledgeAlertResponse | ErrorModel]
"""

kwargs = _get_kwargs(
Expand All @@ -81,7 +82,7 @@ def sync(
alert_seq: int,
*,
client: AuthenticatedClient,
) -> Optional[AcknowledgeAlertResponse]:
) -> AcknowledgeAlertResponse | ErrorModel | None:
"""Acknowledge alert

Mark an alert as acknowledged
Expand All @@ -94,7 +95,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
AcknowledgeAlertResponse
AcknowledgeAlertResponse | ErrorModel
"""

return sync_detailed(
Expand All @@ -107,7 +108,7 @@ async def asyncio_detailed(
alert_seq: int,
*,
client: AuthenticatedClient,
) -> Response[AcknowledgeAlertResponse]:
) -> Response[AcknowledgeAlertResponse | ErrorModel]:
"""Acknowledge alert

Mark an alert as acknowledged
Expand All @@ -120,7 +121,7 @@ async def asyncio_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[AcknowledgeAlertResponse]
Response[AcknowledgeAlertResponse | ErrorModel]
"""

kwargs = _get_kwargs(
Expand All @@ -136,7 +137,7 @@ async def asyncio(
alert_seq: int,
*,
client: AuthenticatedClient,
) -> Optional[AcknowledgeAlertResponse]:
) -> AcknowledgeAlertResponse | ErrorModel | None:
"""Acknowledge alert

Mark an alert as acknowledged
Expand All @@ -149,7 +150,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
AcknowledgeAlertResponse
AcknowledgeAlertResponse | ErrorModel
"""

return (
Expand Down
36 changes: 18 additions & 18 deletions src/tower/tower_api_client/api/default/acknowledge_all_alerts.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from http import HTTPStatus
from typing import Any, Optional, Union
from typing import Any

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.acknowledge_all_alerts_response import AcknowledgeAllAlertsResponse
from ...models.error_model import ErrorModel
from ...types import Response


Expand All @@ -19,21 +19,21 @@ def _get_kwargs() -> dict[str, Any]:


def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Optional[AcknowledgeAllAlertsResponse]:
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> AcknowledgeAllAlertsResponse | ErrorModel:
if response.status_code == 200:
response_200 = AcknowledgeAllAlertsResponse.from_dict(response.json())

return response_200
if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None

response_default = ErrorModel.from_dict(response.json())

return response_default


def _build_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
) -> Response[AcknowledgeAllAlertsResponse]:
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Response[AcknowledgeAllAlertsResponse | ErrorModel]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
Expand All @@ -45,7 +45,7 @@ def _build_response(
def sync_detailed(
*,
client: AuthenticatedClient,
) -> Response[AcknowledgeAllAlertsResponse]:
) -> Response[AcknowledgeAllAlertsResponse | ErrorModel]:
"""Acknowledge all alerts

Mark all unacknowledged alerts as acknowledged for the current user in the current account
Expand All @@ -55,7 +55,7 @@ def sync_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[AcknowledgeAllAlertsResponse]
Response[AcknowledgeAllAlertsResponse | ErrorModel]
"""

kwargs = _get_kwargs()
Expand All @@ -70,7 +70,7 @@ def sync_detailed(
def sync(
*,
client: AuthenticatedClient,
) -> Optional[AcknowledgeAllAlertsResponse]:
) -> AcknowledgeAllAlertsResponse | ErrorModel | None:
"""Acknowledge all alerts

Mark all unacknowledged alerts as acknowledged for the current user in the current account
Expand All @@ -80,7 +80,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
AcknowledgeAllAlertsResponse
AcknowledgeAllAlertsResponse | ErrorModel
"""

return sync_detailed(
Expand All @@ -91,7 +91,7 @@ def sync(
async def asyncio_detailed(
*,
client: AuthenticatedClient,
) -> Response[AcknowledgeAllAlertsResponse]:
) -> Response[AcknowledgeAllAlertsResponse | ErrorModel]:
"""Acknowledge all alerts

Mark all unacknowledged alerts as acknowledged for the current user in the current account
Expand All @@ -101,7 +101,7 @@ async def asyncio_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[AcknowledgeAllAlertsResponse]
Response[AcknowledgeAllAlertsResponse | ErrorModel]
"""

kwargs = _get_kwargs()
Expand All @@ -114,7 +114,7 @@ async def asyncio_detailed(
async def asyncio(
*,
client: AuthenticatedClient,
) -> Optional[AcknowledgeAllAlertsResponse]:
) -> AcknowledgeAllAlertsResponse | ErrorModel | None:
"""Acknowledge all alerts

Mark all unacknowledged alerts as acknowledged for the current user in the current account
Expand All @@ -124,7 +124,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
AcknowledgeAllAlertsResponse
AcknowledgeAllAlertsResponse | ErrorModel
"""

return (
Expand Down
Loading