parallel-web 0.1.0__tar.gz → 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of parallel-web might be problematic. Click here for more details.
- parallel_web-0.1.1/.release-please-manifest.json +3 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/CHANGELOG.md +18 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/PKG-INFO +13 -9
- {parallel_web-0.1.0 → parallel_web-0.1.1}/README.md +12 -8
- {parallel_web-0.1.0 → parallel_web-0.1.1}/pyproject.toml +1 -1
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_version.py +1 -1
- parallel_web-0.1.1/src/parallel/lib/_pydantic.py +31 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/types/task_run.py +1 -4
- parallel_web-0.1.0/.release-please-manifest.json +0 -3
- parallel_web-0.1.0/src/parallel/lib/_pydantic.py +0 -29
- {parallel_web-0.1.0 → parallel_web-0.1.1}/.gitignore +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/CONTRIBUTING.md +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/LICENSE +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/SECURITY.md +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/api.md +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/bin/check-release-environment +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/bin/publish-pypi +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/examples/.keep +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/mypy.ini +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/noxfile.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/release-please-config.json +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/requirements-dev.lock +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/requirements.lock +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/__init__.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_base_client.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_client.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_compat.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_constants.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_exceptions.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_files.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_models.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_qs.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_resource.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_response.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_streaming.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_types.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_utils/__init__.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_utils/_logs.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_utils/_proxy.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_utils/_reflection.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_utils/_streams.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_utils/_sync.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_utils/_transform.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_utils/_typing.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/_utils/_utils.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/lib/.keep +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/lib/__init__.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/lib/_parsing/__init__.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/lib/_parsing/_task_run_result.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/lib/_parsing/_task_spec.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/lib/_time.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/py.typed +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/resources/__init__.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/resources/task_run.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/types/__init__.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/types/json_schema_param.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/types/parsed_task_run_result.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/types/task_run_create_params.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/types/task_run_result.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/types/task_run_result_params.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/types/task_spec_param.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/src/parallel/types/text_schema_param.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/__init__.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/api_resources/__init__.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/api_resources/test_task_run.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/conftest.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/sample_file.txt +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/test_client.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/test_deepcopy.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/test_extract_files.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/test_files.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/test_models.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/test_qs.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/test_required_args.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/test_response.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/test_streaming.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/test_transform.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/test_utils/test_proxy.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/test_utils/test_typing.py +0 -0
- {parallel_web-0.1.0 → parallel_web-0.1.1}/tests/utils.py +0 -0
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.1 (2025-04-25)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.1.0...v0.1.1](https://github.com/shapleyai/parallel-sdk-python/compare/v0.1.0...v0.1.1)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** update via SDK Studio ([4cc79c4](https://github.com/shapleyai/parallel-sdk-python/commit/4cc79c4d1edaa9d1d080b81830961252c8b327c1))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **pydantic:** add fields to json schema, better error messages ([38a2ddc](https://github.com/shapleyai/parallel-sdk-python/commit/38a2ddc348ac7acf11f9f75f69900b628e539c1d))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Chores
|
|
18
|
+
|
|
19
|
+
* **readme:** update low level api examples ([f17e34e](https://github.com/shapleyai/parallel-sdk-python/commit/f17e34e0e0a6d3205c344c278f1643826938e9d1))
|
|
20
|
+
|
|
3
21
|
## 0.1.0 (2025-04-24)
|
|
4
22
|
|
|
5
23
|
Full Changelog: [v0.0.1-alpha.0...v0.1.0](https://github.com/shapleyai/parallel-sdk-python/compare/v0.0.1-alpha.0...v0.1.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: parallel-web
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: The official Python library for the Parallel API
|
|
5
5
|
Project-URL: Homepage, https://github.com/shapleyai/parallel-sdk-python
|
|
6
6
|
Project-URL: Repository, https://github.com/shapleyai/parallel-sdk-python
|
|
@@ -223,15 +223,15 @@ from parallel.types import TaskSpecParam
|
|
|
223
223
|
client = Parallel()
|
|
224
224
|
|
|
225
225
|
task_run = client.task_run.create(
|
|
226
|
-
input="France
|
|
227
|
-
processor="
|
|
226
|
+
input={"country": "France", "year": 2023},
|
|
227
|
+
processor="core",
|
|
228
228
|
task_spec={
|
|
229
229
|
"output_schema": {
|
|
230
230
|
"json_schema": {
|
|
231
231
|
"additionalProperties": False,
|
|
232
232
|
"properties": {
|
|
233
233
|
"gdp": {
|
|
234
|
-
"description": "GDP in USD for the year
|
|
234
|
+
"description": "GDP in USD for the year",
|
|
235
235
|
"type": "string",
|
|
236
236
|
}
|
|
237
237
|
},
|
|
@@ -244,12 +244,16 @@ task_run = client.task_run.create(
|
|
|
244
244
|
"json_schema": {
|
|
245
245
|
"additionalProperties": False,
|
|
246
246
|
"properties": {
|
|
247
|
-
"
|
|
248
|
-
"description": "
|
|
247
|
+
"country": {
|
|
248
|
+
"description": "Name of the country to research",
|
|
249
249
|
"type": "string",
|
|
250
|
-
}
|
|
250
|
+
},
|
|
251
|
+
"year": {
|
|
252
|
+
"description": "Year for which to retrieve information",
|
|
253
|
+
"type": "integer",
|
|
254
|
+
},
|
|
251
255
|
},
|
|
252
|
-
"required": ["
|
|
256
|
+
"required": ["country", "year"],
|
|
253
257
|
"type": "object",
|
|
254
258
|
},
|
|
255
259
|
"type": "json",
|
|
@@ -257,7 +261,7 @@ task_run = client.task_run.create(
|
|
|
257
261
|
},
|
|
258
262
|
)
|
|
259
263
|
|
|
260
|
-
run_result = client.task_run.result(task_run.
|
|
264
|
+
run_result = client.task_run.result(task_run.run_id)
|
|
261
265
|
print(run_result.output)
|
|
262
266
|
```
|
|
263
267
|
|
|
@@ -192,15 +192,15 @@ from parallel.types import TaskSpecParam
|
|
|
192
192
|
client = Parallel()
|
|
193
193
|
|
|
194
194
|
task_run = client.task_run.create(
|
|
195
|
-
input="France
|
|
196
|
-
processor="
|
|
195
|
+
input={"country": "France", "year": 2023},
|
|
196
|
+
processor="core",
|
|
197
197
|
task_spec={
|
|
198
198
|
"output_schema": {
|
|
199
199
|
"json_schema": {
|
|
200
200
|
"additionalProperties": False,
|
|
201
201
|
"properties": {
|
|
202
202
|
"gdp": {
|
|
203
|
-
"description": "GDP in USD for the year
|
|
203
|
+
"description": "GDP in USD for the year",
|
|
204
204
|
"type": "string",
|
|
205
205
|
}
|
|
206
206
|
},
|
|
@@ -213,12 +213,16 @@ task_run = client.task_run.create(
|
|
|
213
213
|
"json_schema": {
|
|
214
214
|
"additionalProperties": False,
|
|
215
215
|
"properties": {
|
|
216
|
-
"
|
|
217
|
-
"description": "
|
|
216
|
+
"country": {
|
|
217
|
+
"description": "Name of the country to research",
|
|
218
218
|
"type": "string",
|
|
219
|
-
}
|
|
219
|
+
},
|
|
220
|
+
"year": {
|
|
221
|
+
"description": "Year for which to retrieve information",
|
|
222
|
+
"type": "integer",
|
|
223
|
+
},
|
|
220
224
|
},
|
|
221
|
-
"required": ["
|
|
225
|
+
"required": ["country", "year"],
|
|
222
226
|
"type": "object",
|
|
223
227
|
},
|
|
224
228
|
"type": "json",
|
|
@@ -226,7 +230,7 @@ task_run = client.task_run.create(
|
|
|
226
230
|
},
|
|
227
231
|
)
|
|
228
232
|
|
|
229
|
-
run_result = client.task_run.result(task_run.
|
|
233
|
+
run_result = client.task_run.result(task_run.run_id)
|
|
230
234
|
print(run_result.output)
|
|
231
235
|
```
|
|
232
236
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import inspect
|
|
4
|
+
from typing import Any
|
|
5
|
+
from typing_extensions import TypeGuard
|
|
6
|
+
|
|
7
|
+
import pydantic
|
|
8
|
+
|
|
9
|
+
from .._compat import PYDANTIC_V2, model_json_schema
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def to_json_schema(
|
|
13
|
+
model_type: type[pydantic.BaseModel] | pydantic.TypeAdapter[Any],
|
|
14
|
+
) -> dict[str, Any]:
|
|
15
|
+
"""Convert a Pydantic model/type adapter to a JSON schema."""
|
|
16
|
+
if is_basemodel_type(model_type):
|
|
17
|
+
schema = model_json_schema(model_type)
|
|
18
|
+
elif isinstance(model_type, pydantic.TypeAdapter):
|
|
19
|
+
if not PYDANTIC_V2:
|
|
20
|
+
raise TypeError(f"TypeAdapters are only supported with Pydantic v2 - {model_type}")
|
|
21
|
+
schema = model_type.json_schema()
|
|
22
|
+
else:
|
|
23
|
+
raise TypeError(f"Unsupported type: {model_type}")
|
|
24
|
+
|
|
25
|
+
# modify the schema to make it compatible with the API format
|
|
26
|
+
schema["additionalProperties"] = False
|
|
27
|
+
return schema
|
|
28
|
+
|
|
29
|
+
def is_basemodel_type(model_type: object) -> TypeGuard[type[pydantic.BaseModel]]:
|
|
30
|
+
"""Check if a type is a Pydantic BaseModel to avoid using type: ignore."""
|
|
31
|
+
return inspect.isclass(model_type) and issubclass(model_type, pydantic.BaseModel)
|
|
@@ -29,12 +29,9 @@ class TaskRun(BaseModel):
|
|
|
29
29
|
is_active: bool
|
|
30
30
|
"""Whether the run is currently active; i.e.
|
|
31
31
|
|
|
32
|
-
status is one of {'
|
|
32
|
+
status is one of {'running', 'queued', 'cancelling'}.
|
|
33
33
|
"""
|
|
34
34
|
|
|
35
|
-
message: Optional[str] = None
|
|
36
|
-
"""Human-readable status message for the run."""
|
|
37
|
-
|
|
38
35
|
modified_at: Optional[str] = None
|
|
39
36
|
"""Timestamp of the last modification to the task, as an RFC 3339 string."""
|
|
40
37
|
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import inspect
|
|
4
|
-
from typing import Any
|
|
5
|
-
from typing_extensions import TypeGuard
|
|
6
|
-
|
|
7
|
-
import pydantic
|
|
8
|
-
|
|
9
|
-
from .._compat import PYDANTIC_V2, model_json_schema
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def to_json_schema(
|
|
13
|
-
model: type[pydantic.BaseModel] | pydantic.TypeAdapter[Any],
|
|
14
|
-
) -> dict[str, Any]:
|
|
15
|
-
"""Convert a Pydantic model/type adapter to a JSON schema."""
|
|
16
|
-
if inspect.isclass(model) and is_basemodel_type(model):
|
|
17
|
-
return model_json_schema(model)
|
|
18
|
-
|
|
19
|
-
if PYDANTIC_V2 and isinstance(model, pydantic.TypeAdapter):
|
|
20
|
-
return model.json_schema()
|
|
21
|
-
|
|
22
|
-
raise TypeError(f"Non BaseModel types are only supported with Pydantic v2 - {model}")
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def is_basemodel_type(typ: type | object) -> TypeGuard[type[pydantic.BaseModel]]:
|
|
26
|
-
"""Check if a type is a Pydantic BaseModel."""
|
|
27
|
-
if not inspect.isclass(typ):
|
|
28
|
-
return False
|
|
29
|
-
return issubclass(typ, pydantic.BaseModel)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|