Skip to content

Commit 9278467

Browse files
committed
Docs update
1 parent 6fe9fcf commit 9278467

File tree

11 files changed

+48
-23
lines changed

11 files changed

+48
-23
lines changed

CHANGELOG.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ History
55
=======
66

77
All release highlights of this project will be documented in this file.
8+
4.4.25 - Sep 30, 2024
9+
________________________
10+
11+
**Added**
12+
13+
- ``SAClient.create_project`` method, a new ``workflow`` argument has been added to define the workflow for the project.
14+
- ``SAClient.get_project_steps`` method, added instead of ``get_project_workflow`` function.
15+
- ``SAClient.set_project_steps`` method, added instead of ``set_project_workflow`` function.
16+
- ``SAClient.list_items`` method has been added to search for items using advanced filtering criteria.
17+
18+
19+
**Updated**
20+
21+
- ``SAClient.create_project`` method, removed ``workflows`` argument, use ``set_project_steps`` function instead.
22+
- ``SAClient.clone_project`` method, removed ``copy_workflow`` argument, use ``set_project_steps`` function instead.
23+
- ``SAClient.get_project_metadata`` method, removed ``include_workflow`` argument, use ``get_project_steps`` function instead.
24+
- ``SAClient.get_project_workflow`` method deprecated, use ``get_project_steps`` function instead.
25+
- ``SAClient.set_project_workflow`` method deprecated, use ``set_project_steps`` function instead.
826

927
4.4.24 - July 2, 2024
1028
_______________________

docs/source/api_reference/api_metadata.rst

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,28 +104,20 @@ Item metadata example:
104104
.. code-block:: python
105105
106106
{
107-
"createdAt": "2022-09-14T07:06:53.000Z",
107+
"createdAt": "2022-09-14T07:06:53.000Z",
108108
"updatedAt": "2022-09-30T13:14:26.000Z",
109109
"id": 33027004,
110110
"name": "5199856037_03d1929b7b_o.jpg",
111111
"path": "New Classes",
112112
"url": "None",
113-
"assignments": [
113+
"assignments": [
114114
{
115115
"user_role": "Annotator",
116116
"user_id": "annotator@example.com"
117117
},
118118
{
119119
"user_role": "QA",
120120
"user_id": "qa@example.com"
121-
},
122-
{
123-
"user_role": "reviewer",
124-
"user_id": null
125-
},
126-
{
127-
"user_role": "<role_name",
128-
"user_id": "my@example.com"
129121
}
130122
],
131123
"entropy_value": "None",

docs/source/userguide/quickstart.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Custom config.ini example:
8585
8686
[DEFAULT]
8787
SA_TOKEN = <token>
88-
LOGGING_LEVEL = DEBUG
88+
LOGGING_LEVEL = INFO
8989
LOGGING_PATH = /Users/username/data/superannotate_logs
9090
9191
----------

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ minversion = 3.7
33
log_cli=true
44
python_files = test_*.py
55
;pytest_plugins = ['pytest_profiling']
6-
addopts = -n auto --dist=loadscope
6+
;addopts = -n auto --dist=loadscope

src/superannotate/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44

55

6-
__version__ = "4.4.25dev2"
6+
__version__ = "4.4.25b1"
77

88
os.environ.update({"sa_version": __version__})
99
sys.path.append(os.path.split(os.path.realpath(__file__))[0])

src/superannotate/lib/app/interface/sdk_interface.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2666,7 +2666,7 @@ def list_items(
26662666
project: Union[int, str],
26672667
folder: Optional[Union[int, str]] = None,
26682668
*,
2669-
include: List[Literal["assignments", "custom_metadata"]] = None,
2669+
include: List[Literal["custom_metadata"]] = None,
26702670
**filters,
26712671
):
26722672
"""
@@ -2685,7 +2685,6 @@ def list_items(
26852685
26862686
Possible values are
26872687
2688-
- "assignee": Includes information about the role of the item assignee.
26892688
- "custom_metadata": Includes custom metadata attached to the item.
26902689
:type include: list of str, optional
26912690
@@ -2801,8 +2800,6 @@ def list_items(
28012800
if include:
28022801
if "custom_metadata" not in include:
28032802
exclude.add("custom_metadata")
2804-
if "assignments" not in include:
2805-
exclude.add("assignments")
28062803
return BaseSerializer.serialize_iterable(res, exclude=exclude)
28072804

28082805
def attach_items(

src/superannotate/lib/core/usecases/annotations.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,11 +1426,8 @@ def _get_validator(self, version: str) -> superannotate_schemas.Draft7Validator:
14261426
schema_response = self._service_provider.annotations.get_schema(
14271427
self._project_type, version
14281428
)
1429-
if not schema_response.ok:
1429+
if not schema_response.ok or not schema_response.data:
14301430
raise AppException(f"Schema {version} does not exist.")
1431-
if not schema_response.data:
1432-
ValidateAnnotationUseCase.SCHEMAS[key] = lambda x: x
1433-
return ValidateAnnotationUseCase.SCHEMAS[key]
14341431
validator = superannotate_schemas.Draft7Validator(schema_response.data)
14351432
from functools import partial
14361433

src/superannotate/lib/infrastructure/services/http_client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,16 @@ async def request(self, *args, **kwargs) -> aiohttp.ClientResponse:
273273
try:
274274
response = await super()._request(*args, **kwargs)
275275
if attempts <= 1 or response.status not in self.RETRY_STATUS_CODES:
276+
if not response.ok:
277+
txt = await response.text()
278+
logger.debug(
279+
f"Got {response.status} response from backend: {txt}"
280+
)
276281
return response
277282
if isinstance(kwargs["data"], aiohttp.FormData):
278283
raise RuntimeError(await response.text())
279284
except (aiohttp.ClientError, RuntimeError) as e:
285+
logger.debug(f"AsyncClient got {str(e)} response from backend")
280286
if attempts <= 1:
281287
raise
282288
data = kwargs["data"]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from unittest import TestCase
2+
from unittest.mock import patch
3+
4+
from src.superannotate import SAClient
5+
6+
sa = SAClient()
7+
8+
9+
class TestVectorValidators(TestCase):
10+
PROJECT_TYPE = "GenAi"
11+
12+
@patch("builtins.print")
13+
def test_validate_annotation_without_metadata(self, mock_print):
14+
is_valid = sa.validate_annotations(self.PROJECT_TYPE, {"instances": []})
15+
assert not is_valid
16+
mock_print.assert_any_call("'metadata' is a required property")

tests/integration/annotations/validations/test_vector_annotation_validation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,5 @@ def test_validate_create_dby(self, mock_print):
6161
assert not is_valid
6262
assert mock_print.call_args_list[0].args[0] == (
6363
"""instances[0] 'points' is a required property
64-
instances[0].createdBy.role 'dmin' is not one of ['Customer', 'Admin', 'Annotator', 'QA']
6564
instances[1] 'points' is a required property"""
6665
)

0 commit comments

Comments
 (0)