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
27 changes: 26 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.59.0] - 2026-08-18

### Added

- `tilebox-workflows`: Added support for asynchronous task `execute()` methods, allowing tasks to await async APIs
directly.
- `tilebox-workflows`: Added typed task-input serialization for the following types and libraries:
- Python primitives and containers: `None`, `bool`, `int`, `float`, `str`, `bytes`, `bytearray`, `list`, `tuple`,
`dict`, `set`, and `frozenset`, including nested dataclasses, enums, unions, and optional values.
- Python standard-library value types: `datetime`, `date`, `time`, `timedelta`, `UUID`, `Decimal`, `PurePath`
subclasses such as `Path`, and `ZoneInfo`.
- Protobuf `Message` types, including messages nested in dataclasses and containers.
- Shapely geometry types, including points, lines, linear rings, polygons, multi-geometries, and geometry
collections.
- `affine.Affine` and `pyproj.CRS`.
- ODC Geo `CRS`, `Geometry`, `BoundingBox`, `XY`, `Resolution`, `Index2d`, `Shape2d`, `GeoBox`, `GeoboxTiles`, and
`AnchorEnum`.
- Tilebox Datasets `TimeInterval`, `IDInterval`, and `SpatialFilter`.
- Raster windows from Rasterio and async-geotiff when the corresponding optional library is installed.

### Changed

- `tilebox-workflows`: job responses no longer include task summaries.
- `tilebox-workflows`: Use `GetJob` for live notebook progress updates

### Fixed

- `tilebox-workflows`: Propagate the task ID to all OpenTelemetry sub-spans created during task execution.

## [0.58.0] - 2026-07-31

