Skip to content

Commit 0d790cf

Browse files
Release v0.46.0 (#22)
1 parent 1598c89 commit 0d790cf

File tree

3 files changed

+59
-2
lines changed

3 files changed

+59
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.46.0] - 2025-12-04
11+
1012
### Added
1113

1214
- `tilebox-datasets`: Added `create_dataset` method to `Client` to create a new dataset.
@@ -293,8 +295,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
293295
- Released under the [MIT](https://opensource.org/license/mit) license.
294296
- Released packages: `tilebox-datasets`, `tilebox-workflows`, `tilebox-storage`, `tilebox-grpc`
295297

296-
[Unreleased]: https://github.com/tilebox/tilebox-python/compare/v0.45.0...HEAD
297-
[0.45.0]: https://github.com/tilebox/tilebox-python/compare/v0.45.0...v0.45.0
298+
[Unreleased]: https://github.com/tilebox/tilebox-python/compare/v0.46.0...HEAD
299+
[0.46.0]: https://github.com/tilebox/tilebox-python/compare/v0.45.0...v0.46.0
300+
[0.45.0]: https://github.com/tilebox/tilebox-python/compare/v0.44.0...v0.45.0
298301
[0.44.0]: https://github.com/tilebox/tilebox-python/compare/v0.43.0...v0.44.0
299302
[0.43.0]: https://github.com/tilebox/tilebox-python/compare/v0.42.0...v0.43.0
300303
[0.42.0]: https://github.com/tilebox/tilebox-python/compare/v0.41.0...v0.42.0

tilebox-datasets/tests/data/datasets.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import string
22
from dataclasses import replace
3+
from datetime import datetime, timedelta
34
from functools import lru_cache
5+
from uuid import UUID
46

7+
import numpy as np
58
from google.protobuf.descriptor_pb2 import FieldDescriptorProto, FileDescriptorProto, FileDescriptorSet
69
from hypothesis.strategies import (
710
DrawFn,
@@ -16,6 +19,7 @@
1619
text,
1720
uuids,
1821
)
22+
from shapely import Geometry
1923

2024
from tests.example_dataset.example_dataset_pb2 import DESCRIPTOR_PROTO
2125
from tilebox.datasets.data.datasets import (
@@ -26,6 +30,7 @@
2630
DatasetType,
2731
Field,
2832
FieldAnnotation,
33+
FieldDict,
2934
ListDatasetsResponse,
3035
)
3136
from tilebox.datasets.message_pool import register_once
@@ -39,6 +44,44 @@ def field_annotations(draw: DrawFn) -> FieldAnnotation:
3944
return FieldAnnotation(description, example_value)
4045

4146

47+
@composite
48+
def field_dicts(draw: DrawFn) -> FieldDict:
49+
"""A hypothesis strategy for generating random field dicts"""
50+
name = draw(text(alphabet=string.ascii_lowercase + "_", min_size=3, max_size=25))
51+
field_type = draw(
52+
one_of(
53+
just(str),
54+
just(list[str]),
55+
just(bytes),
56+
just(list[bytes]),
57+
just(bool),
58+
just(list[bool]),
59+
just(int),
60+
just(list[int]),
61+
just(np.uint64),
62+
just(list[np.uint64]),
63+
just(float),
64+
just(list[float]),
65+
just(timedelta),
66+
just(list[timedelta]),
67+
just(datetime),
68+
just(list[datetime]),
69+
just(UUID),
70+
just(list[UUID]),
71+
just(Geometry),
72+
just(list[Geometry]),
73+
)
74+
)
75+
annotation = draw(field_annotations())
76+
77+
return {
78+
"name": name,
79+
"type": field_type,
80+
"description": annotation.description,
81+
"example_value": annotation.example_value,
82+
}
83+
84+
4285
@composite
4386
def fields(draw: DrawFn) -> Field:
4487
"""A hypothesis strategy for generating random fields"""

tilebox-datasets/tests/data/test_datasets.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
dataset_types,
77
datasets,
88
field_annotations,
9+
field_dicts,
910
fields,
1011
list_datasets_responses,
1112
)
@@ -16,6 +17,7 @@
1617
DatasetType,
1718
Field,
1819
FieldAnnotation,
20+
FieldDict,
1921
ListDatasetsResponse,
2022
)
2123

@@ -25,6 +27,15 @@ def test_field_annotations_to_message_and_back(annotation: FieldAnnotation) -> N
2527
assert FieldAnnotation.from_message(annotation.to_message()) == annotation
2628

2729

30+
@given(field_dicts())
31+
def test_field_from_dict(field_dict: FieldDict) -> None:
32+
field = Field.from_dict(field_dict)
33+
assert field.descriptor.name == field_dict["name"]
34+
assert field.descriptor.type is not None
35+
assert field.annotation.description == field_dict.get("description", "")
36+
assert field.annotation.example_value == field_dict.get("example_value", "")
37+
38+
2839
@given(fields())
2940
def test_fields_to_message_and_back(field: Field) -> None:
3041
assert Field.from_message(field.to_message()) == field

0 commit comments

Comments
 (0)