Expand Down Expand Up @@ -447,7 +471,8 @@ the first client that does not cache data (since it's already on the local file
- Released under the [MIT](https://opensource.org/license/mit) license.
- Released packages: `tilebox-datasets`, `tilebox-workflows`, `tilebox-storage`, `tilebox-grpc`

[Unreleased]: https://github.com/tilebox/tilebox-python/compare/v0.58.0...HEAD
[Unreleased]: https://github.com/tilebox/tilebox-python/compare/v0.59.0...HEAD
[0.59.0]: https://github.com/tilebox/tilebox-python/compare/v0.58.0...v0.59.0
[0.58.0]: https://github.com/tilebox/tilebox-python/compare/v0.57.0...v0.58.0
[0.57.0]: https://github.com/tilebox/tilebox-python/compare/v0.56.0...v0.57.0
[0.56.0]: https://github.com/tilebox/tilebox-python/compare/v0.55.1...v0.56.0
Expand Down
2 changes: 1 addition & 1 deletion prek.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ hooks = [

[[repos]]
repo = "https://github.com/charliermarsh/ruff-pre-commit"
rev = "v0.16.1"
rev = "v0.16.2"
hooks = [
{
id = "ruff-check",
Expand Down
10 changes: 10 additions & 0 deletions tilebox-workflows/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,21 @@ dependencies = [
# grpcio 1.80.0 contains unwanted log message spam: https://github.com/grpc/grpc/issues/42293
"grpcio<1.80.0",
"opentelemetry-instrumentation-logging>=0.62b1",
"msgspec>=0.19",
]

[project.optional-dependencies]
geospatial = [
"affine>=2",
"odc-geo>=0.5",
"pyproj>=3.4",
"shapely>=2",
]

[dependency-groups]
dev = [
"hypothesis>=6.112.1",
"odc-geo>=0.5",
"pytest-cov>=5.0.0",
"pytest>=8.3.2",
"moto>=5",
Expand Down
4 changes: 2 additions & 2 deletions tilebox-workflows/tests/automations/test_cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ExampleProtoCronTask(CronTask):


def test_cron_task_serialization() -> None:
assert ExampleCronTask("test", 42)._serialize_args() == b'{"name": "test", "value": 42}'
assert ExampleCronTask("test", 42)._serialize_args() == b'{"name":"test","value":42}'


def test_cron_task_serialization_protobuf() -> None:
Expand All @@ -36,7 +36,7 @@ def test_cron_task_de_serialization_roundtrip() -> None:
triggered_task = task.once(trigger_time=datetime(2021, 1, 1, 0, 0, 0, tzinfo=timezone.utc))

serialized = triggered_task._serialize()
assert serialized == b'\n\x08\n\x06\x08\x80\xcc\xb9\xff\x05\x12\x1d{"name": "test", "value": 42}'
assert serialized == b'\n\x08\n\x06\x08\x80\xcc\xb9\xff\x05\x12\x1a{"name":"test","value":42}'
assert ExampleCronTask._deserialize(serialized) == triggered_task


Expand Down
2 changes: 1 addition & 1 deletion tilebox-workflows/tests/automations/test_storage_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ExampleProtoStorageEventTask(StorageEventTask):


def test_storage_event_task_serialization() -> None:
assert ExampleStorageEventTask("test", 42)._serialize_args() == b'{"name": "test", "value": 42}'
assert ExampleStorageEventTask("test", 42)._serialize_args() == b'{"name":"test","value":42}'


def test_storage_event_task_serialization_protobuf() -> None:
Expand Down
19 changes: 19 additions & 0 deletions tilebox-workflows/tests/observability/test_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
class RecordingSpanProcessor(SpanProcessor):
def __init__(self) -> None:
self.span_names: list[str] = []
self.span_attributes: dict[str, dict[str, object]] = {}

def on_start(self, span: Span, parent_context: Context | None = None) -> None:
pass

def on_end(self, span: ReadableSpan) -> None:
self.span_names.append(span.name)
self.span_attributes[span.name] = dict(span.attributes or {})

def shutdown(self) -> None:
pass
Expand Down Expand Up @@ -74,3 +76,20 @@ def test_workflow_tracers_copy_configured_span_processors_once(
["span-0"],
["span-1"],
]


def test_workflow_tracer_propagates_task_id_to_sub_spans(
span_processors: list[RecordingSpanProcessor],
) -> None:
tracer = tracing.WorkflowTracer(service=None, url="https://api.tilebox.com", token=None)

with tracer.span("task") as task_span:
task_span.set_attribute("task_id", "task-123")
with tracer.span("sub-span"), tracer.span("nested-sub-span"):
pass

assert span_processors[0].span_attributes == {
"nested-sub-span": {"task_id": "task-123"},
"sub-span": {"task_id": "task-123"},
"task": {"task_id": "task-123"},
}
12 changes: 2 additions & 10 deletions tilebox-workflows/tests/runner/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def execute(self, context: ExecutionContext) -> None:
cache[f"fib_{self.n}"] = int_to_bytes(fib_n_1 + fib_n_2)


def test_runner_with_fibonacci_workflow() -> None:
@pytest.mark.asyncio
async def test_runner_with_fibonacci_workflow() -> None:
client = replay_client("fibonacci_workflow.rpcs.bin")
n = 7 # compute fib(7)
with patch("tilebox.workflows.jobs.client.get_trace_parent_of_current_span") as get_trace_parent_mock:
Expand Down Expand Up @@ -235,15 +236,6 @@ def _mock_task_runner() -> TaskRunner:
)


@pytest.mark.asyncio
async def test_runner_must_be_called_from_synchronous_code() -> None:
runner = _mock_task_runner()

for run in (runner.run_all, runner.run_forever):
with pytest.raises(RuntimeError, match="must be called from synchronous code"):
run()


def test_runner_disallow_duplicate_task_identifiers() -> None:
runner = _mock_task_runner()

Expand Down
2 changes: 1 addition & 1 deletion tilebox-workflows/tests/test_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class ExampleTaskWithMultipleArgs(Task):

def test_serialize_multiple_args_json() -> None:
task = ExampleTaskWithMultipleArgs("Hello", 123)
assert serialize_task(task) == json.dumps({"x": "Hello", "y": 123}).encode()
assert json.loads(serialize_task(task)) == {"x": "Hello", "y": 123}


def test_serialize_deserialize_multiple_args_json() -> None:
Expand Down
Loading
Loading